一.安装依赖软件
$ yum -y install policycoreutils openssh-server openssh-clients postfix
二.设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
三.下载gitlab 安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
安装
rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
四.修改gitlab 配置文件,指定服务器ip及端口号
vim /etc/gitlab/gitlab.rb
五.重新启动gitlab
加载配置文件:gitlab-ctl reconfigure
重启:gitlab-ctl restart
查看状态:gitlab-ctl status
关闭:gitlab-ctl stop
开启:gitlab-ctl start
六.访问GitLab页面
# 如果没有域名,直接输入服务器ip和指定端口进行访问
# 初始账户: root 密码: 5iveL!fe
# 第一次登录后会提示修改密码
这样本地GitLab仓库就搭建好了!
注意
1.external_url 一定要加上 'http://'
2.安装的gitlab默认的是80端口 要记得修改端口
3.如果想要在windows上使用域名访问 首先修改host文件 虚拟机的ip指向某个域名
172.168.100.57 git.test.com
主要是虚拟机里面的配置很重要!!!
先安装nginx
并且要保证在windows上可以访问虚拟机ip 如果访问不了 记得关闭防火墙即可
nginx反向代理配置如下 (监听的依然是80端口 但是下面的修改为自定义的端口即可!)
gitlab里面的配置直接使用ip即可,不可以使用域名
server {
listen 80;
listen [::]:80;
server_name git.test.com;
location / {
proxy_pass http://172.168.100.57:8080;
proxy_set_header Host $host:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
这样既可访问 就可以做到从windows本地进入虚拟机上的gitlab 然后进行代码提交
部分参考博客 https://blog.csdn.net/yaban8347/article/details/82462071
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)