快速学会CentOS配置GitLab

下载GitLab

安装依赖包:

yum install curl policycoreutils policycoreutils-python openssh-server openssh-clients

依赖包安装完成之后:

1: systemctl enable sshd
2: systemctl start sshd
3: yum install postfix
4: systemctl enable postfix
5: systemctl start postfix
6: firewall-cmd --permanent --add-service=http
7: systemctl reload firewalld

以上依赖安装完之后,下载gitlab:

centos 6系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

下载相对应系统的rpm包

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.0.0-ce.0.el6.x86_64.rpm

安装rpm包

rpm -i gitlab-ce-8.0.0-ce.0.el6.x86_64.rpm

安装完成之后

vim /etc/gitlab/gitlab.rb

修改gitlab配置文件,访问IP:端口,  如果不修改默认80端口,进入文件之后,找到

external_url      #  这个变量

修改external_url变量

external_url 'http://ip:端口'

修改完成之后退出并且保存

esc    +  wq

保存之后需要更新一下修改

gitlab-ctl reconfigure

重启gitlab

gitlab-ctl restart      # 重启

gitlab-ctl stop        #  停止

gitlab-ctl start        # 启动

gitlab-ctl status      # 查看状态

访问gitlab

输入你在  /etc/gitlab/gitlab.rb文件里定义的
external_url后边跟的ip就可以访问

配置成功之后就会出现这个页面,  默认账号:root, 密码;password,  如果不对的话,请自行修改。

修改gitlab管理员账号密码

gitlab-rails console production

# 按下回车之后会出现
Loading production environment (Rails 4.1.1)

# 依次输入
irb(main):001:0> user = User.where(id:1).first
irb(main):002:0> user.password='66668888'      # root密码
irb(main):003:0> user.save!

# 返回
true        # 表示修改成功

Ctrl+C 可以退出了

到了这里之后,gitlab就配置完成了,接下来就可以使用了。以上所有方法,亲测,全部有效。

# 修改gitlab  IP地址

vim /etc/gitlab/gitlab.rb

external_url 'ip地址'

配置完成
重置命令:    gitlab-ctl reconfigure

重启命令:    gitlab-ctl restart

更多GitLab相关教程见以下内容

GitLab 的详细介绍请点这里
GitLab 的下载地址请点这里 

猜你喜欢

转载自www.linuxidc.com/Linux/2018-08/153345.htm