本文搭建的gitlab是基于yum的方式进行安装的,具体的安装步骤如下:
(1)、配置yum源
vim /etc/yum.repos.d/gitlab-ce.repo
(2)、复制如下内容并保存,注意baseurl的配置是centos7的地址
[gitlab-ce]
name=gitlab-ce
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
Repo_gpgcheck=0
Enabled=1
Gpgkey=https://packages.gitlab.com/gpg.ke
(3)、更新本地yum缓存
sudo yum makecache
(4)、yum安装gitlab,此处安装版本是10.2.2
sudo yum install gitlab-ce #自动安装最新版
sudo yum install gitlab-ce-10.2.2 #安装指定版本,此处为10.2.2
注意安装的过程中可能会报如下错误
sudo yum install gitlab-ce-10.2.2 --nogpgcheck ####跳过校验
(5)、更改配置
vim /etc/gitlab/gitlab.rb
找到 external_url 'http://000.00.00.00:8081'
修改成你的地址,此处为http://192.168.1.157:8081
(6)、对GitLab进行编译
gitlab-ctl reconfigure
(7)、清除缓存
gitlab-rake cache:clear RAILS_ENV=production
(8)、启动gitlab服务,以及关闭防火墙等操作
sudo gitlab-ctl start # 启动所有 gitlab 组件;并加入开机启动项里面:/etc/rc.local
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
sudo gitlab-ctl status # 查看服务状态;
sudo gitlab-ctl tail # 查看日志;
关闭防火墙:
systemctl stop firewalld.service ###centos7关闭防火墙
(9)、访问gitlab:192.168.1.157:8081,gitlab默认的root账号密码为qazwsxed,首次进入需要修改root密码
参考:gitlab的搭建(搭建、使用、备份、迁移恢复)-阿里云开发者社区
完全卸载删除gitlab
1、停止gitlab
gitlab-ctl stop
2、卸载gitlab(注意这里写的是gitlab-ce)
rpm -e gitlab-ce
3、查看gitlab进程
ps aux | grep gitlab
4、杀掉第一个进程(就是带有好多.............的进程)
kill -9 474
杀掉后,在ps aux | grep gitlab确认一遍,还有没有gitlab的进程
5、删除所有包含gitlab文件
find / -name gitlab | xargs rm -rf
find / -name *gitlab*|xargs rm -rf 删除所有包含gitlab的文件及目录