安装gitlab ce
切换到root用户,安装相关依赖
yum install curl policycoreutils openssh-server openssh-clients service sshd restart yum install postfix service postfix restart
添加yum源
vim /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ gpgcheck=0 enabled=1
安装gitlab-ce:
yum makecache yum install gitlab-ce
修改配置文件:
vim /etc/gitlab/gitlab.rb external_url 'http://IP:port' 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: 'xxx.xxx.com' port: 389 uid: 'sAMAccountName' method: 'plain' # "tls" or "ssl" or "plain" bind_dn: 'CN=admin,OU=Public Account,OU=Special OU,OU=xxx,DC=xxx,DC=com' password: '****' active_directory: true allow_username_or_email_login: false block_auto_created_users: false base: 'DC=xxx,DC=com' user_filter: '' EOS
更改配置文件后,重新加载使改动配置生效,并启动gitlab:
gitlab-ctl reconfigure gitlab-ctl start
常用命令:
gitlab-ctl status # 查看服务状态 gitlab-ctl tail --查看所有日志 gitlab-ctl tail nginx/gitlab_access.log --查看nginx访问日志 gitlab-ctl tail unicorn --跟踪unicorn的状态 主配置文件:/etc/gitlab/gitlab.rb // 可以自定义一些邮件服务等 日志地址:/var/log/gitlab/ // 对应各服务的打印日志 服务地址:/var/opt/gitlab/ // 对应各服务的主目录 仓库地址:/var/opt/gitlab/git-data // 记录项目仓库等提交信息 重置配置:gitlab-ctl reconfigure // 不要乱用,会重置为最原始的配置的 重启服务:gitlab-ctl stop/start/restart/uninstall // 停止、启动、重启、卸载 默认安装:postgres、nginx、redis、unicorn