1. 程式人生 > >centos下gitlab的簡單安裝配置

centos下gitlab的簡單安裝配置

src com cto pat bsp 地方 png style block

一、安裝前配置yum源

#wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
#sh script.rpm.sh

二、安裝指定版本的gitlab-ce

#rpm –qa gitlab-ce
#yum list gitlab-ce –showduplicates

技術分享圖片

#yum –y install gitlab-ce-10.6.4-ce.0.el7

技術分享圖片

三、初次安裝配置啟動

#vi /etc/gitlab/gitlab.rb
external_url http://10.148.68.13
#gitlab-ctl reconfigure #此命令是將etc下的gitlab.rb文件裏的配置同步到gitlab的真實配置文件,一般是gitlab.rb做了修改後使用,需要謹慎 其中,執行這步可能會遇見某個地方一直卡住不動,如下圖

技術分享圖片

解決方法:1.Ctrl+c        2. systemctl restart gitlab-runsvdir        3. gitlab-ctl reconfigure
#gitlab-ctl restart

四、配置ldap認證

#vi /etc/gitlab/gitlab.rb
gitlab_rails[ldap_enabled
] = true gitlab_rails[ldap_servers] = YAML.load <<-EOS main: # ‘main‘ is the GitLab ‘provider ID‘ of this LDAP server label: LDAP host: 10.148.3.140 port: 389 uid: uid bind_dn: cn=spms,dc=migu,dc=com password: admin@123 encryption: plain # "start_tls" or "simple_tls" or "plain"
active_directory: false allow_username_or_email_login: true block_auto_created_users: false base: dc=migu,dc=com user_filter: ‘‘ EOS #gitlab-ctl reconfigure #gitlab-ctl restart

五、備份與恢復

#vi /etc/gitlab/gitlab.rb
gitlab_rails[manage_backup_path] = true        #開啟備份的設置
gitlab_rails[backup_path] = "/var/opt/gitlab/backups"        #備份文件存放目錄
gitlab_rails[backup_keep_time] = 604800        #備份文件保留時間,秒級
備份:
#/opt/gitlab/bin/gitlab-rake gitlab:backup:create

技術分享圖片

恢復:
#gitlab-ctl stop unicorn
#gitlab-ctl stop sidekiq
#/opt/gitlab/bin/gitlab-rake gitlab:backup:restore BACKUP=1528768418
#gitlab-ctl start

centos下gitlab的簡單安裝配置