Skip to content

Instantly share code, notes, and snippets.

@alanorth
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alanorth/f79e97c0c2f19bcf2bf4 to your computer and use it in GitHub Desktop.
Save alanorth/f79e97c0c2f19bcf2bf4 to your computer and use it in GitHub Desktop.
Configuring gogs.io in an Ubuntu 14.04 VM

Gogs.io on Ubuntu 14.04

Create the VM

Create a VM using virt-install and feed it a preseed.

$ sudo virt-install --name gogs --ram 1024 --vcpus=1,cpuset=3 --cpu host --disk path=/home/aorth/software/vms/gogs.qcow2,size=40,bus=virtio,format=qcow2 --bridge=br0 --os-variant ubuntusaucy --location http://ubuntu.mirror.ac.ke/ubuntu/dists/trusty/main/installer-amd64 --graphics vnc -x "auto=true priority=critical url=http://192.168.5.3/~aorth/preseed/gogs.cfg"

You will have to configure the network manually (you can't set the network configuration in the preseed when using a network-based preseed, apparently).

Add users

After installation you need to add a user for yourself and one for gogs:

# useradd --create-home --shell /bin/bash --groups sudo aorth
# useradd --create-home --system --shell /bin/bash --user-group git

Use your user for all sudo / root tasks, and the git user for gogs tasks.

Install packages

Using the Gogs.io page as a reference, update the system and install the dependencies:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install git mysql-server

Create MySQL database

$ mysql -u root -p
mysql> SET GLOBAL storage_engine = 'InnoDB';
mysql> CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin;
mysql> GRANT ALL PRIVILEGES ON gogs.* TO 'root'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> \q

Install gogs

Download a gogs binary:

$ sudo su - git
$ mkdir -p src/gogs
$ cd src/gogs
$ curl -L http://gobuild.io/github.com/gogits/gogs/v0.4.2/linux/amd64 -o v0.4.2.zip
$ unzip v0.4.2.zip
$ ./start.sh

Use the web interface to install / configure gogs: http://ip:3000

Configure gogs

See the configuration cheat sheet on the gogs website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment