gitlab服务器搭建(centos7)
*查看文件占用
df -ia
*查看某个目录占用过高
du -h -x --max-depth=1
*GitLab镜像站:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/?C=M&O=D
*目前版本选择,version:11.11.2:
gitlab-ce-11.11.2-ce.0.el7.x86_64.rpm
*安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
*设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
*下载gitlab安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.11.2-ce.0.el7.x86_64.rpm
*开始安装gitlab
yum -y install gitlab-ce-11.11.2-ce.0.el7.x86_64.rpm
安装成功后,在目录:/etc/gitlab/
*修改gitlab配置文件制定服务器IP和自定义端口
/etc/gitlab/gitlab.rb
修改gitlab url 配置项:external_url=‘http://192.168.200.131’ 原为gitlab官网域名
*重置并启动gitlab
gitlab-ctl reconfigure 注意:一定要等输出命令全部完成
gitlab-ctl restart 提示ok:run 表示启动成功
*访问gitlab页面
浏览器URL:192.168.200.131 会自动重定向指定页
初始账号:root
初始密码:xxxxx
如下页面就是设置初始密码:
*设置gitlab发信功能
发信系统用的默认的postfix,smtp是默认开启的,两个都启用了,两个都不会工作。
我这里设置关闭smtp,开启postfix
关闭smtp方法:vim /etc/gitlab/gitlab.rb
找到#gitlab_rails[‘smtp_enable’] = true 改为 gitlab_rails[‘smtp_enable’] = false
修改后执行gitlab-ctl reconfigure
另一种是关闭postfix,设置开启smtp,相关教程请参考官网https://doc.gitlab.cc/omnibus/settings/smtp.html
如图: