gitlab的搭建

打开系统防火墙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 

添加官方镜像

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

// 进行安装
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

速度慢,可以使用国内的镜像

// 打开文件
  vim /etc/yum.repos.d/gitlab_gitlab-ce.repo
  
  //修改文件
      [gitlab-ce]
    name=gitlab-ce
    baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
    repo_gpgcheck=0
    gpgcheck=0
    enabled=1
    gpgkey=https://packages.gitlab.com/gpg.key
    
    

安装命令

 sudo yum install gitlab-ce

重启配置,启动

sudo gitlab-ctl reconfigure

修改端口

// 打开文件
 vim /etc/gitlab/gitlab.rb
 
 //修改
 external_url 'http://127.0.0.1:82'

每次修改配置文件都需要重新载入配置:sudo gitlab-ctl reconfigure

查看端口是否开放

查看对外开放的端口状态
查询已开放的端口 netstat -anp
查询指定端口是否已开 firewall-cmd - -query-port=82/tcp
提示 yes,表示开启;no表示未开启。

查看防火墙状态

查看防火墙状态 systemctl status firewalld
开启防火墙 systemctl start firewalld
关闭防火墙 systemctl stop firewalld
开启防火墙 service firewalld start
若遇到无法开启
先用:systemctl unmask firewalld.service
然后:systemctl start firewalld.service

开放端口

添加指定需要开放的端口:
firewall-cmd - -add-port=82/tcp - -permanent
重载入添加的端口:
firewall-cmd - -reload
查询指定端口是否开启成功:
firewall-cmd - -query-port=82/tcp

移除端口

移除指定端口:
firewall-cmd - -permanent - -remove-port=82/tcp

gitlab常用命令

  • gitlab-ctl start
  • gitlab-ctl stop|
  • gitlab-ctl status
  • gitlab-ctl restart

查看日志

  • gitlab-ctl tail #查看所有日志
  • gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志

卸载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下备份的配置文件

查看gitlab的版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

修改gitlab服务器的ip

// 打开gitlab.yml的文件,找到host
cd /opt/gitlab/embedded/service/gitlab-rails/config
vi gitlab.yml
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.

production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: 192.168.0.9
    port: 82
    https: false

    # The maximum time unicorn/p

// 重启
gitlab-ctl -restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值