Install dependencies

sudo apt-get install curl openssh-server ca-certificates postfix

Install GitLab

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

Configure & start GitLab

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

Generate self-signed certificates

sudo cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb-DIST
sudo mkdir /etc/gitlab/ssl
sudo openssl genrsa -des3 -out /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.key 2048
sudo openssl req -new -key /etc/gitlab/ssl/gitlab.domain.com.key -out /etc/gitlab/ssl/gitlab.domain.com.csr
sudo openssl req -new -key /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.key -out /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.csr
sudo cp -v /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.{key,original}
sudo openssl rsa -in /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.original -out /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.key
sudo rm -v /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.original 
sudo openssl x509 -req -days 1460 -in /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.csr -signkey /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.key -out /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.crt
sudo rm -v /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.csr
sudo chmod 600 /etc/gitlab/ssl/cls-kvm1.itsm.unt.edu.*

Configure GitLab to use HTTPS

sudo vim /etc/gitlab/gitlab.rb

Change the appropriate lines to match the following with your information:

external_url 'https://cls-kvm1.itsm.unt.edu'
nginx['redirect_http_to_https'] = true
ci_nginx['redirect_http_to_https'] = true

Configure & start GitLab

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

Resources