目录

一、安装gitlab

二、安装部署docker设置源

三、下载部署runner

​编辑

四、构建CI/CD


一、安装gitlab

1.查看OpenEuler版本

[root@localhost ~]#  cat /etc/os-release
NAME="openEuler"
VERSION="24.03 (LTS-SP1)"
ID="openEuler"
VERSION_ID="24.03"
PRETTY_NAME="openEuler 24.03 (LTS-SP1)"
ANSI_COLOR="0;31"

2.安装基础环境

sudo yum update -y
sudo yum install -y curl policycoreutils-python-utils openssh-server perl wget

3.下载gitlab安装包, RPM 包

curl -LOS https://packages.gitlab.cn/repository/el/8/gitlab-jh-17.7.0-jh.0.el8.x86_64.rpm

4.安装并配置

[root@localhost ~]# export EXTERNAL_URL="http://192.168.158.37"
[root@localhost ~]# sudo rpm -ivh gitlab-jh-*.rpm
警告:gitlab-jh-17.7.0-jh.0.el8.x86_64.rpm: 头 V4 DSA/SHA256 Signature, 密钥 ID 319ec913: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...1:gitlab-jh-17.7.0-jh.0.el8        ################################# [100%]
It looks like JiHu GitLab has not been configured yet; skipping the upgrade script.*.                  *.***                 ********               *****.******             ***************            ********,,,,,,,,,***********,,,,,,,,,,,,,,,,,,,,*********,,,,,,,,,,,.,,,,,,,,,,,*******,,,,,,,,,,,,,,,,,,,,,*****,,,,,,,,,.,,,,,,,****,,,,,,.,,,***,,,,,*,.___ __  __         _______ __  __          __/ (_) / / /_  __   / ____(_) /_/ /   ____ _/ /___  / / / /_/ / / / /  / / __/ / __/ /   / __ `/ __ \/ /_/ / / __  / /_/ /  / /_/ / / /_/ /___/ /_/ / /_/ /\____/_/_/ /_/\__,_/   \____/_/\__/_____/\__,_/_.___/Thank you for installing JiHu GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your JiHu GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your JiHu GitLab instance by running the following command:sudo gitlab-ctl reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme
https://jihulab.com/gitlab-cn/omnibus-gitlab/-/blob/main-jh/README.mdHelp us improve the installation experience, let us know how we did with a 1 minute survey:
https://wj.qq.com/s2/10068464/dc66

5.修改配置文件

vim /etc/gitlab/gitlab.rb
external_url 'http://172.16.50.23' 
nginx['listen_port'] = 80 
gitlab_rails['time_zone'] = 'Asia/Shanghai'  

6.启动gitlab

[root@localhost ~]# sudo gitlab-ctl reconfigure 
# 初始化配置(耗时较长,可能10几分钟)最后输出下面这段Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.gitlab Reconfigured!

7、启动:gitlab-ctl  start 

8、查看:   gitlab-ctl  status

[root@localhost ~]# gitlab-ctl start
ok: run: alertmanager: (pid 27413) 58s
ok: run: gitaly: (pid 27322) 60s
ok: run: gitlab-exporter: (pid 27330) 60s
ok: run: gitlab-kas: (pid 26092) 202s
ok: run: gitlab-workhorse: (pid 27302) 62s
ok: run: logrotate: (pid 25695) 227s
ok: run: nginx: (pid 27783) 1s
ok: run: node-exporter: (pid 27317) 61s
ok: run: postgres-exporter: (pid 27422) 58s
ok: run: postgresql: (pid 25925) 209s
ok: run: prometheus: (pid 27341) 60s
ok: run: puma: (pid 27704) 16s
ok: run: redis: (pid 25731) 221s
ok: run: redis-exporter: (pid 27332) 60s
ok: run: sidekiq: (pid 26555) 135s
[root@localhost ~]# gitlab-ctl status
run: alertmanager: (pid 27413) 69s; run: log: (pid 27031) 106s
run: gitaly: (pid 27322) 71s; run: log: (pid 25834) 223s
run: gitlab-exporter: (pid 27330) 71s; run: log: (pid 26815) 124s
run: gitlab-kas: (pid 26092) 213s; run: log: (pid 26104) 212s
run: gitlab-workhorse: (pid 27302) 73s; run: log: (pid 26668) 139s
run: logrotate: (pid 25695) 238s; run: log: (pid 25728) 235s
run: nginx: (pid 27865) 2s; run: log: (pid 26682) 138s
run: node-exporter: (pid 27317) 72s; run: log: (pid 26743) 130s
run: postgres-exporter: (pid 27422) 69s; run: log: (pid 27116) 100s
run: postgresql: (pid 25925) 220s; run: log: (pid 25984) 217s
run: prometheus: (pid 27341) 71s; run: log: (pid 26907) 114s
run: puma: (pid 27704) 27s; run: log: (pid 26548) 149s
run: redis: (pid 25731) 232s; run: log: (pid 25804) 229s
run: redis-exporter: (pid 27332) 71s; run: log: (pid 26884) 120s
run: sidekiq: (pid 26555) 146s; run: log: (pid 26577) 143s

9、本机测试启动

[root@localhost ~]# curl http://192.168.158.37
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

10、查看登录密码

[root@localhost ~]# cat /etc/gitlab/initial_root_password##密码是
gni16lOQMifhB2AMG5/owbdY9MIefww+vPQ+LxAhLHk=

11、防火墙开通

sudo firewall-cmd --permanent --add-port={80,443}/tcp
sudo firewall-cmd --reload

12、查看端口是否正常

为了能狗正常访问,需要保证80端口和8080端口没有被占用

查看 80 端口是否被占用

[root@localhost ~]# netstat -anptu | grep nginx
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      29768/nginx         
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3702/nginx: master  
tcp        0      0 192.168.158.37:80       192.168.158.1:65094     ESTABLISHED 3707/nginx: worker  
tcp        0      0 192.168.158.37:80       192.168.158.1:65093     ESTABLISHED 3707/nginx: worker  
tcp6       0      0 :::80                   :::*                    LISTEN      3702/nginx: master  
[root@localhost ~]# systemctl stop nginx

查看 8080 端口是否被占用

[root@localhost ~]# netstat -anptu | grep 8080
tcp        0      0 127.0.0.1:39698         127.0.0.1:8080          ESTABLISHED 27341/prometheus    
tcp6       0      0 :::8080                 :::*                    LISTEN      1110/java           
tcp6       0      0 127.0.0.1:8080          127.0.0.1:39698         ESTABLISHED 1110/java           
[root@localhost ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration ServerLoaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: disabled)Active: active (running) since Mon 2025-09-08 20:08:37 CST; 32min agoMain PID: 1110 (java)Tasks: 47 (limit: 21357)Memory: 97.5M ()CGroup: /system.slice/jenkins.service└─1110 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache>9月 08 20:08:27 localhost jenkins[1110]: Jenkins initial setup is required. An admin user has been created and a>
9月 08 20:08:27 localhost jenkins[1110]: Please use the following password to proceed to installation:
9月 08 20:08:27 localhost jenkins[1110]: e932b96846f1479e96484a7badaed05a
9月 08 20:08:27 localhost jenkins[1110]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
9月 08 20:08:27 localhost jenkins[1110]: *************************************************************
9月 08 20:08:27 localhost jenkins[1110]: *************************************************************
9月 08 20:08:27 localhost jenkins[1110]: *************************************************************
9月 08 20:08:37 localhost jenkins[1110]: 2025-09-08 12:08:37.685+0000 [id=38]        INFO        jenkins.InitRea>
9月 08 20:08:37 localhost jenkins[1110]: 2025-09-08 12:08:37.694+0000 [id=24]        INFO        hudson.lifecycl>
9月 08 20:08:37 localhost systemd[1]: Started Jenkins Continuous Integration Server.[root@localhost ~]# systemctl stop jenkins

登录:http://192.168.158.37

用户名:root

查看登录密码cat /etc/gitlab/initial_root_password

gni16lOQMifhB2AMG5/owbdY9MIefww+vPQ+LxAhLHk=

设置汉化

保存

刷新页面

汉化成功

二、安装部署docker
设置源

sudo tee /etc/yum.repos.d/docker-ce.repo <<-'EOF'
[docker-ce-stable]
name=Docker CE Stable
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
EOF

sudo dnf install -y docker-ce docker-ce-cli containerd.io

sudo systemctl start docker

sudo systemctl enable docker

docker --version

三、下载部署runner


wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm

[root@localhost ~]# wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm
--2025-09-08 21:13:05--  https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm
正在解析主机 gitlab-runner-downloads.s3.amazonaws.com (gitlab-runner-downloads.s3.amazonaws.com)... 3.5.29.101, 3.5.6.112, 52.217.140.57, ...
正在连接 gitlab-runner-downloads.s3.amazonaws.com (gitlab-runner-downloads.s3.amazonaws.com)|3.5.29.101|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:24403200 (23M) [application/x-redhat-package-manager]
正在保存至: “gitlab-runner_amd64.rpm”gitlab-runner_amd64.rpm      100%[============================================>]  23.27M  4.77MB/s  用时 7.6s    2025-09-08 21:13:14 (3.05 MB/s) - 已保存 “gitlab-runner_amd64.rpm” [24403200/24403200])

下载依赖库

sudo yum install -y curl git-core wget tar openssl shim-unsigned-x64

[root@localhost ~]# sudo yum install -y curl git-core wget tar openssl shim
Last metadata expiration check: 0:04:44 ago on 2025年09月08日 星期一 21时11分32秒.
Package curl-8.4.0-19.oe2403sp1.x86_64 is already installed.
Package git-core-2.43.0-9.oe2403sp1.x86_64 is already installed.
Package wget-1.21.4-3.oe2403sp1.x86_64 is already installed.
Package tar-2:1.35-2.oe2403sp1.x86_64 is already installed.
Package openssl-1:3.0.12-15.oe2403sp1.x86_64 is already installed.
Package shim-15.7-16.oe2403sp1.x86_64 is already installed.

安装sudo rpm -ivh --nodeps gitlab-runner_amd64.rpm
 

[root@localhost ~]# sudo rpm -ivh --nodeps gitlab-runner_amd64.rpm
警告:gitlab-runner_amd64.rpm: 头 V4 RSA/SHA512 Signature, 密钥 ID 6ba75a4e: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...1:gitlab-runner-18.3.1-1           ################################# [100%]
GitLab Runner: creating gitlab-runner...
Home directory skeleton not used
Runtime platform                                    arch=amd64 os=linux pid=47588 revision=5a021a1c version=18.3.1
gitlab-runner: the service is not installed
Runtime platform                                    arch=amd64 os=linux pid=47598 revision=5a021a1c version=18.3.1
gitlab-ci-multi-runner: the service is not installed
Runtime platform                                    arch=amd64 os=linux pid=47626 revision=5a021a1c version=18.3.1
Runtime platform                                    arch=amd64 os=linux pid=47701 revision=5a021a1c version=18.3.1Check and remove all unused containers (both dangling and unreferenced)
-----------------------------------------------------------------------
Total reclaimed space: 0B

手动创建 systemd 服务文件

sudo tee /usr/lib/systemd/system/gitlab-runner.service > /dev/null <<'EOF'
[Unit]
Description=GitLab Runner
After=syslog.target network.target[Service]
Type=forking
ExecStart=/usr/bin/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog
ExecReload=/usr/bin/gitlab-runner restart
ExecStop=/usr/bin/gitlab-runner stop
User=gitlab-runner
Group=gitlab-runner
Restart=always[Install]
WantedBy=multi-user.target
EOF

创建用户及授权

sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
sudo mkdir -p /home/gitlab-runner
sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner /etc/gitlab-runner

启动服务
sudo systemctl daemon-reload
sudo systemctl enable --now gitlab-runner
sudo systemctl status gitlab-runner
获取gitlab-runner的token

创建项目  gitlab-xiangmu

项目-设置-ci/cd-runner-复制

服务器注册 Runner,需修改ip,token

注册令牌是:GR1348941MDbf7bqnGsStqxh9q6Y2

sudo gitlab-runner register \--non-interactive \--url "http://192.168.158.37" \--registration-token "GR1348941MDbf7bqnGsStqxh9q6Y2" \--executor "docker" \--docker-image "nginx:latest" \--docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \--docker-privileged \--description "Docker Runner" \--tag-list "docker,prod" \--run-untagged=false

验证,测试

[root@localhost ~]# sudo systemctl restart gitlab-runner
[root@localhost ~]# sudo gitlab-runner list
Runtime platform                                    arch=amd64 os=linux pid=73207 revision=5a021a1c version=18.3.1
Listing configured runners                          ConfigFile=/etc/gitlab-runner/config.toml
Docker Runner                                       Executor=docker Token=t3_Yfq2zL_3QQxtMh6msH3i URL=http://192.168.158.37
[root@localhost ~]#  sudo gitlab-runner verify
Runtime platform                                    arch=amd64 os=linux pid=73385 revision=5a021a1c version=18.3.1
Running in system-mode.                            Verifying runner... is alive                        correlation_id=01K4MXD9FKD4Q2ZB3P8V3XRJ23 runner=Yfq2zL_3Q

四、构建CI/CD

1.构建新分支

新建分支: gitlab-nginx

测试 Runner 是否正常工作

然后提交

提交这个文件到项目,GitLab 会自动触发流水线。如果作业成功完成,说明 Runner 配置成功!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/pingmian/96009.shtml
繁体地址,请注明出处:http://hk.pswp.cn/pingmian/96009.shtml
英文地址,请注明出处:http://en.pswp.cn/pingmian/96009.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实战项目-----在图片 hua.png 中,用红色画出花的外部轮廓,用绿色画出其简化轮廓(ε=周长×0.005),并在同一窗口显示

实战项目实现以下功能&#xff1a;对图片 hua.png 进行轮廓提取&#xff0c;并在同一窗口中完成以下两个绘制操作&#xff1a;用红色画出花的外部轮廓&#xff08;即最外层轮廓&#xff09;用绿色画出该轮廓的近似多边形&#xff0c;其中近似精度参数 ε 设置为轮廓周长的 0.00…

开源鸿蒙北向框架开发:系统服务理论详解

系统服务的启动 基本可以认为&#xff1a;OpenHarmony 的系统服务进程都是“由 init 直接或间接拉起”的。 直接方式&#xff1a; init 按 /system/etc/init/.cfg 启动可执行&#xff08;如 /system/bin/sa_main、/system/bin/samgr 等&#xff09;&#xff0c;这些进程的 PPid…

龙虎榜——20250909

上证指数今天缩量收阴线&#xff0c;跌破10日均线&#xff0c;目前日线总体处于高位宽幅震荡中&#xff0c;小级别暂未明确方向&#xff0c;指数面临方向选择&#xff0c;需要注意高位股的风险。 深证指数今天缩量收阴线&#xff0c;跌破5日均线&#xff0c;接下来几天方向的选…

基于dijkstra算法的WSN网络MAC协议matlab仿真,分析网络延迟与网络开销

目录 1.程序功能描述 2.测试软件版本以及运行结果展示 3.部分程序 4.算法理论概述 5.完整程序 1.程序功能描述 无线传感器网络&#xff08;WSN, Wireless Sensor Network&#xff09;是由大量低成本、低功耗的传感器节点组成&#xff0c;通过无线通信实现数据采集、传输与…

ES数据库启动时可以设置1G一下内存吗

可以&#xff0c;但强烈不建议在生产环境中这样做。ES 7.0 版本确实可以设置小于 1GB 的堆内存&#xff0c;但这会带来严重的性能问题和稳定性风险。 快速回答 # 最小化配置示例 - 仅用于测试或开发环境 export ES_JAVA_OPTS"-Xms512m -Xmx512m" ./bin/elasticsearch…

TI-92 Plus计算器:单位换算功能介绍

1 TI-92 Plus计算器&#xff1a;单位换算功能介绍 TI-92 Plus 内置了全面的单位换算功能&#xff0c;支持长度、质量、时间、温度、面积、体积、速度等数十种物理量的单位转换&#xff0c;操作直观&#xff0c;无需手动输入换算系数。以下是具体使用方法、示例及功能特点&#…

雪球科技Java开发工程师笔试题

单选 1.下列哪些语句关于内存回收的说明是正确的?( C ) A.内存回收程序允许程序员直接释放内存 B.程序员必须创建一个线程来释放内存 C.内存回收程序负责释放无用内存 D.内存回收程序可以在指定的时间释放内存对象 2.以下哪项不是Java基础类型(A) A.String B.int C.b…

NV3041A-01芯片屏幕

1. 核心概览这是一款集成了电源管理、显示内存&#xff08;RAM&#xff09;、时序控制等多种功能的单片显示驱动芯片&#xff08;通常称为Driver IC&#xff09;。它采用COG&#xff08;Chip-On-Glass&#xff09; 工艺&#xff0c;直接将芯片绑定在玻璃基板上&#xff0c;使得…

aiagent知识点

一、MCP (Model Context Protocol) 1. 核心概念是什么&#xff1a;MCP是一个开放协议&#xff0c;用于在应用&#xff08;如IDE、Agent&#xff09; 和工具/数据源&#xff08;如服务器、数据库&#xff09; 之间建立标准化的通信。目标&#xff1a;解决AI工具生态的碎片化问题…

第2节-过滤表中的行-WHERE

摘要&#xff1a;在本教程中&#xff0c;您将学习如何使用 PostgreSQL 的 WHERE 子句来筛选表中的行。 PostgreSQL WHERE 子句 SELECT FROM 语句从表中所有行的一个或多个列中查询数据。实际上&#xff0c;你经常需要选择满足某个条件的行。 要根据条件从表中筛选行&#xf…

IACheck赋能AI环评报告审核,推动环保设备制造行业发展

在“双碳目标”和绿色制造的背景下&#xff0c;环保设备制造行业正在迎来快速发展。然而&#xff0c;环评报告作为项目合规的“通行证”&#xff0c;却一直是企业最头疼的环节之一&#xff1a;编写复杂、审核周期长、错误率高。传统的审核模式不仅耗时耗力&#xff0c;还容易出…

常见的多态

一、核心概念多态&#xff08;Polymorphism&#xff09; 的字面意思是“多种形态”。在Java中&#xff0c;它指的是&#xff1a;同一个行为&#xff08;方法&#xff09;具有多个不同表现形式或形态的能力。更具体地说&#xff0c;它允许你&#xff1a;父类的引用指向子类的对象…

20250909_排查10.1.1.190档案库房综合管理系统20250908备份缺失问题+优化scp脚本(把失败原因记录进日志)并测试脚本执行情况

目录 一、现象(图中现象) 二、可能原因 1、本地源文件没生成(最可能原因) 2、清理逻辑误删 三、时间同步检查 1、运行命令查看当前时间源:w32tm /query /source 2、修改为内网 NTP 服务器 10.1.10.251: 四、脚本优化 1、scp.bat vs roboscp.bat 对比表 2、robo…

OpenHarmony之有源NFC-connected_nfc_tag模块详解

1. 模块概述 Connected NFC Tag模块是OpenHarmony NFC子系统的一部分,专门用于处理有源NFC标签的读写操作。与基础NFC模块不同,该模块专注于与已连接的有源NFC标签进行交互,提供更高层次的API供应用层使用。 设备必须具备有源NFC标签芯片,才能使用有源NFC标签的读和写服务…

MySql案例详解之事务

下面我会从“事务是什么”→“为什么需要事务”→“事务的四大特性&#xff08;ACID&#xff09;”→“MySQL中怎么用事务”→“常见坑与调试技巧”→“完整实战案例&#xff08;含代码、输出、讲解&#xff09;”六个层次&#xff0c;给你一个“看完就能上手”的MySQL事务速查…

Linux之环境变量(内容由浅入深,层层递进)

一、概念介绍&#xff08;来源&#xff1a;比特就业课&#xff09;环境变量一般是指在操作系统中用来指定操作系统运行环境的一些参数环境变量通常具有某些特殊用途&#xff0c;并且在系统中通常具有全局特性二、现象引入与解答 1.为什么像ls这样的系统指令可以直接执行&#x…

监控 Linux 服务器资源

使用 Bash 脚本监控 Linux 服务器资源并发送告警邮件前言一、&#x1f6e0;️ 脚本功能概览二、 &#x1f4dc; 脚本核心逻辑分解2.1. 变量初始化2.2. CPU 使用率监控2.3. 内存使用率监控2.4. 磁盘使用率监控2.5. 磁盘 IO 延迟监控&#xff08;await&#xff09;2.6. 网络流量监…

随机获取数组内任意元素

Math.random() * arr.length 是 JavaScript 中常用的表达式&#xff0c;用于生成一个范围在 [0, arr.length) 之间的随机浮点数&#xff08;包含 0&#xff0c;但不包含数组长度本身&#xff09;。 作用说明&#xff1a; Math.random() 生成一个 [0, 1) 区间的随机浮点数&#…

android studio gradle 访问不了

1.通过国内镜像站 2.通过本地部署 参考这个搞定 https://blog.csdn.net/2401_82819685/article/details/144542784

科普:企业微信的第三方应用涉及的“配置应用权限”

企业微信的第三方应用涉及“配置应用权限”&#xff0c;它在不同阶段含义不同&#xff1a;开发阶段意指应用自身所需的功能权限&#xff0c;安装阶段意指企业管理员对应用使用范围的控制&#xff0c;产生此歧义的问题&#xff0c;归根到低还是语言的缩写问题&#xff0c;设想一…