1. 安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
2.设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
3.下载gitlab安装包,然后安装
centos7下gitlab下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7中找了个gitlab8.0.0版本
下载rpm包并安装:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
4.修改gitlab配置文件指定服务器ip和自定义端口:
vim /etc/gitlab/gitlab.rb
#修改地址和端口
external_url 'http://192.168.2.183'
#增加邮箱发送地址
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'report@133.cn'
#增加LDAP认证
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' ###! **remember to close this block with 'EOS' below**
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: '192.168.0.5'
port: 389
uid: 'uid'
method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: 'cn=Manager,dc=huoli,dc=com'
password: 'Ldhuoli061'
active_directory: false
allow_username_or_email_login: false
block_auto_created_users: false
base: 'ou=person,dc=huoli,dc=com'
user_filter: ''
attributes:
username: ['uid', 'userid', 'sAMAccountName']
email: ['mail', 'email', 'userPrincipalName']
name: 'cn'
first_name: 'givenName'
last_name: 'sn'
EOS
#增加邮件设置
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qiye.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "report@133.cn"
gitlab_rails['smtp_password'] = "Rpr135246"
gitlab_rails['smtp_domain'] = "133.cn"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false
5.重置并启动GitLab
执行:
gitlab-ctl reconfigure
gitlab-ctl restart
ok: run: gitlab-git-http-server: (pid 3922) 1s ok: run: logrotate: (pid 3929) 0s ok: run: nginx: (pid 3936) 1s ok: run: postgresql: (pid 3941) 0s ok: run: redis: (pid 3950) 0s ok: run: sidekiq: (pid 3955) 0s ok: run: unicorn: (pid 3961) 1s
提示“ok: run:”表示启动成功
6.访问 GitLab页面
如果没有域名,直接输入服务器ip和指定端口进行访问
初始账户: root 密码: 5iveL!fe
第一次登录修改密码