root@iZf8ze6huh0b9fb34f8xbgZ:/var/log/jenkins# ps -ef | grep java
1000 19439 19409 0 2024 pts/0 00:18:56 java -Duser.home=/var/jenkins_home -Djenkins.model.Jenkins.slaveAgentPort=50000 -Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle -jar /usr/share/jenkins/jenkins.war
root 987895 1 0 00:28 ? 00:03:48 /home/tools/java/jdk1.8.0_281/bin/java -Djava.ext.dirs=/home/tools/java/jdk1.8.0_281/jre/lib/ext:/home/tools/java/jdk1.8.0_281/lib/ext -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xloggc:/home/tools/nacos2.0.3/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/home/tools/nacos2.0.3/nacos/plugins/health,/home/tools/nacos2.0.3/nacos/plugins/cmdb -Dnacos.home=/home/tools/nacos2.0.3/nacos -jar /home/tools/nacos2.0.3/nacos/target/nacos-server.jar --spring.config.additional-location=file:/home/tools/nacos2.0.3/nacos/conf/ --logging.config=/home/tools/nacos2.0.3/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root 1020735 1020612 0 17:18 pts/0 00:00:00 grep --color=auto java
卸载-----------------------------------------------
停止Jenkins服务:
sudo systemctl stop jenkins
apt-get remove --purge jenkins
删除Jenkins的配置文件和数据目录(可选,如果你想彻底删除Jenkins):
rm -rf /var/lib/jenkins
rm -rf /etc/jenkins
清理可能遗留的Jenkins包:
apt-get autoremove
卸载-----------------------------------------------
安装-----------------------------------------------------------------------
apt install openjdk-17-jdk
java -version
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
apt-get install jenkins
## 查看状态 systemctl status jenkins
## 查看进程信息 ps -ef |grep jenkins
# 查询开启的端口 sudo ufw status # 打开8080端口 sudo ufw allow 8080
## 重新加载配置文件 sudo systemctl daemon-reload ## 重启 Jenkins sudo systemctl restart jenkins
安装-----------------------------------------------------------------------
报错:
root@iZf8ze6huh0b9fb34f8xbgZ:/var# systemctl status jenkins
× jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2025-01-10 17:26:21 CST; 1min 10s ago
Process: 1022335 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 1022335 (code=exited, status=1/FAILURE)
CPU: 9ms
Jan 10 17:26:21 iZf8ze6huh0b9fb34f8xbgZ systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 5.
Jan 10 17:26:21 iZf8ze6huh0b9fb34f8xbgZ systemd[1]: jenkins.service: Start request repeated too quickly.
Jan 10 17:26:21 iZf8ze6huh0b9fb34f8xbgZ systemd[1]: jenkins.service: Failed with result 'exit-code'.
Jan 10 17:26:21 iZf8ze6huh0b9fb34f8xbgZ systemd[1]: Failed to start jenkins.service - Jenkins Continuous Integration Server.
root@iZf8ze6huh0b9fb34f8xbgZ:/usr/lib/systemd/system# jenkins --version
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: executable/Main has been compiled by a more recent version of the Java Runtime (class file version 55.0),
this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
apt install openjdk-17-jdk
dpkg -L openjdk-17-jdk
/usr/lib/jvm/java-17-openjdk-amd64
vi /etc/profile
source /etc/profile
在Ubuntu系统上重启Jenkins服务,你可以使用以下命令:
systemctl restart jenkins
root@iZf8ze6huh0b9fb34f8xbgZ:/usr/lib/jvm/java-17-openjdk-amd64/bin# systemctl restart jenkins
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xeu jenkins.service" for details.
Failed to start jenkins.service - Jenkins Continuous Integration Server.
查看具体日志:
journalctl -u jenkins.service
6]: Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
Jan 10 17:58:39 iZf8ze6huh0b9fb34f8xbgZ jenkins[1025206]: at Jenkins Main ClassLoader//org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)