linux部署jenkins,支持jdk1.8

无废话,纯干活安装指令
本文前提条件需安装jdk8,安装参考:Linux配置jdk环境

下载资源

# 创建安装目录
mkdir -p /data/jenkins && cd /data/jenkins

# 下载jenkins的war包,v2.346.x支持jdk1.8,高于这个版本的最低都jdk11起步
wget http://mirrors.jenkins.io/war-stable/2.346.3/jenkins.war

快捷脚本

# 创建脚本
vim restart-jenkins.sh
#!/bin/sh
# Description: restart jenkins and kill old jenkins process
# Author: 954L
# Date: 2024-02-20

pid=$(pgrep -f jenkins.war)
if [ -n "$pid" ]; then
    kill $pid
    if [ $? -eq 0 ]; then
        echo "kill jenkins process success, wait ten second"
	sleep 3
    else
        echo "failed to kill jenkins process"
    fi
else
    echo "no jenkins process found"
fi

nohup java -jar jenkins.war --httpPort=9095 > console.log &
echo "start jenkins success\nprint jenkins logs on line"
tail -f console.log

9095:自定义jenkins的web端口

执行脚本

# 赋予可执行权限
chmod +x restart-jenkins.sh
# 启动jenkins
./restart-jenkins.sh

# 看到如下内容表示启动成功
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/hyuser/.jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2024-02-20 03:36:09.059+0000 [id=30]	INFO	jenkins.install.SetupWizard#init: 

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

# 安装密钥
xxxxxxxxxxxxxxxxxxxxxxx

This may also be found at: /home/hyuser/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

访问地址:http://ip:9095

解决jenkins安装插件提示低版本问题

系统管理 > 插件管理 > 高级

url修改为:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/dynamic-2.346/update-center.json

修改配置文件

# 查找jenkins配置文件路径
find / -name default.json
# 备份
cp default.json default.json.bak
# 下载清华配置文件
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/dynamic-2.346/update-center.json
# 改名
mv update-center.json default.json
# 重启jenkins
cd /data/jenkins && sh restart-jenkins.sh

相关推荐

  1. Ubuntu安装部署Oracle-JDK11

    2024-02-21 11:48:02       25 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-21 11:48:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-21 11:48:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-21 11:48:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-21 11:48:02       20 阅读

热门阅读

  1. 浙大版C语言题目集-函数题6

    2024-02-21 11:48:02       32 阅读
  2. uniapp 放大中间图标

    2024-02-21 11:48:02       33 阅读
  3. SpringBoot整理-Actuator

    2024-02-21 11:48:02       30 阅读
  4. 2024年云计算环境下安全好用的堡垒机推荐

    2024-02-21 11:48:02       30 阅读
  5. Json详解

    2024-02-21 11:48:02       25 阅读
  6. 基于Spring Boot的多级缓存系统设计

    2024-02-21 11:48:02       24 阅读
  7. redis相关面试题

    2024-02-21 11:48:02       35 阅读
  8. python Opencv 中绘制图

    2024-02-21 11:48:02       28 阅读
  9. C语言学习第三十天(排序)

    2024-02-21 11:48:02       30 阅读
  10. 从零开始学HCIA之广域网技术02

    2024-02-21 11:48:02       28 阅读