美文网首页
Linux CentOS7 GitLab的安装部署设置

Linux CentOS7 GitLab的安装部署设置

作者: 连理枝__ | 来源:发表于2018-08-23 16:13 被阅读0次

Linux下GitLab的安装部署

Gitlab官网:https://about.gitlab.com/installation/#centos-7

1、安装和配置必要的依赖项。

在CentOS上,以下命令也将在系统防火墙中打开HTTP和SSH访问。

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

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

2、添加GitLab仓库,并安装到服务器上

  • 方法一 推荐:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
  • 方法二: 手动下载文件,然后使用rpm命令安装
curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-XXX.rpm/download
rpm -i gitlab-ce-XXX.rpm

3、启动GitLab

sudo gitlab-ctl reconfigure

4、打开浏览器访问,默认80端口

  • 首次访问需要设置root密码
  • 关闭注册功能 Admin Area > Settings >Sign-up Restrictions取消Sign-up enabled勾选

5、常用配置不建议修改

  • 修改内置nginx端口号,默认是80不建议修改,修改vim var/opt/gitlab/nginx/conf/gitlab-http.conf
 server {
  listen *:8222;
  ......
  • gitlab本身采用80端口,配置GitLab的URL,修改vim /etc/gitlab/gitlab.rb
external_url 'http://127.0.0.1:8222'

每次重新配置,都需要执行sudo gitlab-ctl reconfigure 使之生效。

6、日常管理

  • 常用命令gitlab-ctl start|stop|status|restart比如查看状态:
[root@iZ234865htyZ ~]# gitlab-ctl status
run: gitaly: (pid 12614) 97739s; run: log: (pid 3429) 159390s
run: gitlab-monitor: (pid 12622) 97738s; run: log: (pid 3610) 159368s
run: gitlab-workhorse: (pid 12625) 97738s; run: log: (pid 3443) 159384s
run: logrotate: (pid 947) 446s; run: log: (pid 3474) 159382s
run: nginx: (pid 14129) 97293s; run: log: (pid 2415) 103679s
run: node-exporter: (pid 12648) 97737s; run: log: (pid 3509) 159378s
run: postgres-exporter: (pid 12654) 97736s; run: log: (pid 3559) 159370s
run: postgresql: (pid 12660) 97736s; run: log: (pid 3262) 159439s
run: prometheus: (pid 12668) 97735s; run: log: (pid 3491) 159380s
run: redis: (pid 12678) 97735s; run: log: (pid 2829) 159471s
run: redis-exporter: (pid 12682) 97735s; run: log: (pid 3525) 159372s
run: sidekiq: (pid 9931) 14072s; run: log: (pid 3415) 159392s
run: unicorn: (pid 14261) 97263s; run: log: (pid 3380) 159393s
  • 查看日志/var/log/gitlab可以进去查看访问日志以及报错日志
gitlab-ctl tail #查看所有日志
gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志

7、卸载GitLab

停止gitlab,执行sudo gitlab-ctl stop
卸载gitlab,执行sudo rpm -e gitlab-ce
查看gitlab进程,杀掉第一个守护进程kill -9 pid
删除gitlab文件,执行find / -name gitlab|xargs rm -rf删除所有包含gitlab的文件及目录,
再执行gitlab-ctl uninstall删除自动在root下备份的配置文件。

相关文章

网友评论

      本文标题:Linux CentOS7 GitLab的安装部署设置

      本文链接:https://www.haomeiwen.com/subject/bkhmiftx.html