Skip to content

Instantly share code, notes, and snippets.

@Tantas
Created November 30, 2014 04:30
Show Gist options
  • Save Tantas/c54df2bd7d9e00838e58 to your computer and use it in GitHub Desktop.
Save Tantas/c54df2bd7d9e00838e58 to your computer and use it in GitHub Desktop.
Ubuntu 14.04 LTS GOGS Installation using Packager, MySQL and Nginx
#!/bin/bash
# Install gogs as a package
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/pkgr/gogs trusty pkgr" | sudo tee /etc/apt/sources.list.d/gogs.list
sudo apt-get update
sudo apt-get install gogs
# Put down a webserver and mysql
APP_NAME="gogs"
MYSQL_PASSWORD="mysql_password"
HOSTNAME="localhost"
# setup mysql server and database
debconf-set-selections <<CONFIG
mysql-server-5.5 mysql-server/root_password password ${MYSQL_PASSWORD}
mysql-server-5.5 mysql-server/root_password_again password ${MYSQL_PASSWORD}
CONFIG
apt-get install -y --force-yes mysql-server
mysql -uroot -p${MYSQL_PASSWORD} -e "create database if not exists ${APP_NAME};"
# setup nginx configuration
apt-get install -y nginx
cat > /etc/nginx/sites-available/default <<EOF
server {
listen 80;
server_name ${HOSTNAME};
location / {
proxy_pass http://localhost:6000;
}
}
EOF
sudo service nginx restart
echo 'If firewall is enabled, remember to punch a hole'
echo 'sudo vim /etc/iptables.rules'
echo 'Add -A INPUT -p tcp --dport 80 -j ACCEPT'
echo 'Restart with sudo /sbin/iptables-restore < /etc/iptables.rules'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment