想看一下gitlab是怎么通过docker做ci/cd的,所以这几天花了点时间玩了一下gitlab。
先试了一下podman把gitlab-ce的image运行起来,但是无法想象怎么在这个环境下部署docker,就先放弃了。
0. 装了centos 8虚拟机,fedora/rocky在安装gitlab的时候认不出os,所以只能试gitlab认识的os。
1. 在centos 8下安装docker
# Add Docker Repo on sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo sudo dnf update sudo dnf install docker-ce docker-ce-cli containerd.io sudo systemctl enable docker sudo systemctl start docker sudo usermod -aG docker $USER id $USER
2. Install and configure the necessary dependencies
sudo dnf install -y curl policycoreutils openssh-server 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 dnf install postfix sudo systemctl enable postfix sudo systemctl start postfix
3. 安装GitLab-ce
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash dnf install -y gitlab-ce
4. 上面步骤会出现gitlab.example.com无法解析的问题,要求解决这个问题以后再运行gitlab-ctl reconfigure。
sudo hostnamectl set-hostname vmhost01.com # update /etc/hosts, add vmhost01.com as localhost
# 更新/etc/gitlab/gitlab.rb的external_url值
5. 重启vm
6. 再运行sudo gitlab-ctl reconfigure以后,登录http://{vm ip}就可以看到登录页面了
7. root的密码在/et/gitlab/initial_root_password下