CentOs 7 安装 GitLab、完全卸载GitLab - huhuhuemail的博客 - CSDN博客

2,177 阅读3分钟
原文链接: blog.csdn.net
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:blog.csdn.net/huhuhuemail…

安装 GitLab

1.安装并配置必要的依赖关系

在CentOS 7(和RedHat / Oracle / Scientific Linux 7)上,以下命令还将在系统防火墙中打开HTTP和SSH访问。

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd

sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

接下来,安装Postfix发送通知邮件。如果您想使用其他解决方案发送电子邮件,请跳过此步骤并在安装GitLab后 配置外部SMTP服务器 。(不发邮件的话这步可以跳过)

2.添加GitLab软件包存储库并安装软件包

(如果想手动安装的可以到以下地址下载,国内比较快奥

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/)

gitlab 分为gitlab-ce和gitlab-ee,我们要安装ce社区版
gitlab-ce是社区版,免费的
gitlab-ee是企业版,收费的

添加GitLab软件包存储库。

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

接下来,安装GitLab软件包。 将`http://gitlab.example.com`更改为您想要访问您的GitLab实例的URL。安装将自动在该URL处配置并启动GitLab。安装后HTTPS需要 额外的配置

sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee

3.浏览到主机名并登录

第一次访问时,您将被重定向到密码重置屏幕。 提供初始管理员帐户的密码,您将被重定向回登录屏幕。使用默认帐户的用户名 root 登录。

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

4.安装过程中问题处理

执行到 sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee 这个步骤的时候,很大可能被卡死。

解决方案:

1、没关系上趟厕所多等一会(10分钟)
2、按住CTRL+C强制结束
3、运行:sudo systemctl restart gitlab-runsvdir
4、再次执行:sudo gitlab-ctl reconfigure

如果访问时报,502 错误

解决方案:

可能性一
是unicorn服务与tomcat端口冲突,配置下unicorn使用端口应该就可以了
vi /etc/gitlab/gitlab.rb
unicorn['port'] = 9090

再gitlab-ctl reconfigure 重启配置,然后稍等一会,在访问,这样GitLab服务器就可以正常运行了。

安装/启动postfix的时候报错:

[plain] view plain copy
  1. [root@ ~]# systemctl start postfix  
  2. Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details. 

解决方法:

[plain] view plain copy
  1. 修改 /etc/postfix/main.cf的设置  
  2.   
  3. inet_protocols = ipv4  
  4. inet_interfaces = all  

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

5.GitLab常用命令

sudo gitlab-ctl start                    # 启动所有 gitlab 组件;
sudo gitlab-ctl stop                    # 停止所有 gitlab 组件;
sudo gitlab-ctl restart                # 重启所有 gitlab 组件;
sudo gitlab-ctl status                 # 查看服务状态;
sudo gitlab-ctl reconfigure         # 启动服务;
sudo vim /etc/gitlab/gitlab.rb      # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
sudo gitlab-ctl tail                        # 查看日志;

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

完全卸载GitLab

一、停止gitlab
sudo gitlab-ctl stop
二、卸载gitlab(这块注意了,看看是gitlab-ce版本还是gitlab-ee版本,别写错误了)
sudo rpm -e gitlab-ce

三、查看gitlab进程

ps -ef|grep gitlab
     杀掉第一个守护进程(runsvdir -P /opt/gitlab/service log)
     kill -9 4473
     再次查看gitlab进程是否存在

四、删除gitlab文件

        find / -name *gitlab*|xargs rm -rf      删除所有包含gitlab的文件及目录

        find / -name gitlab |xargs rm -rf 

        删除gitlab-ctl uninstall时自动在root下备份的配置文件(ls /root/gitlab* 看看有没有,有也删除)

通过以上几步就可以彻底卸载gitlab