How to Install GitLab on Ubuntu 14

Try it in our public cloud & Get $50 Credit
CLAIM NOW

The GitLab platform is a Ruby-based hosting service for repositories using the common version control system Git. Similar to GitHub in its function, GitLab differs in its delivery of its promise as an integrated platform for all things related to managing Git repositories and projects. With a unique focus on security through features such as increased ability to manage permissions and protect code versions, GitLab is a popular choice for both enterprises and individuals wanting more security.

In this guide, we will show you how you can install the free version of GitLab, known as the Community Edition, on your Ubuntu 14 server so that you can experiment with the unique GitLab offerings for yourself.

Getting Started

Before proceeding with the steps in this guide, make sure you have the following:
• 1 Node (Cloud Server or Dedicated Server) running Ubuntu 14.
• Root access to the node or superuser permissions.

Please ensure that you have access to the root user or are added as a sudoer, meaning you have superuser privileges, before proceeding.

Tutorial

Prior to the installation process for GitLab, or any new packages for that matter, it is highly recommended ensuring that your Ubuntu 14 system is updated. We can easily do this using the native package manager apt for Ubuntu. By using apt, we will first send a call to update the local package repository information, which will check what package updates are available. Execute this command as the root user, or if you are not signed in as root, append sudo to the start of the command (as well as all following commands meant to be executed as root). Using sudo will ensure that the command is executed as the root user provided that the current user has the right privileges.

apt-get update

After the update command has fetched the necessary information, we will then upgrade the packages with found updates, again using apt.

sudo apt-get upgrade

With your Ubuntu 14 server freshly updated, we can now install the prerequisite packages for GitLab. These packages include the OpenSSH server, to enable connections on your server, as well as Postfix, a mail client. The other two packages are not prerequisites for GitLab specifically, but rather are used in a variety of normal system operations and will be used in this tutorial to handle installing GitLab. Thus, we will download them alongside Postfix and OpenSSH in the case that they are not already installed using apt. Note how we use the -y flag to skip the regular prompts during the installation process for simplicity.

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

When the installation of the packages is complete, you will need to start OpenSSH and Postfix. You can do this by running the service command as root:

service sshd start
service postfix start

In order to simplify server management, you can also set these two services to start whenever the server is booted (recommended). In order to do this, you will need to run:

update-rc.d sshd enable
update-rc.d postfix enable

With Postfix and OpenSSH running on your machine, you are now ready to install Gitlab. To do this, you will need to install the correct repository package, which you can fetch using the command curl. This command will download the installation script file to your local machine and run the script using bash. We execute both commands at the same time by using the | character, known as a pipe, which will pass on the output of the first command into whatever follows the pipe, in this case the bash language interpreter. Note that if you are appending sudo to the start of each command if you are not signed in as root, you will need to also append it to the command following the pipe in the format: sudo [command1] | sudo [command2]. Download and run the script now:

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

After the installation script is complete, you will need to run the GitLab configuration process using the installed gitlab-ctl command. This command will also start up GitLab:

gitlab-ctl reconfigure

You can confirm that GitLab was installed by running the following command:

apt-cache show gitlab

The output of the apt-cache command should include the following text to confirm that GitLab has been properly installed:

Status: install ok config-files

When GitLab is installed on your Ubuntu 14 server, you will be able to access it using the browser. Open your browser and navigate to the following link, replacing the tutorial IP address with the IP address of your own server:

http://10.10.0.35/

Having opened the browser, the default landing page for GitLab will show. Since this is your first visit, you will be redirected to a password reset screen where you will have to create a new password for the initial administrator account, whose default username is “root.” Remember the credentials you set as you will use them each time you access GitLab.

After providing the password, you will be redirected back to the main landing screen with a brief description about GitLab as well as the options to either sign in or register an account. Login with the password you created, using “root” as your username. Note that if you wish to change the username, you will be able to modify it after logging in.

When you successfully login, GitLab will show you all the projects you have currently linked and you are free to start exploring!

Conclusion

Congratulations! That was all you needed to set up GitLab on your server. Easy, right? With such a quick installation process, there’s plenty more time for you to explore what GitLab can do on your own from their website. If you found this guide useful, why not share it?