Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install and deploy GitLab under Linux

Shulou Source: shulou.com Published: 2022-06-01 13:08:18 10月03日 Update

This article mainly shows you "how to install and deploy GitLab under Linux", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to install and deploy GitLab under Linux".

A brief introduction to GitLab

Now, GitHub has become the preferred code hosting platform. Because it has a lot of great features and easy to operate, almost all developers like it. Gitlab is a great Git hosting service, almost as powerful as GitHub. Gitlab is generally used as an internal private system. If the company uses git to distribute the code, it is very slow to pull from github each time, and it is much more convenient to use gitlab.

II. Installation

The following is the installation instructions for the official documentation. For more information, please visit the gitlab official website.

1, installation dependency

Sudo yum install curl openssh-server openssh-clients postfix cronie

Sudo service postfix start

Sudo chkconfig postfix on

Sudo lokkit-s http-s ssh

2. Add the GitLab repository and install it on the server (because the package is relatively large, if the network speed is slow, you can consider downloading it on my FTP, please choose your corresponding version)

Curl-sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

Sudo yum install gitlab-ce

3, configure and start, the following command will automatically configure and initialize gitlab

Sudo gitlab-ctl reconfigure

4, start and log in

The following is the default username password, which will prompt you to change your password for the first time:

Username: root

Password:5iveL!fe

And then you can have a good time!

III. Problems in installation

I heard that there are still many problems in gitlab installation, but I don't seem to encounter many problems in the process of installation!

1. 502 error occurred when accessing GitLab in browser

First of all, there is the problem of port occupation. Port 80 will be used to start gitlab, so it is recommended that you turn off all unneeded services or modify the default port before starting gitlab:

Sudo vim / etc/gitlab/gitlab.rb

Modify external_url and directly add the port number. For example, I use port 8800 here:

External_url 'http://localhost:8800'

Then execute:

Sudo gitlab-ctl reconfigure

2pr 8080 port conflict

In addition to port 80, there is also a port for unicorn, which defaults to 8080 if port 8080 is occupied by other programs. Then unicorn will fail to start with a 502 error, "GitLab is not responding".

Solution: modify / etc/gitlab/gitlab.rb

Unicorn ['listen'] =' 127.0.0.1'

Unicorn ['port'] = 8801

Then run:

Sudo gitlab-ctl reconfigure

4. Gitlab common commands

Gitlab-ctl start

Gitlab-ctl stop

Gitlab-ctl status

Gitlab-ctl restart

The default log files for Gitlab are stored in the / var/log/gitlab directory:

Gitlab-ctl tail # View all logs

Gitlab-ctl tail nginx/gitlab_access.log # View nginx access Log

These are all the contents of the article "how to install and deploy GitLab under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Port problem content log article service code command password error learning help hosting configuration powerful pleasant up and down warehouse method function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker Shulou Information Huawei Apple