GitLab repositories featured image

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. In addition, GitLab provides unmatched visibility, higher levels of efficiency, and comprehensive governance. As a result, the software lifecycle is 3 times faster, radically improving the speed of business.

 

Starting GitLab

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.

First, 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. After that, 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.

Further, 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 GitLab repositories. It downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies.

Next, after updating the package list, 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 able 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.

 

Postfix Installation

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.

 

After that, 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.

 

GitLab repositories inside image 1

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

GitLab repositories inside image 2

 

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

After adding the package GitLab 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.

Next, 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.

GitLab repositories inside image 3

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

GitLab repositories inside image 4

 

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

Following this step, home screen with features of Creating a project, Creating a Group, Adding people and Configuring the GitLab would be displayed.

GitLab repositories inside image 5

Create a Project

I can choose a Project name and add some description to it. For example, I can choose a Visibility level from Public, Internal or Private. However, there are other methods of creating a Project. Some of those include creating a Project from a template and Importing Project from other services like GitHub.com, BitBucket, Google Code, etc.

GL inside image 5

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

Create a Group

GL nside image 6

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

Admin Area

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

GL inside image 7

 

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