Yum安装和卸载GitLab(CentOS环境)

作者:陆金龙    发表时间:2023-02-07 09:35   

关键词:Gitlab安装  Gitlab卸载  

参考文章:https://www.cnblogs.com/wenwei-blog/p/5861450.html

该云服务器配置:3核 2G内存

GitLab的安装使用应关注内存占用情况,8.0.0版本内存使用增加600M左右,11.11占用太大,导致内存使用量超过90%,因此放弃该版本在云服务器的使用。

启动与停止命令:gitlab-ctl start/stop

1、安装依赖软件

如果之前已安装过openssh-server 则这里可以不装

yum -y install policycoreutils openssh-server openssh-clients postfix

2、设置postfix开机自启,并启动

postfix支持gitlab发信功能

systemctl enable postfix && systemctl start postfix

3、下载GitLab安装包,然后安装

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

4、安装GitLab

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

5、修改gitlab配置文件指定服务器ip和自定义端口

(使用其默认配置可省略)

vi  /etc/gitlab/gitlab.rb

external_url 'http://www.klfront.com:8082'

6、重新启动GitLab

firewall-cmd --state

systemctl stop firewalld.service

systemctl disable firewalld.service

 

gitlab-ctl reconfigure

gitlab-ctl restart

 

停止和启动

gitlab-ctl stop

gitlab-ctl start

使用root账户初始密码登录gitlab。

7.卸载gitlab

1、停止gitlab

gitlab-ctl stop

2、卸载gitlab(注意这里写的是gitlab-ce)

rpm -e gitlab-ce

3、查看gitlab进程

ps aux | grep gitlab

4、杀掉第一个进程

kill -9 xxxx

5、删除所有包含gitlab文件

find / -name gitlab | xargs rm -rf

------------------------------------------------------------------------------------------------------------------------

方式二:

下载gitlab-ce的repo

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

yum makecache fast

yum list gitlab-ce

安装gitlab

yum install -y gitlab-ce

修改端口

vi  /etc/gitlab/gitlab.rb

搜索 /external_url

external_url 'http://127.0.0.1:8082'

重启

gitlab-ctl reconfigure

gitlab-ctl restart