How to Install Gitlab Self Hosted Server on CentOS 8 Tutorial

How to Install Gitlab Self Hosted Server on CentOS 8. This article will talk about what GitLab is with its features and pros and next we will move onto installation steps on CentOS 8. 

What is Gitlab?

GitLab is a free, open source and web based repository management tool. It is an alternative to GitHub and is used in the DevOps lifecycle process. It comes with two distributions: the Enterprise Edition and the Community Edition. GitLab community edition is open source. Enterprise Edition comes with additional features.

 

GitLab Inc issues an open source license that helps DevOps in issue tracking like Bugzilla on CI/CD pipeline. It has become one of the popular and trusted software development platforms that comprise the ability to write code, verify, upload in the cloud, monitor performance and embed them following best security practices. Its features and code availability are the main reason why most businesses are looking forward to using the platform for their benefit. Also, GitLab server comprises container registry, integration of Kubernetes, CI/CD pipeline that aid in data integration and monitoring.

Features of GitLab

With this article about how to Install Gitlab Self Hosted Server on CentOS 8 let’s talk about GitLab pros. 

GitLab empowers various organizations to improve performance and gain the best results through software development. The cloud native application helps deliver software fast and efficient. It has following benefits:

Easy Configuration

Installation of GitLab CI/CD tool is an easy task. We can configure the tool on premises, container or in a cloud anywhere. All you need is to create a virtual machine and stick to a preset configuration. One can also configure GitLab projects if the user has knowledge of Git on the command line. The platform supports a limited private repository.

Deployment scheduling

In the real world the IT team require scheduling releases to avoid any sort of conflict. Also, they require support staff to monitor the performance. With the help of GitLab’s CI/CD pipeline schedules, one can specify a time for deployment management. This feature also updates the team members if any change is made to the code. Furthermore, using CI/CD pipeline schedules, the users can set an automatic schedule for the future.

Automates Building and Testing of codes in pipelines

GitLab supports Auto DevOps features which helps save time and enforce standard practices. The Auto DevOps feature is highly beneficial as it helps in automatic building, testing, deploying and monitoring applications using the CI/CD pipeline. It is recommended to integrate a Kubernetes cluster to make proper use of Auto DevOps benefits.

Helps create maturity feedback

GitLab’s Scoreboards help teams support the easy implementation of the CI/CD pipeline tool for DevOps. The feature further helps in shipping the correct software, fixing bugs and more prior to the commencement of the process. It guides which areas require extending DevOps capabilities. As a result, using GitLab’s scoreboard helps developers make proper use of the application’s features.

Source Code Security

The application supports various security measures, including granular restriction and user permissions for Kerberos. It is a fully distributed version control system that supports access control and user permission features. One can also control and manage the code storage location using GitLab. For example, the administrator can control and manage the server and the location where the code resides if deploying GitLab on-premises. Also, you have access to store external code in GitLab repositories.

Follow next part to learn how to install GitLab self hosted server on CentOS 8.

How to Install Gitlab Self Hosted Server on CentOS 8

Add the GitLab CE Repository

By default, the GitLab package is not included in the CentOS default repo. So you will need to add the GitLab repo to your system.

First, install the curl utility using the following command:

				
					dnf install curl -y
				
			

Next, add the GitLab repo with the following command:

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

Once the repo is created, you can verify it using the following command:

				
					dnf repolist
				
			

You should see the GitLab CE repo in the following output:

				
					repo id                                                                repo name
AppStream                                                              CentOS-8 - AppStream
BaseOS                                                                 CentOS-8 - Base
extras                                                                 CentOS-8 - Extras
gitlab_gitlab-ce                                                       gitlab_gitlab-ce
gitlab_gitlab-ce-source                                                gitlab_gitlab-ce-source
				
			

Install GitLab on CentOS 8

Now, you can run the following command to install the GitLab CE to your server.

				
					dnf install gitlab-ce -y
				
			

Once the installation is complete, you will get the following output:

				
					
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-6


  Verifying        : gitlab-ce-14.6.3-ce.0.el8.x86_64                                                                                     1/1 

Installed:
  gitlab-ce-14.6.3-ce.0.el8.x86_64                                                                                                            

Complete!

				
			

Configure GitLab

Next, you will need to edit the GitLab configuration file and set your domain or IP address in external_url. You can do it with the following command:

				
					nano /etc/gitlab/gitlab.rb
				
			

Change the following line:

				
					external_url 'http://gitlab.mydomain.com'
				
			

Save and close the file when you are finished, then reconfigure the GitLab to apply the changes:

				
					gitlab-ctl reconfigure
				
			

Once the GitLab is configured, you should see the following output, including the path of the root password:

				
					Warnings:
Environment variable LANG specifies a non-UTF-8 locale. GitLab requires UTF-8 encoding to function properly. Please check your locale settings.
Rehashing of trusted certificates present in `/etc/gitlab/trusted-certs` failed. If on a FIPS-enabled machine, ensure `c_rehash` binary is available in $PATH.


Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.

NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

				
			

You can display your root password using the following command:

				
					cat /etc/gitlab/initial_root_password
				
			

You should see the following output:

				
					# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: qwiyzITagDpt6e65O95MeIXFxt2j/atmRm6z6mkQpuA=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.


				
			

Note: Please remember this password or save it in a safe location. You will need it to access the GitLab web interface.

Configure Firewall

If you are using the firewall in your system. Then, you will need to allow http and ssh services through the firewall. You can allow them by running the following commands:

				
					firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
				
			

Once the firewall is configured, reload it to apply the changes:

				
					firewall-cmd --reload
				
			

Access GitLab Web Interface

Now, open your web browser and access the GitLab web interface using the URL http://gitlab.mydomain.com. You should see the GitLab login page:

Provide your root username, password and click on the Sign in button. You should see the GitLab dashboard on the following page:

Click on the New project button to create your first project. You should see the following page:

Click on the Create blank project button. You should see the following page:

Provide your project name, description and click on the Create project button. You should see your project on the following page:

Manage GitLab Service

Last steps of How to Install Gitlab Self Hosted Server on CentOS 8 to use the gitlab-ctl command to manage the GitLab service. For example, to check the status of the GitLab, run the following command:

				
					gitlab-ctl status
				
			

You will get the following output:

				
					run: gitaly: (pid 21669) 67s; run: log: (pid 19999) 317s
run: gitlab-exporter: (pid 21602) 72s; run: log: (pid 20478) 201s
run: gitlab-workhorse: (pid 21580) 73s; run: log: (pid 20373) 220s
run: grafana: (pid 21856) 56s; run: log: (pid 21360) 100s
run: logrotate: (pid 19897) 330s; run: log: (pid 19909) 329s
run: nginx: (pid 20400) 216s; run: log: (pid 20409) 214s
run: node-exporter: (pid 21588) 73s; run: log: (pid 20457) 207s
run: postgres-exporter: (pid 21850) 57s; run: log: (pid 20926) 153s
run: postgresql: (pid 20055) 311s; run: log: (pid 20146) 308s
run: prometheus: (pid 21617) 71s; run: log: (pid 20520) 190s
run: puma: (pid 20319) 235s; run: log: (pid 20328) 232s
run: redis: (pid 19937) 324s; run: log: (pid 19951) 321s
run: redis-exporter: (pid 21611) 71s; run: log: (pid 20501) 194s
run: sidekiq: (pid 20337) 229s; run: log: (pid 20349) 225s

				
			

To stop the GitLab, run the following command:

				
					gitlab-ctl stop
				
			

To start the GitLab, run the following command:

				
					gitlab-ctl start
				
			

How to Install Gitlab Self Hosted Server on CentOS 8 Conclusion

Congratulations! you have successfully installed GitLab CE on CentOS 8. You can now import your project from Git and start managing them from the GitLab web interface. Visit the GitLab official documentation for more information.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

4 2 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x