安装CentOS7的镜像文件地址:https://mirrors4.tuna.tsinghua.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Everything-1908.iso
说明:镜像文件可能一直在更新,下载最新的即可。
安装的GitLab的安装地址:https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm/
说明:rpm文件一直在更新,下载最新的即可
安装前注意查询下官方网站的按照说明(不排除有新的安装步骤):https://about.gitlab.com/install/#centos-7
安装注意事项:安装虚拟机后,需要设置好网络(包括设置好ip地址),保证虚拟机能够联网同时本机操作系统可以访问到虚拟机。
将下载的rmp文件通过SecureFX工具上传到虚拟机的/opt目录下。
使用root用户登录,运行以下命令:
sudo rpm -ivh /opt/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
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 -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ce
建议:将上述命令拷贝到shell脚本文件中(比如install.sh)中,运行shell脚本,等安装完成。
按照完成后重启虚拟机。
重启虚拟机后,初始化配置gitlab,用root用户输入以下命令:
gitlab-ctl reconfigure
配置完成后,启动gitlab服务,用root用户输入以下命令:
gitlab-ctl start
如果要关闭gitlab服务,可以输入以下命令:
gitlab-ctl stop
启动完成后,浏览器中直接输入虚拟机的本地ip地址,即可访问gitlab(本人配置的是192.168.2.23),如图,大功告成,初次登陆需要设置密码,备注如果不能访问可以试图关闭防火墙再试,关闭防火墙命令:service firewalld stop