linux搭建gitlab服务(就这一篇足够,傻瓜式部署,完全不用操心)

1,环境
Centos7 & jdk8

2,部署步骤

[root@localhost ~]# yum -y install epel-release git
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
[root@localhost src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm		#此处时间较长请耐心等待
[root@localhost src]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.60'      //将此处设为gitlab的服务器ip地址亦或域名
[root@localhost ~]# gitlab-ctl reconfigure     //重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl restar
[root@localhost ~]# head -1 /opt/gitlab/version-manifest.txt  //查看当前的gitlab版本
gitlab-ce 11.2.1
[root@localhost ~]# gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.2.1 (2d6c1c6)
 GitLab Shell: 8.1.1
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = '设置密码'
=> "设置密码"
irb(main):003:0> user.save!
=> true
irb(main):004:0> exit

3,访问gitlab :ip + port
默认nginx端口为80,避免端口被占用,你可以修改自己的端口,记得防火墙要开放端口。
开放端口:

## 开放防火墙
firewall-cmd --list-ports #查看端口
firewall-cmd --zone=public --add-port=8003/tcp --permanent #添加端口
firewall-cmd --reload #加载

修改端口:

cd /var/opt/gitlab/nginx/conf
vim gitlab-http.conf

---- site configuration(截取一部分) ----
upstream gitlab-workhorse {
  server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}


server {
  listen *:80; --修改端口


  server_name localhost;
  server_tokens off; ## Don't show the nginx version number, a security best practice

重启网关:

gitlab-ctl restart

查看服务:

ps -ef | grep gitlab

访问
http://ip:8003

4,进入gitlab服务web页,进行配置,参考下面链接
web页配置gitlab链接

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值