windows10搭建gitlab服务器

gitlab服务器没有win运行环境,所以需要先搭建个虚拟机:windows10+VMware(Centos7) +gitlab+局域网其他电脑访问

一:VMware 安装,网上找找有安装教程

 

 

二:虚拟机镜像下载:阿里云镜像下载

http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/

 

 

三:安装虚拟机:没有特殊什么,一路下一步

注意:需要特殊注意的是网络类型使用NAT,不然centos7虚拟机无法上网

 

 

这里选择NAT模式:

 

 四:配置虚拟机:

 

 

 

 

 

 

点击安装-》输入root用户密码。

 

 

 等待安装!!!

 

 

 

 

 设置密码,登录。查看能否上网。

 

 

 五:安装git

官方地址:https://about.gitlab.com/install/?version=ce#centos-7

需要注意的是,我们安装的是社区版,注意看这里。根据官方文档一步一步安装即可。

 

 

 

 

sudo yum install -y curl policycoreutils-python openssh-server openssh-clients perl
# Enable OpenSSH server daemon if not enabled: sudo systemctl status sshd
sudo systemctl enable sshd
sudo systemctl start sshd

# Check if opening the firewall is needed with: sudo systemctl status firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
不需要邮箱相关操作时,可以先忽略这里

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
这里需要替换为自己的域名

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce

 

 

 

 六:我这边安装后没有找到root默认密码。所以自己修改了下密码。


#进入管理终端
 sudo gitlab-rails console -e production
#查询 
user = User.where(id: 1).first

#设置密码 user.password=‘12345678’

#确认密码 user.password_confirmation = '12345678'

#保存不然不生效 user.save!

 

 然后在虚拟机浏览器访问链接,登录成功。

 

七:局域网内其他电脑访问

上面是在centos虚拟机里面访问有效,在局域网其他电脑无法访问

1: 查看ip

 

 

 

 

 

 2:设置虚拟机网络。编辑-》虚拟机网络编辑器

 

 

 

 

 

 

 

 

 调整后再次进入虚拟机,连接网络,查看ip,发现ip发生变化。该ip在局域网其他电脑能访问。然后使用DNS解析将前面安装git服务器添加的域名绑定到该ip。其他电脑访问域名也能成功了。

 

 

参考文档:

https://about.gitlab.com/install/?version=ce#centos-7

https://www.cnblogs.com/zuxing/articles/8718591.html

https://blog.csdn.net/tsundere_x/article/details/104263100

https://www.cnblogs.com/cj8988/p/9454178.html

 

posted @ 2021-11-10 12:21  Foto_CShow  阅读(5587)  评论(0编辑  收藏  举报