Skip to content

Instantly share code, notes, and snippets.

@gerardo-junior
Last active December 23, 2015 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerardo-junior/7f0647bb5c648085a437 to your computer and use it in GitHub Desktop.
Save gerardo-junior/7f0647bb5c648085a437 to your computer and use it in GitHub Desktop.
Instalação do serviço de gogs (github privado)
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install git
sudo apt-get -y install mysql-server
sudo apt-get -y install openssh-server
sudo apt-get -y install mercurial
sudo apt-get -y install supervisor
sudo apt-get -y install apache2
mysql -u root -p SUA_SENHA < "CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8 COLLATE utf8_general_ci;"
sudo useradd --create-home --system --shell /bin/bash --user-group git
sudo passwd git
sudo echo "
git ALL=(ALL) ALL" >> /etc/sudoers
su git
echo "
export GOPATH=/home/git/go
export GOROOT=/usr/local/src/go
export PATH=${PATH}:$GOROOT/bin">> ~/.bashrc
source ~/.bashrc
wget https://storage.googleapis.com/golang/go1.5.2.linux-386.tar.gz
tar zxf go1.5.2.linux-386.tar.gz
sudo mv go $GOROOT
go get -d github.com/gogits/gogs
cd $GOPATH/src/github.com/gogits/gogs
go build
sudo mkdir -p /var/log/gogs
echo "
[program:gogs]
directory=/home/git/go/src/github.com/gogits/gogs/
command=/home/git/go/src/github.com/gogits/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gogs/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
environment = HOME=\"/home/git\", USER=\"git\"
user = git">>/etc/supervisor/supervisord.conf
sudo service supervisor restart
ps -ef | grep gogs
tail /var/log/gogs/stdout.log
sudo a2enmod proxy
sudo echo "<VirtualHost *:80>
ServerName gogs.localhost
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>">/etc/apache2/sites-available/gogs.localhost.conf
sudo a2ensite gogs.localhost.conf
sudo echo "
gogs.localhost 127.0.0.1">>/etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment