Host your own Git Repositories with GitLab

In this post, I am going to demonstrate the installation of GitLab. With GitLab, we can host our own repositories at a central place with the ease of the Git features.

GitLab is the first single application for all stages of the DevOps lifecycle. Only GitLab enables Concurrent DevOps, unlocking organizations from the constraints of the toolchain. GitLab provides unmatched visibility, higher levels of efficiency, and comprehensive governance. This makes the software lifecycle 3 times faster, radically improving the speed of business.

 

To start our own GitLab instance, we will create a machine on CloudSigma. CloudSigma offers resource scaling which will make it very simple to increase the resources in case the organisation demands an increase.

I am creating a machine with the following configuration:

  • 20 GHz CPU
  • 16 GB RAM
  • 100 GB SSD

I have installed Ubuntu 18.04 LTS on my SSD. I have attached a static IP on the machine so that even if I stop and start the machine, the IP will remain the same. Having a static IP is really important if we plan to connect the IP to a domain name since we would need to give it in the DNS configuration.

We connect to the machine using SSH and perform the following operations on it. We can use tools like Putty, MobaXterm to establish an SSH connection.

Now that I am connected to the machine, I will start the installation procedure.

First, I am going to update the apt-get repositories. It downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies.

Now that the package list has been updated, I will install curl, openSSH-server and ca-certificates.

  • curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.
  • OpenSSH is a suite of security-related network-level utilities based on the Secure Shell (SSH) protocol, which help to secure network communications via the encryption of network traffic over multiple authentication methods and by providing secure tunneling capabilities.
  • ca-certificates are PEM files of CA certificates to allow SSL-based applications to check for the authenticity of SSL connections.

 

Next, for a mailing solution, we will install Postfix. It is the tool that will help sending notification emails, adding member mails, etc.

Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers electronic mail. It is released under the IBM Public License 1.0 which is a free software license.

 

During the installation, on the configuration screen, select ‘Internet Site’ as the mail server configuration type. With these settings, Mail is sent and received directly using SMTP.

Short for Simple Mail Transfer Protocol, SMTP is a protocol for sending e-mail messages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail client using either POP or IMAP.

 

On the next screen, it will ask you for the server’s external DNS name. In this case, I am entering my hostname – FQDN.

 

Now, I am going to add the GitLab package repository.

After adding the package repository, I will install the GitLab package. I will change the EXTERNAL_URL to the URL from where I want to access the GitLab instance. In this case, it will be my static IP address. Installation will take care of the configuration and start GitLab at that URL.

Change http://gitlab.example.com to the Domain URL or the IP address.

 

After the installation is complete, go to the URL and it will ask to set a password.

After you have set the password, confirmation would be shared that the password has been changed.

 

Login with username as ‘root’ and password as the one you have set.

Home screen with features of Creating a project, Creating a Group, Adding people and Configuring the GitLab would be displayed.

Create a Project

I can choose a Project name and add some description to it. I can choose a Visibility level from Public, Internal or Private. Other methods of creating a Project can be from a template and Importing Project from other services like GitHub.com, BitBucket, Google Code, etc.

After the Project has been created, commands would be shown to configure CLI.

Create a Group

I can simply give a group path, name, description, avatar and visibility level. After the group has been created, I can add members to the group with varying roles for them to contribute.

Admin Area

Admin area contains all the configuration settings, monitoring tools, notification tools, management of abuse reports, appearance, etc. These settings help in personalizing the GitLab instance and giving it a business identity.

 

Et Voilà! Your personal GitLab instance is up and running.

Share this Post

About Akshay Nagpal

Big Data Analytics and ML enthusiast.

Leave a Reply