一、准备工作
安装并配置必要的依赖关系,
1.安装shh
sudo yum install -y curl policycoreutils-pythonopenssh-server
2.将SSH服务设置成开机自启动
sudo systemctl enable sshd
3.启动SSH服务,安装命令
sudo systemctl start sshd
4.添加http服务到firewalld,pemmanent表示永久生效,若不加–permanent系统下次启动后就会失效
sudo firewall-cmd --permanent --add-service=http
5.安装Postfix以发送通知邮件
sudo yum install postfix
6.将postfix服务设置成开机自启动
sudo systemctl enable postfix
7.启动postfix
sudo systemctl start postfix
8.wget 用于从外网上下载插件
检查是否已经安装wget
wget -V
下图表示已经安装,没安装执行一下 yum -y install wget
二、添加GitLab镜像源并安装gitlab服务器
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
他说缺少这个版本的依赖,这个是centos7的 换一个版本。
可以去这个网址找一个:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
试了多个终于有一个可以的了 gitlab-ce-7.14.3-ce.1.el7.x86_64.rpm
3.修改gitlab配置文件指定服务器ip和自定义端口
vim /etc/gitlab/gitlab.rb
找到这个 修改成自己的端口
4.重置并启动GitLab
gitlab-ctl reconfigure
处理完成
重启
gitlab-ctl restart
重启成功
5.访问 GitLab页面
如果没有域名,直接输入服务器ip和指定端口进行访问
需要自己配置
**
出现访问 502 原因是端口被其他服务占用了,需要更换配置文件里得到端口 ,并且执行gitlab-ctl reconfigure
gitlab-ctl restart 就可以解决
**
初始账户: root 密码:5iveL!fe
第一次登录需要修改密码
gitlab-ctl stop
gitlab-ctl start
gitlab-ctl restart