Jenkins + Harbor + Gitlab
环境准备三台虚拟机主机名配置IP地址master4G 4C192.168.0.200node12G 4C192.168.0.201node22G 4C192.168.0.202停止防火墙systemctl disable firewalldsystemctl stop firewalld禁用SELinux# 永久 关闭sed -i 's/enforcing/disabled/' /etc/seli
Jenkins + Harbor + Gitlab
Jenkins
安装 Jdk + Maven + Git
地址:https://blog.csdn.net/weixin_38405770/article/details/122363939?spm=1001.2014.3001.5501
下载Jenkins包
链接:https://pan.baidu.com/s/1RnPOpo4oiEjAYqsB-ItUNQ
提取码:65tr
然后复制一下这个脚本 https://blog.csdn.net/weixin_38405770/article/details/122528390
命名为jenkins.sh
jenkins.sh 和jenkins.war放在同级目录
# 启动
sh jenkins.sh start
# 停止
sh jenkins.sh stop
插件安装
Kubernetes Continuous Deploy、Kubernetes、Gitlab Hook 、GitLab、Build Authorization Token
Harbor
安装docker-compose
官方下载地址: https://github.com/docker/compose/releases/tag/1.25.5
下载: docker-compose-Linux-x86_64
#复制
cp docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
#可执行权限
chmod +x /usr/local/bin/docker-compose
#查看版本
docker-compose version
下载Harbor安装包
Harbor官网下载: https://github.com/goharbor/harbor/releases
下载包: harbor-offline-installer-v1.8.0.tgz
# 解压
tar -zxvf harbor-offline-installer-v1.8.0.tgz
# 编辑配置文件
vi harbor.yml
# 修改hostname为当前主机IP地址
hostname: 192.168.0.203
# 拉取镜像准备安装
./prepare
# 安装
./install.sh
# 出现报错
[Step 3]: starting Harbor ...
[+] Running 1/1
⠿ Network harbor_harbor Created 0.1s
⠋ Container harbor-log Creating 0.0s
Error response from daemon: invalid mount config for type "bind": bind mount source path does not exist: /var/log/harbor/
Error response from daemon: invalid mount config for type "bind": bind mount source path does not exist: /data/ca_download/
Error response from daemon: invalid mount config for type "bind": bind mount source path does not exist: /data/psc/
# 提示这些路径不存在,我们创建即可
mkdir -p /var/log/harbor/
mkdir -p /data/ca_download/
mkdir -p /data/psc/
# 创建完之后在进行安装,问题解决,安装成功
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at http://192.168.0.203.
For more details, please visit https://github.com/goharbor/harbor .
然后我们访问 http://192.168.0.203 即可 账号:admin 密码:Harbor12345
Docker配置仓库地址
vim /etc/docker/daemon.json
#增加下面内容,harbor默认端口为80情况,如果非80,需要在IP后加端口
#{"insecure-registries":["harbor服务端IP"]}
{"insecure-registries":["192.168.0.5"]}
#重新加载配置
systemctl daemon-reload
#重启docker
systemctl restart docker
#登录成功
docker login 192.168.0.5
输入账户和密码
#或者
docker login 192.168.0.5 -u admin -p Harbor12345
Gitlab
# 安装依赖
yum install -y curl policycoreutils-python openssh-server
# 下载安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm
# 安装gitlab
rpm -ivh gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm
# 卡住了
警告:gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
警告:正在等候 事务 锁定 /var/lib/rpm/.rpm.lock
# 解决办法
rm -f /var/lib/rpm/.rpm.lock
rpm --rebuilddb
# 重新执行安装命令
rpm -ivh gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm
修改配置
vim /etc/gitlab/gitlab.rb
# 找到下边配置文件 后边改成当前主机ip加你的端口号 端口号需确认不被占用
external_url 'http://192.168.0.203:8000'
# 重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
# 运行结果如下
[root@localhost gitlab]# gitlab-ctl restart
ok: run: alertmanager: (pid 101933) 0s
ok: run: gitaly: (pid 102012) 1s
ok: run: gitlab-exporter: (pid 102073) 1s
ok: run: gitlab-workhorse: (pid 102076) 0s
ok: run: grafana: (pid 102085) 0s
ok: run: logrotate: (pid 102102) 1s
ok: run: nginx: (pid 102108) 0s
ok: run: node-exporter: (pid 102116) 1s
ok: run: postgres-exporter: (pid 102122) 0s
ok: run: postgresql: (pid 102131) 0s
ok: run: prometheus: (pid 102141) 0s
ok: run: puma: (pid 102156) 0s
ok: run: redis: (pid 102161) 0s
ok: run: redis-exporter: (pid 102167) 1s
ok: run: sidekiq: (pid 102178) 0s
#ok 启动成功了
# 查看密码
cat /etc/gitlab/initial_root_password
Password: E4nsd/b/tW+fLiEiLtYTxaN3QgSq5229qRGB3J/UnuY=
访问 http://192.168.0.203:8000/ 用户名:root 密码:E4nsd/b/tW+fLiEiLtYTxaN3QgSq5229qRGB3J/UnuY=
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)