1. Install and configure the necessary dependencies
sudo yum install curl policycoreutils openssh-server openssh-clients -y
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
2. Add the GitLab package server and install the package
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce -y
3. Configure and start GitLab
sudo gitlab-ctl reconfigure
4. Change hostname and port number
vim /etc/gitlab/gitlab.rb
===
external_url "http://localhost:9999" #change port to 9999
gitlab_rails['gitlab_shell_ssh_port'] = 9998 #change ssh port to xxxxx,if your ssh port changed
# set mail server(gmail)
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "my.email@gmail.com"
gitlab_rails['smtp_password'] = "my-gmail-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Backup:
> /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
> ls
1510848068_2017_11_17_9.4.4_gitlab_backup.tar
Auto Backup:
>vi /etc/crontab
=======
// Backup in 1st & 15th day month
0 0 1,15 * * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
=======
Recovery:
Must same version gitlab
After set gitlab.rb
Stop gitlab servies
> gitlab-ctl stop unicorn
> gitlab-ctl stop sidekiq
> gitlab-ctl status
Paste the backup file to /var/opt/gitlab/backups/
> 1530366625_2018_06_30_10.1.4_gitlab_backup.tar
recovery (use timestamp of backup file)
> gitlab-rake gitlab:backup:restore BACKUP=1530366625_2018_06_30_10.1.4
> gitlab-ctl restart
Check gitlab:
> gitlab-rake gitlab:check SANITIZE=true
Update Gitlab:
1. Make a backup (Optional)
If you would like to make a backup before updating, the below command will backup data in /var/opt/gitlab/backups by default.
> sudo gitlab-rake gitlab:backup:create STRATEGY=copy
2. Update GitLab
Update to the latest version of GitLab.
> sudo yum install -y gitlab-ce
https://about.gitlab.com/installation/#centos-7