centos 7 部署gitlab安装、以及安装中文版

参考文章
1、基础git及gitlab安装 :https://www.cnblogs.com/yanxinjiang/p/8056845.html
2、 如何安装汉化版https://www.cnblogs.com/roam/p/7677836.htm
3、 gitlab安装官方文档 https://about.gitlab.com/downloads/#centos7
4、几种出现502 网页状态码的解决办法 https://blog.csdn.net/qq_36104363/article/details/84108270
5、gitlab 镜像下载 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/
6 、gitlab中文社区版的项目 https://gitlab.com/xhang/gitlab


一 安装gitlab(主机必须要可以连接外网)
1、配置yum网络源 (参考https://mp.csdn.net/mdeditor/89503318#)
2、安装
#yum install -y git
克隆获取汉化版本库 :
#git clone https://gitlab.com/xhang/gitlab.git
不是第一次部署的化,更新一下:#git fetch
查看该汉化补丁的版本:#cat gitlab/VERSION

3、部署社区版gitlab
3.1 安装gitlab的依赖项
#yum install curl openssh-server openssh-clients postfix cronie policycoreutils-python –y
3.2 启动postfix,并设置为开机启动
#systemctl start postfix
#systemctl enable postfix
3.3 设置防火墙 (实验的情况下建议直接关闭防火墙跟selinux)
#firewall-cmd --add-service=http --permanent
#firewall-cmd --reload
3.4 下载gitlab镜像 (汉化版的版本跟原版的版本号一致)
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
cd /server/tools
rpm -ivh gitlab-ce
初始化:#gitlab-ctl reconfigure
#firefox http://192.168.4.254 这里会出现502失败


参考上面的文章修改unicorn 8080端口和80端口。
1、#vim /etc/gitlab/gitlab.rb ##查找/unicorn[‘port’] ,修改端口8080为9090,删除#号
#gitlab_workhorse[‘auth_backend’] = “http://localhost:8080” 修改8080为9090
2、GitLab修改默认端口
#cd /var/opt/gitlab/nginx/conf
#vim gitlab-http.conf
把80端口修改为8040:listen *:8040;
然后用gitlab-ctl reconfigure 重启配置,sudo gitlab-ctl stop停掉服务,gitlab-ctl start直接启动服务即可访问。


firefox http://192.168.4.254:新的nginx端口号
#netstat -antulp | grep :9090 修改8080为9090
#netstat -antulp | grep :8040 修改80为8040
3、 覆盖汉化包
3.1 停止gitlab服务 #gitlab-ctl stop
3.2 切换到gitlab汉化包所在的目录 #cd /root/gitlab
3.3 比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
#git diff v10.0.2 v10.0.2-zh > …/10.0.2-zh.diff
3.4 将10.0.2-zh.diff作为补丁更新到gitlab中
#patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff
这里注意 :修改配置文件gitlab.rb
#cd /etc/gitlab/gitlab.rb
将external_url变量的地址修改为gitlab所在主机的ip地址。
3.5 启动gitlab #gitlab-ctl start
重新配置gitlab gitlab-ctl reconfigure
3.6 firefox http://192.168.4.254:8040 &
3.7 设置管理员密码
方法一:网页方式 ——浏览器访问gitlab所在的ip,输入密码后点击 “Change your password”
方法二:指令方式
#gitlab-rails console production
#irb(main):001:0> user = User.where(id: 1).first // id为1的是超级管理员
irb(main):002:0>user.password = ‘yourpassword’ // 密码必须至少8个字符
irb(main):003:0>user.save! // 如没有问题 返回true
exit // 退出


其他gitlab使用技术 :https://www.cnblogs.com/chenfool/p/7689438.html
1、查看gitlab 的配置
#gitlab-ctl show-config
2、 查看gitlab 的运行日志
#gitlab-ctl tail
3、切换gitlab 仓库的数据目录
gitlab 默认的仓库数据目录为 /var/opt/gitlab/git-data/repositories/ ,如果未来用户的数据量大了,需要更换仓库数据目录,可以通过修改 /etc/gitlab/gitlab.rb 配置进行调整。用户在调整gitlab 的配置之前,建议对其先停止服务。

4、 错误信息的log 日志目录为:/var/log/gitlab/gitlab-rails/production.log

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值