gitlab

文章目录

安装

需求说明

部署gitlab服务

环境说明
①.关闭防火墙

[[email protected] ~]# systemctl stop firewalld.service 

②.关闭selinux

[[email protected] ~]# setenforce 0
[[email protected] ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config 

③.配置网络源

[[email protected] ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo 

④.准备好gitlab的软件包

[[email protected] ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm

官网下载地址
操作步骤
①.安装gitlab的依赖项

[[email protected] ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python git

②.启动postfix,并设置开机自启

[[email protected] ~]# systemctl start postfix 
[[email protected] ~]# systemctl enable postfix
[[email protected] ~]# ps -ef | grep postfix
root       1162      1  0 02:52 ?        00:00:00 /usr/libexec/postfix/master -w
postfix    1163   1162  0 02:52 ?        00:00:00 pickup -l -t unix -u
postfix    1164   1162  0 02:52 ?        00:00:00 qmgr -l -t unix -u
root       1423   1173  0 03:08 pts/0    00:00:00 grep --color=auto postfix

③.安装gitlab包,并修改配置文件

[[email protected] ~]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
[[email protected] ~]# vim /etc/gitlab/gitlab.rb 
external_url 'http://172.16.11.21'         //改成gitlab服务器ip

④.重新加载配置内容

[[email protected] ~]# gitlab-ctl reconfigure
[[email protected] ~]# gitlab-ctl restart

⑤.修改密码

[[email protected] ~]# gitlab-rails console production
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = 'abcdefg123'
=> "abcdefg123"
irb(main):003:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 702c4ccc-0b6e-41e7-8dac-4d0d6a0380ac) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true           //出现true则表示保存成功
irb(main):004:0> quit
[[email protected] ~]# gitlab-ctl restart

测试
设置新密码
gitlab

使用新密码登陆
gitlab

使用

新建组

gitlab