Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active October 14, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jniltinho/92283c1300e42252d2543e92c6fdafb0 to your computer and use it in GitHub Desktop.
Save jniltinho/92283c1300e42252d2543e92c6fdafb0 to your computer and use it in GitHub Desktop.
Install Gogs Debian Apache2 Webserver
#!/bin/bash
## Install Gogs v0.9.113 + Apache2 Webserver + Mysql
## On Debian 64Bits
## Author: Nilton OS -- www.linuxpro.com.br
## Version: 0.1
### Tested on Debian 8.7 64Bits
echo 'Support Debian'
echo 'Installs Gogs 0.9.113'
echo 'Requires Debian 8+'
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "You must run the script as root or using sudo"
exit 1
fi
### Vars
GOGS_LINK="https://dl.gogs.io"
GOGS_FILE=gogs_v0.9.113_linux_amd64.tar.gz
apt-get update
apt-get install -y git-core
adduser --disabled-login --gecos 'Gogs' git
cd /home/git
wget --no-check-certificate $GOGS_LINK/$GOGS_FILE
tar -xvf $GOGS_FILE && rm -f $GOGS_FILE
# mysql -p < /home/git/gogs/scripts/mysql.sql
chmod +x /home/git/gogs/gogs
mkdir -p /home/git/gogs/log
chown -R git:git /home/git/gogs
chown -R git:git /home/git/gogs/*
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
sed -i 's|#After=mysqld.service|After=mysql.service|' /etc/systemd/system/gogs.service
systemctl daemon-reload
systemctl enable gogs.service
systemctl start gogs.service
### https://gogs.io/docs/intro/faqs#how-do-i-set-up-a-sub-url-with-apache-2
### How do I use Apache 2 with Reverse Proxy?
### Don’t forget to enable apache mods: proxy, proxy_http
### a2enmod proxy proxy_http
### service apache2 restart
### Config Apache2
# ProxyPreserveHost On
# ProxyRequests off
# ProxyPass / http://127.0.0.1:3000/
# ProxyPassReverse / http://127.0.0.1:3000/
### How do I set up a sub-URL with Apache 2?
### Use following configuration templates:
#<Proxy *>
# Order allow,deny
# Allow from all
# </Proxy>
# ProxyPass /git http://127.0.0.1:3000
# ProxyPassReverse /git http://127.0.0.1:3000
echo "Screencast Install: http://blog.linuxpro.com.br/2015/08/14/instalando-gogs-no-ubuntu/"
## Links
## http://gogs.io/docs/installation/install_from_source.html
## http://gogs.io/
## https://github.com/gogits/gogs/
## https://github.com/gogits/gogs/blob/master/conf/app.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment