OpenEuler安裝gitlab,部署gitlab-runner

目錄

一、安裝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;設想一…