In this tutorial I will explain how to set up a local Gitlab server for Continuos Integration / CD (Continous Deployment). As anyone who doesn't know it yet, GitLab is a complete DevOps platform delivered as a single application. From project planning and source code management via CI / CD to monitoring and security. This allows teams to collaborate and work in a single conversation instead of managing multiple threads across multiple tools. By providing a single database, user interface and authorization model throughout DevOp's lifecycle, teams can collaborate significantly, reduce cycle time and focus exclusively on quickly building each application.
As each business method becomes larger and more comprehensive, all products must have more outstanding features than their competitors. To achieve this, several modules must be introduced and developed when they are ready, they must be quickly marketed and tested and verified. In this way, it would really help to reach the milestone if Gitlab was the only application source that could facilitate the transition to DevOps practice.
first How Continuous Integration and Continuous Implementation Works
There is a logical sequence of possible actions to implement throughout the software development lifecycle and using GitLab as the platform for your code. The goal is to support the law coherently and effectively from the first phase of implementing a new product to the final phase of implementing it in production. The image below shows a summary of the workflow:
Because the scope of DevOps is quite large, this tutorial focuses on setting up the Gitlab server under local conditions. We will use Gitlab Community Edition to create in our local environment.
2nd Installation phase
For the installation phase, we first start by configuring the server with conditions, provided that each server is under minimal server configuration. Here are the steps:
[[email protected] ~] # cat /etc/resolv.conf
[[email protected] ~] # yum updateinstall -y curl policycoreutils-python openssh-server
To do the above is optional, just to ensure our installation and Review work smoothly. When the installation is complete, you have the screenshot as below
Then start the postfix service as needed. Below is the command.
[[email protected] ~] # systemctl start postfix
[[email protected] ~] # systemctl status postfix
[[email protected] ~] # systemctl enable postfix
When you are done, you have the screenshot as below 
Then we have to install wget to take the automation script provided by GitLab itself for installation. You can also use another way to do the installation like using Curl etc. For this exercise, I will use wget to download the script instead. Once the wget package is installed, we download the script from here and add it to our local server. Below is the step:
[[email protected] ~] # yum install -y wget
[[email protected] ~] # wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh  ~] # chmod + x script.rpm.sh
[[email protected] ~] # ./script.rpm.sh
The process will be as follows:
Then we will prepare the GitLab service and its dependencies configured. The steps are as follows:
[[email protected] ~] # EXTERNAL_URL = "http://10.124.12.133:80"
[[email protected] ~] # echo $ EXTERNAL_URL
[[email protected] ~] # yum install -y gitlab-ce
When all is done you will see the progress shown below
Good! Now everything is at hand, let's continue the process of installing the service and its dependencies. Since GitLab was a solid application for DevOps to be designed together, there will be several packages and configuration will be configured. Therefore, it is normal that it takes longer than any regular service installation. Before the installation starts, let's confirm that the main URL has been configured as expected. Here are the steps: –
[[email protected] ~] # cat /etc/gitlab/gitlab.rb
external_url = & # 39; http: //10.124.12.133' [[email protected] ~] # gitlab-ctl reconfigure
If progress goes smoothly, you get according to screenshot below
Now that everything is done on the installation part, let's do the final hand that allows the port for Gitlab to serve. Here are the steps: –
[[email protected] ~] # firewall-cmd --permanent --add-service ssh
[[email protected] ~] # firewall-cmd --permanent --add-service http
[[email protected] ~] # firewall-cmd - load
[[email protected] ~] # iptables -L -n
Below is the screenshot
Now we have done quite a bit for GitLab installation , now we can start logging into our own GitLab server and configuring the project as needed. As a final result, you can view your GitLab service through the browser via the URL we have previously configured, in our case http://10.124.12.133. It automatically redirects you to the home page and then sets your initial administrator password as needed. In this case, the default administrator is root . Below is the example: –
3. Test phase
Since everything is done, let's act as a user under a team that defines a project that uses GitLab as a project development layer. First, let's create a new project, click on Create a project and define the details as needed. Examples are as follows: –
When you do, you will be redirected to the main page of the project as below   As a project, there will be several users who have contributed to this repository. To recreate the scenario, let's create a user who will later contribute to this project. Return to the home page and click Add People . You will be redirected to the membership page as below. Create a user and fill in as needed.
Return to the main project page, when done, go to settings and click on members . Below is the example: –
It will take you to the Project Member page, include the new user you created and define the roles to be given to the user as an example below. For each definition of roles and privileges, you can click Read more for more information
When you are done, you will see the list of granted team members as shown below. : –
Now, let's test the project workflow contribution by accessing from another server and log in as the new user we created and create a new file to be taken part of the project. First, let's take the URL of the project to be cloned from another server or workstation. You can take the project URL link from the example below: –
When everything is ready, let's log into a test workstation and clone the project to access different users . Here are the steps: –
[[email protected] ~] # yum install -y git
[[email protected] ~] # git-clone http://10.124.12.133/root/my-first-project.git
You must give user access To clone the project, use the new user just created as the example below: –
When done, a new folder with the project name will be created under your workstation. Now go into the folder and create an empty file. This is just to test that the project can contribute with all team members from any workstation and the project repository will always be updated synchronously. Here are the steps: –
[[email protected] ~] # cd ls
[[email protected] ~] # cd my-first-project /
[[email protected] my-first-project] # ls
[[email protected] my-first-project] # touch myfile.txt
When all is done, let's make our changes to sync with the project's main layer. Here are the steps: –
[[email protected] my-first-project] # git add myfile.txt
[[email protected] my-first-project] # git commit -m "added new file"
[[email protected] my-first-project] # git push -u origin master
As the above command continued, the process will be shown as an example below: –
Fantastic! When all is done, let's go back to the browser and refresh the page. You will notice that the new file made by the user shahril appears on the main project page