安装之前注意jenkins和jdk的版本。2022年7月2日起,jenkins新版本不再支持java8,仅支持java11和java17。安装步骤如下:
1、下载jdk
https://www.oracle.com/java/technologies/downloads/#java17
下载安装包:jdk-17_linux-x64_bin.tar.gz
下载可能要登陆oracle账号:[email protected] 密码:xxxxx
2、将压缩包 jdk-17_linux-x64_bin.tar.gz 放在此目录下/usr/local
3、解压安装包,并改名为jdk17
tar -zxvf jdk-17_linux-x64_bin.tar.gz
4、修改/etc/profile文件
JAVA_HOME=/usr/local/jdk17 PATH=$JAVA_HOME/bin:$PATH:${MAVEN_HOME}/bin:$PATH CLASSPATH=$JAVA_HOME/lib:$CLASSPATH export PATH JAVA_HOME CLASSPATH MAVEN_HOME
5、更新环境变量:source /etc/profile
6、查看版本:java -version
注意不是:java --version
二、安装jenkins
1、下载安装包
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certifica
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
2、安装
yum install jenkins
3、修改端口
vim /etc/sysconfig/jenkins
修改参数:JENKINS_PORT="8888"
4、配置权限,修改为root
vim /etc/sysconfig/jenkins
#修改配置
JENKINS_USER="root"
修改目录权限
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
4、修改jenkins配置的JKD路径
vim /etc/init.d/jenkins
修改参数:/usr/bin/java 为 /usr/local/jdk17/bin/java
5、启动jenkins
systemctl start jenkins
6、查看是否成功
systemctl status jenkins.service
7、开防火墙端口:8888
firewall-cmd --permanent --zone=public --add-port=8899/tcp systemctl restart firewalld.service 三、启动jenkins 四、构建.netcore任务,并打包为镜像上传到harbor标签:bin,HOME,--,root,etc,Linux,jenkins,安装 From: https://www.cnblogs.com/zhengwei-cq/p/17758846.html