Centos 7 gitlab deployment and localization

The user selected throughout the installation is root

Reference article: https://www.cnblogs.com/straycats/p/7637373.html

This article is basically a reprint of Mr. Zong's previous article. If you are interested, you can read Mr. Zong 's original article.


1. Environmental preparation

 

Operating system: centos7 ( system pure environment, other services, such as nginx, ssh and other common services are not installed, it is recommended to use the system pure environment to install gitlab )

Other hardware such as CPU, memory can be modified according to the actual number of users

1.1 Replacing Ali yum (personal habits)

     step:

     1) Download wget         

yum install -y wget

      2) Backup the default yum

mv /etc/yum.repos.d /etc/yum.repos.d.backup

      3) Set up a new yum directory

mkdir /etc/yum.repos.d

      4) Download the Aliyum configuration to this directory

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

       5) Rebuild the cache

yum clean all
yum makecache

       6) Upgrade all packages (change software settings and system settings, the system version kernel is upgraded, so it takes a few minutes to wait patiently)

yum update -y

 

1.2 Install vim (personal habits)

yum install -y vim

 


2. Get the gitlab Chinese package (to deploy the non-Chinese version, you can skip this piece of content)

Description: The gitlab Chinese Community Edition project, v7-v8.8 is the " GitLab Chinese Community Edition Project " (https://gitlab.com/larryli/gitlab) initiated by Larry Li . After v8.9, @xhang started Continue the sinicization project (https://gitlab.com/xhang/gitlab).

 2.1 Install git

yum install -y git

 

 2.2 Clone to get the Chinese version library

 Download the latest Chinese package

git clone https://gitlab.com/xhang/gitlab.git

 

 If you want to download the old version of the Chinese package, you need to add the branch of the old version, for example, today is 10.7.0, I still want to download 10.6.4, you can run the following statement

git clone https://gitlab.com/xhang/gitlab.git -b v10.6.4-zh

 

 2.3 Check the version of the Chinese patch

cat gitlab/VERSION

 Note: The version I installed is 10.6.4, and the latest Chinese version is 10.6.4

 


3. Deploy the community version of gitlab

 3.1 Install gitlab dependencies

yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python

 

 3.2 Start postfix and set it to start at boot 

systemctl start postfix
systemctl enable postfix

 

 3.3 Setting up the firewall 

firewall-cmd --add-service=http --permanent
firewall-cmd --reload

 Note: I completely turned off the firewall when I installed it.

 3.4 Get the rpm package of gitlab

  Path 1: Through Tsinghua Open Source Mirror Site

   Check the Tsinghua open source mirror site, there is the rpm package of 10.6.4 that I need.

 

 

   Get the rpm package 

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

  Note: It is not recommended to use the wget method, the speed is slow, and there may be a lag. Can be downloaded from the web and then uploaded to the system

  Path 2: Get the RPM package from the official and upload it to the /root directory

  Official download: https://packages.gitlab.com/gitlab/gitlab-ce/

  Because gitlab of version 10.6.4 needs to be installed on centos7, after finding gitlab-ce-10.6.4-ce.0.el7.x86_64.rpm and downloading it locally, upload the rpm package to the gitlab virtual machine through the Bitvise SSH Client tool in the /root directory.

  Note: From the perspective of download speed and convenience, it is better to go to Tsinghua's mirror site, but the version may not have the latest version, so add "Route 2" to obtain the latest installation package.

  Note: The official website download I have not used this method 

   3.5 Install rpm package

rpm -i gitlab-ce-10.6.4-ce.0.el7.x86_64.rpm

 

  According to the prompt, continue to execute the instructions to configure gitlab. 

gitlab-ctl reconfigure

 

 3.6 Modify the configuration file gitlab.rb

vim /etc/gitlab/gitlab.rb

Change the address of the external_url variable to the ip address of the centos where gitlab is located. (IP on the way is the actual system IP address).

 

Because the configuration file is modified, the configuration content needs to be reloaded.

gitlab-ctl reconfigure
gitlab-ctl restart

 

3.7 View gitlab version 

head -1 /opt/gitlab/version-manifest.txt

 


Fourth, cover the Chinese package

 4.1 Stop the gitlab service

gitlab-ctl stop

 

 4.2 Switch to the directory where the gitlab Chinese package is located (that is, the Chinese version of gitlab obtained in step 2) 

cd /root/gitlab

 

 4.3 Compare the finished tag and the original tag, export the diff file for patch to /root 

git diff v10.6.4 v10.6.4-zh > ../10.6.4-zh.diff

 

 4.4 Go back to the /root directory

cd

 

 4.5 Update 10.6.4-zh.diff to gitlab as a patch 

yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.6.4-zh.diff

 

 4.6 Start gitlab

gitlab-ctl start

 

 4.7 Reconfigure gitlab 

gitlab-ctl reconfigure

 


Five, set the administrator password

   Username for administrator account login: root

   (Although the user name of the administrator after logging in is Administrator, the actual login user name is root)

   

   Method 1: Web page method

   The browser accesses the ip where gitlab is located, and after entering the password, click "Change your password" (if it is Chinese, click "Change your password").

 

 

 

  Method 2: Instruction method

gitlab-rails console production

  It will appear after a while

 

 

irb(main):001:0> user = User.where(id: 1).first // id 1 is the super administrator 
irb(main):002:0>user.password = 'yourpassword' // password Must be at least 8 characters
irb(main):003:0>user.save! // return true if no problem
exit // exit

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324909163&siteId=291194637