Book Image

Gitlab Cookbook

By : Jeroen van Baarsen
Book Image

Gitlab Cookbook

By: Jeroen van Baarsen

Overview of this book

Table of Contents (16 chapters)
GitLab Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the Omnibus package


The people from GitLab have created an Omnibus package for the major Linux distributions (Ubuntu, Debian, and CentOS). These packages are an easy way of installing your GitLab installation, as they have all the dependencies packaged with them.

For this recipe, we are going to use the Ubuntu version of the Omnibus package.

Getting ready

Before we start installing, you need to have a server installed with a Ubuntu 12.04 64-bit system, and have SSH access to the server.

How to do it…

Here is how you can install GitLab using Omnibus:

  1. Download the package, change the X.Y.Z portion to the version you want to download. At the time of writing, 7.3.2 is the latest version:

    wget https://downloads-packages.s3.amazonaws.com/ubuntu-12.04/gitlab_X.Y.Z-omnibus.5.1.0.ci-1_amd64.deb
    
  2. Install the OpenSSH server:

    sudo apt-get install openssh-server
    
  3. Install Postfix:

    sudo apt-get install postfix
    
  4. Postfix will ask you what kind of installation you want; choose the Internet Site option.

  5. Enter the fully qualified domain name for the domain you want GitLab to send e-mails from (that is, gitlab.example.com).

  6. Install the Omnibus package, and replace the X.Y.Z part with your version:

    sudo dpkg -i gitlab_7.3.2-omnibus.5.1.0.ci-1_amd64.deb
    
  7. Now, we will configure your GitLab instance by running the following command:

    sudo gitlab-ctl reconfigure
    
  8. Check to see whether all the services are running using the following command:

    sudo gitlab-ctl status
    

    The output should look like the following screenshot:

You can now log in with the username root and password 5iveL!fe.

How it works…

We have just installed GitLab via the Omnibus installer. Omnibus is a way to package your application and install all the dependencies that are required to run it.

GitLab makes good use of this capability. As you only have to install a mail server and an OpenSSH server, all the other parts are automatically installed for you.

GitLab will auto configure itself with the recommended settings. If you want to change your configuration, you have to first create the configuration file. You can do this as follows:

$ sudo mkdir -p /etc/gitlab
$ sudo touch /etc/gitlab/gitlab.rb
$ sudo chmod 600 /etc/gitlab/gitlab.rb

The settings that you are most likely to change are the ones that are in the gitlab.yml file (https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example).

You need to make a small translation change in order to make this work, so let's say you want to change the port that GitLab is running on; normally, you would change the port value in the GitLab file, but now you have to add an entry to /etc/gitlab/gitlab.rb.

So, for the port, the entry in gitlab.yml would look like the following code:

production: &base
  gitlab:
    port: 80

In the gitlab.rb file, you need to create the following entry: gitlab_rails['port'] = 80.