Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Last active August 29, 2015 14:10
Show Gist options
  • Save bryanforbes/2e3b3f332b85071b31e2 to your computer and use it in GitHub Desktop.
Save bryanforbes/2e3b3f332b85071b31e2 to your computer and use it in GitHub Desktop.

GitLab CE Omnibus installation using system nginx

Requirements

  • Ubuntu 14.04 LTS
  • Root or sudo access

Steps

  • Install git and nginx:
sudo apt-add-repository ppa:git-core/ppa
sudo apt-add-repository ppa:nginx/development
sudo apt-get update
sudo apt-get install git nginx-full
  • Install the package:
sudo apt-get install openssh-server
# If postfix or sendmail are not installed, install postfix and select 'Internet Site'; if this server
# will not handle mail for your setup, the domain entered during installation MUST NOT be the same
# as the server handling mail. For instance, use git.yourdomain.com instead of yourdomain.com.
sudo apt-get install postfix
wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.5.1-omnibus.5.2.0.ci-1_amd64.deb
sudo dpkg -i gitlab_7.5.1-omnibus.5.2.0.ci-1_amd64.deb
  • Edit /etc/gitlab/gitlab.rb to look similar to the following:
# Check and change the external_url to the address your users will type in their browser
# If you aren't using SSL, change 'https' to 'http'
external_url 'https://git.yourdomain.com'
nginx['enable'] = false
web_server['external_users'] = ['www-data']
gitlab_rails['gitlab_email_from'] = '[email protected]'
# Uncomment the following to use a different directory than GitLab's packages default to
# git_data_dir '/srv/git'
  • Run sudo gitlab-ctl reconfigure
  • Copy the nginx configuration file into place:
# For an SSL site
sudo cp /opt/gitlab/embedded/service/gitlab-rails/lib/support/nginx/gitlab-ssl /etc/nginx/sites-available/git.nginx
# For an HTTP site
sudo cp /opt/gitlab/embedded/service/gitlab-rails/lib/support/nginx/gitlab /etc/nginx/sites-available/git.nginx
  • Edit /etc/nginx/sites-available/git.nginx:
    • Perform the following replacements:
      • /home/git/gitlab/tmp/ -> /var/opt/gitlab/gitlab-rails/
      • YOUR_SERVER_FQDN -> git.yourdomain.com
      • /home/git/gitlab/ -> /opt/gitlab/embedded/service/gitlab-rails/
    • If this is not the main domain hosted, remove default_server from any listen directives
    • If this will be an SSL site, adjust the ssl_certificate and ssl_certificate_key directives to reference the correct files
    • (Optional) Adjust access_log and error_log directives to suit your taste
  • Enable the new configuration and test it:
sudo ln -s /etc/nginx/sites-available/git.nginx /etc/nginx/sites-enabled/git.nginx
sudo nginx -t
  • Restart nginx:
sudo service nginx restart
  • Browse to http://git.yourdomain.com and login with root / 5iveL!fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment