How to install and deploy gitlab server on centos7

How to install and deploy gitlab server on centos7

I am using centos 7 64bit system here. I have tried centos 64bit system and it works

1. Install dependent software

yum -y install policycoreutils openssh-server openssh-clients postfix

2. Set postfix to start automatically at boot time and start it. Postfix supports gitlab sending function

systemctl enable postfix && systemctl start postfix

3. Download the gitlab installation package and install it

Download address for centos 6 system: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
Download address for centos 7 system: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

I use centos7, so I found a gitlab8.0.0 version in https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7. It is recommended to download a newer version. I chose an older version here just for experimental records.

Download the rpm package and install it:

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm

4. Modify the gitlab configuration file to specify the server ip and custom port

vim /etc/gitlab/gitlab.rb

Exit and save

ps: Please note that the port set here cannot be occupied. The default port is 8080. If 8080 is already in use, please customize other ports and open the corresponding ports in the firewall settings.

5. Reset and start GitLab

Execute the following command

gitlab-ctl reconfigure

gitlab-ctl restart

ok: run: gitlab-git-http-server: (pid 3922) 1s
ok: run: logrotate: (pid 3929) 0s
ok: run: nginx: (pid 3936) 1s
ok: run: postgresql: (pid 3941) 0s
ok: run: redis: (pid 3950) 0s
ok: run: sidekiq: (pid 3955) 0s
ok: run: unicorn: (pid 3961) 1s

The prompt "ok: run:" indicates successful startup.

6. Visit GitLab Pages

If there is no domain name, directly enter the server IP and the specified port to access, initial account: root password: 5iveL!fe

Change password when logging in for the first time

7. When setting up the gitlab email function, you need to pay attention to one thing

The default postfix used by the mail sending system, smtp is enabled by default, if both are enabled, neither will work.
I have set up SMTP to be turned off and postfix to be turned on

Turn off smtp method: vim /etc/gitlab/gitlab.rb

Find #gitlab_rails['smtp_enable'] = true and change it to gitlab_rails['smtp_enable'] = false

After modification, execute gitlab-ctl reconfigure

The other is to turn off postfix and enable smtp. For related tutorials, please refer to the official website https://doc.gitlab.cc/omnibus/settings/smtp.html
Test whether email notification is possible:

Log in and add a user. I use QQ mailbox to add a user.

Log in to your QQ mailbox and you will receive email notifications (if you do not receive them, please check your spam mailbox or check if the email has been blocked and deleted. If so, please add the user to the whitelist and delete the user and then add the user again to receive the notification. Otherwise, please check the email log and make relevant settings)

Fault handling records

(1) Login 502 error

This is usually a permission issue. Solution: chmod -R 755 /var/log/gitlab

If it still doesn't work, please check your memory. You need at least 4GB of available memory (RAM + Swap) to install and use GitLab! Since the operating system and other running applications also use memory, you must make sure that the current server has at least 4GB of available memory before installing GitLab. Less than 4GB of memory will cause various strange problems, and 500 errors will often occur during use.

(2) An account permission error occurs when executing the gitlab-ctl reconfigure command

n itdb: could not obtain information about current user: Permission denied

Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'

According to the error message, the user's permission problem is probably locked. Installing gitlab-ce will automatically add four users:

gitlab-www:x:497:498::/var/opt/gitlab/nginx:/bin/false

git:x:496:497::/var/opt/gitlab:/bin/sh

gitlab-redis:x:495:496::/var/opt/gitlab/redis:/bin/nologin

gitlab-psql:x:494:495::/var/opt/gitlab/postgresql:/bin/sh

I couldn't find a solution on Google or Baidu. Since the error message indicated a permission problem, there would be no problem if I checked the account permissions. Later, I found that the permission of the file /etc/passwd was 600. After giving it 644 permissions, the error was successfully solved.

This is the end of this article about how to install and deploy the gitlab server on centos7. For more information about installing the gitlab server on centos7, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  25 Tools to Improve Website Usability and Conversion Rates

>>:  Solve the mysql problem: Unable to continue code execution because MSVCR120.dll is not found

Recommend

Introduction to HTML_PowerNode Java Academy

What is HTML? HTML is a language used to describe...

js to implement add and delete table operations

This article example shares the specific code of ...

Vue encapsulates the public function method of exporting Excel data

vue+element UI encapsulates a public function to ...

How to build YUM in Centos7 environment

1. Enter the configuration file of the yum source...

CSS Back to Top Code Example

Most websites nowadays have long pages, some are ...

How to configure the same domain name for the front and back ends of nginx

This article mainly introduces the method of conf...

Docker+selenium method to realize automatic health reporting

This article takes the health reporting system of...

Detailed explanation of Vue router routing guard

Table of contents 1. Global beforeEach 1. Global ...

Implementation of Vue 3.x project based on Vite2.x

Creating a Vue 3.x Project npm init @vitejs/app m...

Detailed explanation of how to create an updateable view in MySQL

This article uses an example to describe how to c...

The role of nextTick in Vue and several simple usage scenarios

Purpose Understand the role of nextTick and sever...