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).
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.
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
$ 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
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
See the configuration cheat sheet on the gogs website.