Linux:搭建GitLab

0.写在前面

GitLab官方明确要求最低配置2核4G,如果配置过低,会出现502错误。

1.安装SSH

#安装ssh
sudo yum install -y curl policycoreutils-pythonopenssh-server

#将SSH服务设置成开机自启动
sudo systemctl enable sshd

#启动SSH服务
sudo systemctl start sshd

2.安装防火墙

#安装防火墙
yum install firewalld systemd -y

#开启防火墙
service firewalld start

#添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效
sudo firewall-cmd --permanent --add-service=http

#重启防火墙,安装命令
sudo systemctl reload firewalld

开启防火墙之后,导致服务器访问不了,可以停掉:service firewalld stop

3.安装Postfix

 

#安装Postfix以发送通知邮件
sudo yum install postfix

#将postfix服务设置成开机自启动
sudo systemctl enable postfix

#启动postfix
sudo systemctl start postfix

 

4.安装GitLab

#wget未安装则进行安装
yum -y install wget

#下载GitLab安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.4.3-ce.0.el7.x86_64.rpm

#安装
rpm -ivh gitlab-ce-12.4.3-ce.0.el7.x86_64.rpm

EL是Red Hat Enterprise Linux的简写

  • EL5软件包用于在Red Hat 5.x, CentOS 5.x, CloudLinux 5.x的安装

  • EL6软件包用于在Red Hat 6.x, CentOS 6.x, and CloudLinux 6.x进行安装

  • EL7 软件包用于在Red Hat 7.x, CentOS 7.x, and CloudLinux 7.x的安装

cat /etc/redhat-release 查看CentOS版本

 

5.配置GitLab

 

#修改gitlab配置文件指定服务器ip和自定义端口:
vim  /etc/gitlab/gitlab.rb

修改这个参数
external_url 'ip:port'

#重置并启动GitLab
gitlab-ctl reconfigure
gitlab-ctl restart

 

 

 

 

 

 

posted @ 2019-11-22 10:58  市井俗人  阅读(246)  评论(0编辑  收藏  举报