jenkins+gitlab CICD
1.下载jenkins安装环境所需要的jdk
yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel.x86_64
ls -lrt /usr/bin/java
cat <<'EOF' > /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-0.el7_9.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
EOF
source /etc/profile
2.下载安装jenkins
使用清华yum源进行下载
https://mirrors.tuna.tsinghua.edu.cn/
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.332.4-1.1.noarch.rpm
直接安装
[root@ceph-234-21 ~]# systemctl start jenkins
[root@ceph-234-21 ~]# systemctl enable jenkins
[root@ceph-234-21 ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
Active: activating (start) since Wed 2022-08-10 14:39:22 CST; 23s ago
Main PID: 2888 (java)
Tasks: 49
Memory: 636.5M
CGroup: /system.slice/jenkins.service
└─2888 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: Jenkins initial setup is required. An admin user has been created and a password generated.
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: Please use the following password to proceed to installation:
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: 614b240f42eb48258c6bef549d46c6cb ###jenkins初始化密码
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
Aug 10 14:39:27 ceph-234-21 jenkins[2888]: *************************************************************
安装完成 端口8080
3.下载安装gitlab
使用清华yum源
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.11-ce.0.el7.x86_64.rpm
[root@ceph-234-21 ~]# yum install gitlab-ce-13.1.11-ce.0.el7.x86_64.rpm
Installing : gitlab-ce-13.1.11-ce.0.el7.x86_64 1/1
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Verifying : gitlab-ce-13.1.11-ce.0.el7.x86_64 1/1
Installed:
gitlab-ce.x86_64 0:13.1.11-ce.0.el7
Complete!
- 重点
- Please configure a URL for your GitLab instance by setting
external_url
- Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
[root@ceph-234-21 ~]# vim /etc/gitlab/gitlab.rb
[root@ceph-234-21 ~]# gitlab-ctl reconfigure
Running handlers:
Running handlers complete
Chef Client finished, 562/1523 resources updated in 02 minutes 40 seconds
gitlab Reconfigured!
4.启动jenkins和gitlab
jenkins启动
gitlab启动
不知道怎么回事 jenkins配置文件里面改不了端口
然后就这样启动了
/usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=18080 >/tmp/jenkins.out 2>&1 &
nohup java -jar jenkins.war --httpPort=9000 >/tmp/jenkins.out 2>&1 &