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

Analysis and description of network configuration files under Ubuntu system

I encountered a strange network problem today. I ...

JS realizes simple picture carousel effect

This article shares the specific code of JS to ac...

Example of implementing todo application with Vue

background First of all, I would like to state th...

Typical cases of MySQL index failure

Table of contents Typical Cases Appendix: Common ...

Getting Started Guide to Converting Vue to React

Table of contents design Component Communication ...

MySQL 5.7.21 installation and configuration tutorial

The simple installation configuration of mysql5.7...

Graphical explanation of the function call of proto file in Vue

1. Compile proto Create a new proto folder under ...

Detailed explanation of how to implement secondary cache with MySQL and Redis

Redis Introduction Redis is completely open sourc...

Discussion on Web Imitation and Plagiarism

A few months after entering the industry in 2005, ...

MySQL configuration master-slave server (one master and multiple slaves)

Table of contents Ideas Host Configuration Modify...

What you need to know about creating MySQL indexes

Table of contents Preface: 1. Create index method...

How to set a fixed IP address for a VMware virtual machine (graphic tutorial)

1. Select Edit → Virtual Network Editor in the me...

Several ways to switch between Vue Tab and cache pages

Table of contents 1. How to switch 2. Dynamically...

Solve nginx "504 Gateway Time-out" error

Students who make websites often find that some n...