centos安装gitlab

准备工作

1.准备

在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问。需要root权限下,可使用su root进入root权限

2.安装ssh

sudo yum install -y curl policycoreutils-python openssh-server

3.将SSH服务设置成开机自启动

systemctl enable sshd

4.启动ssh服务

systemctl start sshd

5.查看是否安装了防火墙,一般而言,是已经安装了的

systemctl status firewalld
# 未安装通过下列命令安装、启动
yum install firewalld systemd -y
service firewalld start

6.添加http服务到firewalld,pemmanent表示永久生效,若不加–permanent系统下次启动后就会失效。

firewall-cmd --permanent --add-service=http
# 重启防火墙
systemctl reload firewalld

7.装Postfix以发送通知邮件

yum install postfix
#注意:在centos7里postfix是系统自带的,但是centos7以前的版本是默认不带的。自带可以省略这一步。

8.启动postfix

systemctl start postfix

9.检查系统中是否已经安装wget,使用 wget -V 若出现下图wget相关版本描述则说明系统中已经安装wget 若报系统找不到命令说明wget未安装

未安装使用 yum -y install wget 安装

二、安装

1.添加gitlab镜像

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm 
# 安装其他版本可以自行查找

2.安装gitlab

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

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

vim /etc/gitlab/gitlab.rb

external_url ‘http://gitlab.example.com’ 直接注释掉,或者,你没有域名,改为你的服务器或者虚拟机地址
nginx[‘listen_port’] = 8999 修改默认端口
进入编辑器后按“i”键进入编辑状态,修改完毕后,按ESC键退出编辑状态
然后退出并保存,命令输入“:wq”,如果无法保存可以通过“:wq!”强制保存退出。
ps:注意这里设置的端口不能被占用,默认是8080端口,如果8080已经使用,请自定义其它端口,并在防火墙设置开放相对应得端口

4.重置并启动GitLab

gitlab-ctl reconfigure  
#(需要一定时间)

重启gitlab

gitlab-ctl restart

启动gitlab

gitlab-ctl start

关闭gitlab

gitlab-ctl stop
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值