Get the App
SLTechnology News&Howtos  ›  Servers  › 

Gitlab installation, backup and restore

Shulou Source: shulou.com Published: 2022-06-02 23:59:03 10月01日 Update

1. Download the gitlab server installation package and pay attention to the version

Wget-- content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-11.6.9-ce.0.el7.x86_64.rpm/download.rpm

two。 Install the yum repository

Curl-s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

3. Install gitlab

Sudo yum install gitlab-ce-11.6.9-ce.0.el7.x86_64

4. Modify external_url address

Vim / etc/gitlab/gitlab.rb

EXTERNAL_URL= "https://test.test.com"

5. Start the gitlab server

Gitlab-ctl reconfigure

6. Backup gitlab Warehouse

Sudo gitlab-rake gitlab:backup:create

7. Set backup gitlab warehouse cycle

/ etc/gitlab/gitlab.rb## Limit backup lifetime to 7 days-604800 secondsgitlab_rails ['backup_keep_time'] = 604800

Perform reconfiguration after configuration modification: gitlab-ctl reconfigure

Of course, you can also set the crontab task schedule for backup. CRON=1 will not output the details of the backup process.

0 2 * / opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

8. Copy backup files and authorize git users

Sudo cp 1564077625_2019_07_26_11.6.9_gitlab_backup.tar / var/opt/gitlab/backups/sudo chown git.git / var/opt/gitlab/backups/1564077625_2019_07_26_11.6.9_gitlab_backup.tar

9. Stop two processes, stop all data connection services, and ensure data consistency

Sudo gitlab-ctl stop unicornsudo gitlab-ctl stop sidekiq# Verifysudo gitlab-ctl status

10. To restore gitlab data backup files, note that the version after backup= depends on the version. Some do not need to specify the full name of the file, such as 1564077625_2019_07_26_11.6.9-ce, or 1564077625 "2019" 07 "26" 11.6.9.

Sudo gitlab-rake gitlab:backup:restore BACKUP=1564077625_2019_07_26_11.6.9

11. Restart and confirm status information

Sudo gitlab-ctl restartsudo gitlab-rake gitlab:check SANITIZE=true

twelve。 How to modify the gitlab port?

Vim / etc/gitlab/gitlab.rb

External_url 'http://test.test.com:8088'nginx['listen_port'] = 8088

After the port is modified, the restart of gitlab service takes effect.

Gitlab-ctl reconfiguregitlab-ctl restart

How does 13.gitlab modify the time zone?

Vim / etc/gitlab/gitlab.rb

Example: gitlab_rails ['time_zone'] =' Europe/Brussels' China time zone gitlab_rails ['time_zone'] =' Asia/Shanghai'

After changing the time zone, restarting the gitlab service takes effect.

Gitlab-ctl reconfiguregitlab-ctl restart

14. How do I test whether the smtp service for sending gitlab mail is working?

Log in to the Gitlab server to execute

Gitlab-rails consoleNotify.test_email ('123456roomqq.compose,' Message Subject', 'Message Body'). Deliver_now

Tags: Service backup warehouse data file time zone information server version port configuration consistency two task example full name cycle address copy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB Docker Huawei Shulou Tech Info