ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans

How to Install and Setup GitLab on CentOS 7

Gitlab is graphical implementation of git, it is an open source repository management and version control system. GitLab is developed on Ruby on Rails. Using GitLab you can host your source code on your own server. This ensures security of the code, and gives you total freedom on the number of users as well as number of repositories and number of files. GitLab provides you with a platform to collaborate on projects and to keep track of changes in code. GitLab is widely used for software development and version control related tasks. In many ways it is similar to GitHub, except you can install it in your own server. It is very popular version control system and used by many prominent companies like Alibaba, IBM, NASA, SpaceX etc.

Features of GitLab

Although there are many features of GitLab, but few notable features are.

  • GitLab provides you web interface to edit files, directories and create merge requests.
  • It is self hosted, hence you have full control over your server and the source code hosted inside.
  • It provides LDAP user authentication and has two factor authentication system which makes the application very secure.
  • You can insert your own branding in the login page and it also supports project import from GitHub and other sources to GitLab.
  • It has lots of features like code reviews, issue tracking, activity feeds and inbuilt wiki.
  • It provides a fine work flow management which gives you ability to create groups for a project, ability to fork a repository as well as it provides ability to manage large binaries with git LFS.
  • GitLab comes with GitLab CI for continuous integration. You can also Docker with GitLab CI.
  • It's free and open source hence you won't have to deal with any licensing issues.

Requirements

GitLab supports many Linux operating system but in this tutorial we are going to install GitLab Community Edition into CentOS 7.x.

Requirements to install GitLab -

  • VPS, Cloud or Dedicated Server running CentOS 7.x
  • 1 core CPU can support upto 100 users but recommended 2 core CPU which can easily support up to 500 users.
  • At least 2GB memory combining both RAM and swap. Apart from this we will need to install all the required dependencies in the tutorial. If you have more the 500 users using GitLab you can always increase the CPU cores and Memory to add support for more users. If you have very high availability like more the 50000 users you can also run it on multiple application servers.

Installing GitLab

In this guide we will be using a non root account to install GitLab and all the required dependencies. If you are logged in to your server using rootaccount, omit using sudo command from all the commands.

Update the packages of yum using the following command

sudo yum -y update

Now install SSH server on your machine using the command below. If you are installing it on a remote server using an SSH client like putty then you already have openssh-server and openssh-clients installed. If they are already installed you can skip this step.

sudo yum -y install openssh-server openssh-clients sudo systemctl enable sshd sudo systemctl start sshd

The first command will install SSH on your server, if it is already installed, it will display a message that nothing to do. The next command will enable the SSH server to automatically start on startup. The final command will start SSH immediately.

Now install dependencies by running the following command.

sudo yum -y install curl policycoreutils postfix sudo systemctl enable postfix sudo systemctl start postfix

The first command will install curl, policycoreutils and postfix in to your server. curl is used to transfer data between servers and the policycoreutils packages contain the core utilities that are required for the basic operation of a SELinux system and its policies. postfix is a free and open-source mail transfer agent that routes and delivers emails. The next command will enable postfix to automatically start on startup. The final command will start postfix immediately.

Now add firewall exception for http and https in your server by issuing the following commands -

sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo systemctl reload firewalld

Now execute the following command to add Gitlab package server into your repository -

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

Now run the following command to install Gitlab Community Edition -

sudo yum -y install gitlab-ce

Once the installation is finished you will see output similar to this -

    gitlab: Thank you for installing GitLab!
    gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://vps.liptanbiswas.com gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab: And running reconfigure again. gitlab: gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab: It looks like GitLab has not been configured yet; skipping the upgrade script. Verifying : gitlab-ce-8.8.5-ce.1.el7.x86_64 1/1

Installed: gitlab-ce.x86_64 0:8.8.5-ce.1.el7

Complete!

Now you will need to run the following command to configure and run GitLab -

sudo gitlab-ctl reconfigure

Now you browse the following address using your favorite web browser -

http://server_IP_address

Where server_IP_address is the IP address of your server. You can also access the server using your hostname if your domain is pointed to the server. You will see the following interface in your browser, where you will be asked to create a new password for root or Administrative user of GitLab.

Enter the new password twice and click on Change your password button.

Now you will be taken to sign in interface. This interface will be shown to everybody who visits the website. You can login to administrative account by using the username root and your newly created password.

Once you are logged in you will see the following interface -

GitLab is now successfully installed. Now you can either configure the settings or you can create a new project.

Branding of the Login Page

Once you are logged in you can brand your login page by changing the logos and text of your login page. Click on the small setting icon next to search bar on top menu to access Admin area of GitLab.

Click on the Appearance option from sidebar and you will be taken to Appearance settings interface from where you can modify look and feel of GitLab. For Sign in/Sign up pages, Enter your custom title of the page. In the description area, you can provide a further description for the login page, in Markdown syntax. Next choose your custom logo for the Sign in/Sign up page. The recommended size of the logo is 640x360 px. In next option you can choose Logo for your header. The recommended size for header logo is 72x72 px. Click the Save button to save the Appearance of the pages.

Now you can logout to view the login page changes.

Creating a New Project

To create a new project on GitLab, go back to the user dashboard by clicking on the GitLab Icon, and then click on New Project button, or you can always click on the + icon next to the notification icon to create a new project.

In the new project interface, enter the path for your new project. If you want to import project from some other source, you can click on the icon provided. Now enter the description for your project, and choose a visibility level for your project. If project visibility is set to Private then admin must provide permission to each user to access the project. The project can be cloned by only those users who have access to the project. If project visibility is set to internal then all the logged in user can clone the project, if it is set to public then project can be cloned without any authentication.

Click on Create project button and your project will be created.

To clone, push or pull the project via git, you will need to add your SSH public key. You can click on add an SSH key link, or you can always go to your Profile -> Keys to add SSH keys. In Add an SSH key, enter your public key in Key field and provide a title for your key.

Click on Add key once done. You can now manage your project via SSH too.

Conclusion

In this tutorial we have learnt how to install and setup Gitlab on CentOS 7.x. You can now successfully deploy GitLab on CentOS. You can also setup a new project in GitLab. Using GitLab is very easy, and it has an inbuilt help feature to provide you instructions on using GitLab. Once you setup GitLab successfully, all your collaborators can signup and start contributing to your project.

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans