centos7安装gitlab-ce

安装gitlab-ce

  1. 首先安装依赖:
    yum install curl openssh-server openssh-clients postfix policycoreutils-python
  2. 启动所需服务
systemctl enable sshd
systemctl start sshd
  1. 添加http服务到firewalld,pemmanent表示永久生效,若不加–permanent系统下次启动后就会失效
systemctl start firewalld
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
  1. 安装gitlab-ce程序

因为gitlab-ce是社区免费开源版本,所以国内的主流镜像源都有gitlab-ce的拷贝,可以在那里下载更快,以清华镜像源举例:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
新建 /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

再执行:

sudo yum makecache
sudo yum install gitlab-ce

出现下面的结果即为安装成功:
gitlab-ce安装成功

  • 目前国内安装的都是gitlab-jh,即gitlab极狐,它的免费版和gitlab-ce是一样的,属于代理关系吧。
    注意我没有安装postfix,即邮箱服务,这部分指导文章比较多,而且对大部分人来讲这个功能没有用,所以选择不安装

配置gitlab-ce

  1. 设置外部访问的url地址
vim /etc/gitlab/gitlab.rb
修改:external_url 'http://192.168.109.128:9090'  # http://ip:port格式,这里的port要注意,接下来有个步骤要用到。
然后重新加载配置:gitlab-ctl reconfigure
重新加载过程中可能会遇到卡死的情况(至少卡1分钟才视为卡死),可以尝试打开另一个窗口执行:
/opt/gitlab/embedded/bin/runsv
然后等gitlab-ctl reconfigure执行完毕后,ctrl+c关闭这个runsv程序即可。
重启gitlab-ce程序: gitlab-ctl restart
  1. 在同一局域网的一台windows机器上使用浏览器输入地址:http://ip:port访问gitlab-ce,如果发现地址不可访问,尝试以下方法:
firewall-cmd --zone=public --add-port=9090/tcp –permanent  
此命令开启9090端口,允许外部主机通过tcp连接。
可以使用以下命令查看端口是否打开:firewall-cmd --query-port=9090/tcp

如果仍然无法访问,使用gitlab-ctl tail查看日志发现bind 9090 fail,可以执行
gitlab-ctl reconfigure
gitlab-ctl stop
gitlab-ctl start
重新启动gitlab,有可能解决问题。

然后就可以使用浏览器访问了:

浏览器访问

gitlab常用命令

sudo gitlab-ctl start    # 启动所有 gitlab 组件;
sudo gitlab-ctl stop        # 停止所有 gitlab 组件;
sudo gitlab-ctl restart        # 重启所有 gitlab 组件;
sudo gitlab-ctl status        # 查看服务状态;
sudo gitlab-ctl reconfigure        # 启动服务;
sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值