centos下gitlab的简单安装配置
一、安装前配置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