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

How to change the root password of Mysql5.7.10 on MAC

First, start MySQL in skip-grant-tables mode: mys...

Sample code for implementing Alipay sandbox payment with Vue+SpringBoot

First, download a series of things from the Alipa...

Vue.js implements image switching function

This article shares the specific code of Vue.js t...

Detailed explanation of Linux text editor Vim

Vim is a powerful full-screen text editor and the...

Example code for making the pre tag automatically wrap

The pre element defines preformatted text. Text en...

A brief discussion on the optimization of MySQL paging for billions of data

Table of contents background analyze Data simulat...

Vue implements zoom in, zoom out and drag function

This article example shares the specific code of ...

Implementing circular scrolling list function based on Vue

Note: You need to give the parent container a hei...

How to solve the problem of forgetting the root password of Mysql on Mac

I haven't used mysql on my computer for a lon...

Why is IE6 used by the most people?

First and foremost, I am a web designer. To be mor...

Using Vue3 (Part 1) Creating a Vue CLI Project

Table of contents 1. Official Documentation 2. Cr...

Summary of the Differences between find() and filter() Methods in JavaScript

Table of contents Preface JavaScript find() Metho...