This document applies only to Centos7 installed Gitlab, other Linux system installation methods Click here . Install 1. Install and configure required dependencies
The first step. System firewall open HTTP access and SSH access
sudo yum install-y curl Policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start ssh D
sudo firewall-cmd--permanent--add-service=http
sudo systemctl reload Firewalld
Step two. Install the Postfix mail server, if you want to use a different solution to send e-mail, skip this step, configure the additional SMTP server, and then install Gitlab
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
It is possible to make the following error when starting Postfix
Workaround:
Modifying the/ETC/POSTFIX/MAIN.CF configuration
Inet_protocols = IPv4
inet_interfaces = All
2. Start the installation of Gitlab
The first step. Add a Gitlab installation package
Curl Https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
Step two. Install the Gitlab package, change the http://gitlab.example.com to your actual access URL
sudo external_url= "http://gitlab.example.com" Yum install-y gitlab-ee
3. Visit http://gitlab.example.com to check if the installation was successful
On the first visit, you will be redirected to a password reset screen with the default login account: Root two. Gitlab start, stop, and restart
# Start Gitlab all components
sudo gitlab-ctl start
# stop Gitlab all components
sudo gitlab-ctl stop
# Restart Gitlab all components
sudo Gitlab-ctl Restart
# view gitlab status
sudo gitlab-ctl status
three. Gitlab Server Migration
Note: The versions of the two Gitlab services must be consistent, otherwise the version incompatibility issue will be prompted when importing the data, as shown below
The first step: Back up the code on the original server and execute the following command
Gitlab-rake gitlab:backup:create rails_env=production
PS: The file after backup is usually located under/var/opt/gitlab/backups, automatically generate file name file name such as 1481529483_gitlab_backup.tar
Second step: Copy the tar file generated by the first step to the corresponding backups directory on the new server can be copied using SCP command or other method, the SCP command is copied as follows
SCP User name @ server ip:/var/opt/gitlab/backups/1481529483_gitlab_backup.tar/var/opt/gitlab/backups
Step Three: Data recovery, execution commands
Gitlab-rake Gitlab:backup:restore rails_env=production backup=1481529483
The time point of the
Ps:backup must be the same as the file name after the original server was backed up, and if the tar package file is larger and takes longer, there is a confirmation during execution and a yes is entered. Fourth: Error resolution (can be ignored if normal access is available) Error Description: page can be accessed normally, click on a specific item is page prompt 500 error Workaround: 1. Overwrite the original Gitlab db_key_base to the new Gitlab, db_key_base position in/etc/gitlab/gitlab-secrets.json 2. Execute the following command version ee: sudo gitlab-rails Runner "Project.where (Mirror:false). Where.not (Import_ Url:nil). Each {|p| P.import_data.destroy if p.import_data} "  CE version performed: sudo gitlab-rails runner" Project . Where.not (Import_url:nil). Each {|p| P.import_data.destroy if p.import_data} " 3. Restart Gitlab, execute: Gitlab-ctl r Estart