centos7搭建gitLab服务
先查看当前系统的版本号 cat /etc/redhat-release
版本是 : CentOS Linux release 7.6.1810 (Core)
查看内存使用情况 free -h
查看当前端口状态 netstat -ntlp
80 端口已经被用了
开始搭建服务
安装git
yum install git
检查git版本 git --version
git config --global user.name "xxxxxx"
git config --global user.email "[email protected]"
git config --global core.editor vim
1. 安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
2.设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
3. yum install policycoreutils-python
获取安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
安装
rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
显示上图表示安装成功
4.修改gitlab配置文件指定服务器ip和自定义端口:
vim /etc/gitlab/gitlab.rb
进入编辑器后按“i”键进入编辑状态,ESC键退出编辑状态
退出并保存,命令输入“:wq”
ps:注意这里设置的端口不能被占用,默认是8080端口,如果8080已经使用,请自定义其它端口,并在防火墙设置开放相对应得端口 这里用的是8010端口
查看开放端口命令
firewall-cmd --list-ports
开放8010端口
firewall-cmd --zone=public --add-port=8010/tcp --permanent
再查看开放端口
firewall-cmd --list-ports
重启firewall
firewall-cmd --reload
如果有以下提示,则表明防火墙未开启
FirewallD is not running
开启防火墙
systemctl start firewalld
5.重置并启动GitLab
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl start # 启动所有 gitlab 组件;
gitlab-ctl stop # 停止所有 gitlab 组件;
gitlab-ctl restart # 重启所有 gitlab 组件;
gitlab-ctl status # 查看服务状态;
gitlab-ctl reconfigure # 启动服务;
vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
gitlab-ctl tail # 查看日志;
然后访问
管理员账号为
root
检查gitLab版本号
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
汉化
gitlab-ctl stop
yum -y install git
克隆获取***本库
git clone https://gitlab.com/xhang/gitlab.git
cd /root/gitlab/
git diff v10.0.0 v10.0.0-zh >/tmp/10.0.0-zh.diff
yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.0.0-zh.diff
启动
gitlab-ctl start
重新配置
gitlab-ctl reconfigure