☰
gitlab与Jenkins
2026/10/22 13:13:14 网站建设 项目流程

一、gitlab

1.获得gitlab安装包

官方包地址:https://packages.gitlab.com/gitlab/gitlab-ce

2.安装依赖性

[root@code-node LLJ]# dnf install -y curl policycoreutils-python-utils openssh-server perl

3.安装软件

[root@code-node ~]# rpm -ivh gitlab-ce-19.4.0-ce.0.el9.x86_64.rpm

4.途中提示代码Please configure a URL for your GitLab instance by setting `external_url`configuration in /etc/gitlab/gitlab.rb file.

[root@code-node ~]# vim /etc/gitlab/gitlab.rb #修改IP地址

5.生效配置文件并开启gitlab

[root@code-node ~]# gitlab-ctl reconfigure

6.查看初始密码

[root@code-node ~]# cat /etc/gitlab/initial_root_password

7.访问并且输入初始密码登录

8.设置时区与语言,密码

9.在主机里生成密钥

[root@code-node ~]# ssh-keygen
[root@code-node ~]# ls .ssh/
[root@code-node ~]# cat .ssh/id_ed25519.pub#查看公钥

10.上传公钥


11.下载项目

12.模拟代码集成

[root@code-node LLJ]# git remote -v#查看已经绑定的远程仓库
[root@code-node LLJ]# git remote add origin http://172.25.254.30/root/llj.git#HTTP 模式
[root@code-node LLJ]# git remote remove origin#先删掉原来http的origin
[root@code-node LLJ]# git remote add origin git@172.25.254.30:root/llj.git#添加ssh地址(GitLab页面复制ssh链接)
[root@code-node LLJ]# git push -u origin master#推送
[root@code-node LLJ]# git branch -m master main#分支改名
git pull origin main --allow-unrelated-histories#允许合并无关历史

二、jenkins


1.jenkins安装

[root@jenkins yum.repos.d]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/rpm/jenkins.repo
[root@jenkins yum.repos.d]# dnf install fontconfig java-21-openjdk
[root@jenkins yum.repos.d]# dnf install jenkins
[root@jenkins yum.repos.d]# systemctl enable --now jenkins
[root@jenkins yum.repos.d]# cat /var/lib/jenkins/secrets/initialAdminPassword
5c86bea9b15b45dbb8f0a0497b5bcca2

2.接下来访问网址+8080端口

下载所需要的插件在/var/lib/jenkins/plugins里

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询