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

Solution to the problem that VC6.0 cannot be used when installed on WIN10

VC6.0 is indeed too old VC6.0 is a development to...

Markup language - for

Click here to return to the 123WORDPRESS.COM HTML ...

Essential conditional query statements for MySQL database

Table of contents 1. Basic grammar 2. Filter by c...

Solutions to the Problem of Creating XHTML and CSS Web Pages

The solutions to the problems encountered during x...

SELinux Getting Started

Back in the Kernel 2.6 era, a new security system...

Native JS realizes the special effect of spreading love by mouse sliding

This article shares with you a js special effect ...

Vue uses mixins to optimize components

Table of contents Mixins implementation Hook func...

Example of deploying Laravel application with Docker

The PHP base image used in this article is: php:7...

Analyze how to automatically generate Vue component documentation

Table of contents 1. Current situation 2. Communi...

Understanding and using callback functions in JavaScript

Table of contents Overview What are callbacks or ...

Uncommon but useful tags in Xhtml

Xhtml has many tags that are not commonly used but...

How MySQL Select Statement is Executed

How is the MySQL Select statement executed? I rec...