安装gitlab
安装wget
两种方式:
下载rpm安装包http://mirrors.163.com/centos/7/os/x86_64/Packages/
通过scp命令上传到服务器(可以在/usr/local/下创建目录wget)使用命令
rpm -ivh wget-1.14-15.el7_4.1.x86_64.rpm(wget包名换成自己的) 即可安装成功
使用yum安装
命令: yum -y install wget
安装gitlab依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
启动ssh服务&设置为开机启动
systemctl enable sshd && sudo systemctl start sshd
设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
开放ssh以及http服务,然后重新加载防火墙列表
firewall-cmd --add-service=ssh --permanentfirewall-cmd --add-service=http --permanentfirewall-cmd --reload
如果报错FirewallD is not running
需要开启防火墙
systemctl start firewalld
如果还报错Failed to start firewalld.service: Unit firewalld.service is masked.
systemctl unmask firewalld.service
然后再开启防火墙执行刚才失败的命令
下载gitlab包并安装两种方式镜像源安装或者yum下载这里选择镜像源安装
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
修改gitlab配置
修改gitlab配置
vi /etc/gitlab/gitlab.rb
external_url 'http://自定义IP:自定义端口'
重载配置
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab常用命令
gitlab-ctl reconfigure # 重载配置gitlab-ctl check-config # 检查配置并启动gitlab-ctl diff-config # 将用户配置与包可用配置进行比较gitlab-ctl status # 查看所有启动组件的进程和状态gitlab-ctl service-list # 查看所有服务gitlab-ctl stop # 停止GitLab服务gitlab-ctl start # 启动GitLab服务gitlab-ctl restart # 重启GitLab服务gitlab-ctl once # 如果GitLab服务已停止则启动服务,如果GitLab服务已启动则重启GitLab服务