手把手教你搭建GitLab

手把手教你搭建GitLab

1.安装SSH

sudo yum install -y curl policycoreutils-pythonopenssh-server

2.启动SSH

sudo systemctl start sshd

3.设置SSH服务自动启动

sudo systemctl enable sshd

4.安装防火墙

sudo yum install firewalld systemd -y

5.开启防火墙

service firewalld start
如果报错Redirecting to /bin/systemctl start firewalld.service
请用systemctl方式启动:sudo systemctl start firewalld

6.添加http服务到firewalld

pemmanent表示永久生效

不加–permanent在系统下次启动后就会失效。

sudo firewall-cmd --permanent --add-service=http

7.重启防火墙

sudo systemctl reload firewalld

8.安装Postfix以发送通知邮件

sudo yum install postfix

9.设置postfix服务开机启动

sudo systemctl enable postfix

10.启动postfix

sudo systemctl start postfix
postfix启动失败Centos启动postfix失败解决方法

11.安装wget

sudo yum -y install wget

12.安装vim编辑器

sudo yum install vim -y

13.添加gitlab镜像

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

14.安装gitlab

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

错误提示

warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64

安装gitlab的依赖项

sudo yum install policycoreutils-python

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

vim /etc/gitlab/gitlab.rb
修改external_url 'http://服务器ip:端口’
修改external_url 'http://域名’

16.重置并启动GitLab

gitlab-ctl reconfigure
gitlab-ctl restart

17.访问GitLab

如果没有域名,直接输入服务器ip和指定端口进行访问
初始账户: root 密码:5iveL!fe
第一次登录按照提示修改密码

访问失败

若使用服务器ip+端口访问
检查服务器端口是否开放,例如external_url 'http://服务器ip:8000,检查8000端口是否开放

若使用域名访问
检查服务器3306端口是否开放 external_url 'http://域名,端口默认为3306

发布了7 篇原创文章 · 获赞 3 · 访问量 155

猜你喜欢

转载自blog.csdn.net/qinghuan100/article/details/105161537