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.
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.
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.
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.
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 -
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: For a comprehensive list of configuration options please see the Omnibus GitLab readme
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
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 -
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.
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.
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.
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.
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.
Looking for the right web hosting solution for your website can be an intimidating task. Options nowadays are more diversified than ever, and each year brings new developments in the web hosting market. If you have no clue of what to look out for, you can find yourself overwhelmed with...
Content marketing continues to be one of the most valuable tools for today’s online businesses. With content, you can improve your chances of reaching your target audience, boost your search engine standing, and even unlock new opportunities for sales. The more content you produce, the more you can strengthen your...
User Experience (UX) is one of the most crucial factors to consider in web design. As the number of websites and applications in the world today continues to accelerate, businesses are under more pressure than ever to impress customers straight away. If a user visits your website and finds slow-loading...