首页 > 系统相关 >Centos安装最新稳定版Jenkins

Centos安装最新稳定版Jenkins

时间:2024-03-19 14:45:07浏览次数:30  
标签:稳定版 lib Centos Environment jenkins Jenkins JENKINS listen

CentOS7.9安裝Jenkins

参考jenkins官网文档进行安装,Jenkins download and deployment

  sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
  sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
  yum install fontconfig java-11-openjdk
  yum install jenkins

启动Jenkins

参考jenkins官网执行启动命令,Linux (jenkins.io)

sudo systemctl start jenkins

參考Jenkins官方文档、安装后执行启动命令、报错: Failed to start Jenkins Continuous Integration Server.

解决Jenkins启动报错

使用systemctl 启动时不会使用上述的etc/init.d/jenkins配置文件。
而是会使用/usr/lib/systemd/system/jenkins.service文件,
需要修改/usr/lib/systemd/system/jenkins.service文件配置
使用vim打开/usr/lib/systemd/system/jenkins.service文件,修改成如下配置

# Unix account that runs the Jenkins daemon
# Be careful when you change this, as you need to update the permissions of
# $JENKINS_HOME, $JENKINS_LOG, and (if you have already run Jenkins)
# $JENKINS_WEBROOT.
User=root
Group=root
# The Java home directory. When left empty, JENKINS_JAVA_CMD and PATH are consulted.
Environment="JAVA_HOME=/usr/lib/jvm/jre-11-openjdk"

修改完成,使用:qw保存退出,此时jenkins.service已在磁盘上更改。运行“systemctl daemon reload”以重新加载单元。

systemctl daemon reload

重新加载单元后,运行Jenkins

sudo systemctl start jenkins

访问Jenkins

http://{你的ip}:8080进行访问,打开/var/lib/jenkins/secrets/initialAdminPassword文件查询密码,进入
相关截图参考
image
/usr/lib/systemd/system/jenkins.service 文件修改整体配置:

#
# This file is managed by systemd(1). Do NOT edit this file manually!
# To override these settings, run:
#
#     systemctl edit jenkins
#
# For more information about drop-in files, see:
#
#     https://www.freedesktop.org/software/systemd/man/systemd.unit.html
#

[Unit]
Description=Jenkins Continuous Integration Server
Requires=network.target
After=network.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/bin/jenkins
Restart=on-failure
SuccessExitStatus=143

# Configures the time to wait for start-up. If Jenkins does not signal start-up
# completion within the configured time, the service will be considered failed
# and will be shut down again. Takes a unit-less value in seconds, or a time span
# value such as "5min 20s". Pass "infinity" to disable the timeout logic.
#TimeoutStartSec=90

# Unix account that runs the Jenkins daemon
# Be careful when you change this, as you need to update the permissions of
# $JENKINS_HOME, $JENKINS_LOG, and (if you have already run Jenkins)
# $JENKINS_WEBROOT.
User=root
Group=root

# Directory where Jenkins stores its configuration and workspaces
Environment="JENKINS_HOME=/var/lib/jenkins"
WorkingDirectory=/var/lib/jenkins

# Location of the Jenkins WAR
#Environment="JENKINS_WAR=/usr/share/java/jenkins.war"

# Location of the exploded WAR
Environment="JENKINS_WEBROOT=%C/jenkins/war"

# Location of the Jenkins log. By default, systemd-journald(8) is used.
#Environment="JENKINS_LOG=%L/jenkins/jenkins.log"

# The Java home directory. When left empty, JENKINS_JAVA_CMD and PATH are consulted.
Environment="JAVA_HOME=/usr/lib/jvm/jre-11-openjdk"

# The Java executable. When left empty, JAVA_HOME and PATH are consulted.
#Environment="JENKINS_JAVA_CMD=/etc/alternatives/java"

# Arguments for the Jenkins JVM
Environment="JAVA_OPTS=-Djava.awt.headless=true"

# IP address to listen on for HTTP requests.
# The default is to listen on all interfaces (0.0.0.0).
#Environment="JENKINS_LISTEN_ADDRESS="

# Port to listen on for HTTP requests. Set to -1 to disable.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
Environment="JENKINS_PORT=8080"

# IP address to listen on for HTTPS requests. Default is disabled.
#Environment="JENKINS_HTTPS_LISTEN_ADDRESS="

# Port to listen on for HTTPS requests. Default is disabled.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
#Environment="JENKINS_HTTPS_PORT=443"

# Path to the keystore in JKS format (as created by the JDK's keytool).
# Default is disabled.
#Environment="JENKINS_HTTPS_KEYSTORE=/path/to/keystore.jks"

# Password to access the keystore defined in JENKINS_HTTPS_KEYSTORE.
# Default is disabled.
#Environment="JENKINS_HTTPS_KEYSTORE_PASSWORD=s3cR3tPa55w0rD"

# IP address to listen on for HTTP2 requests. Default is disabled.
#Environment="JENKINS_HTTP2_LISTEN_ADDRESS="

# HTTP2 port to listen on. Default is disabled.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
#Environment="JENKINS_HTTP2_PORT="

# Controls which capabilities to include in the ambient capability set for the
# executed process. Takes a whitespace-separated list of capability names, e.g.
# CAP_SYS_ADMIN, CAP_DAC_OVERRIDE, CAP_SYS_PTRACE. Ambient capability sets are
# useful if you want to execute a process as a non-privileged user but still
# want to give it some capabilities. For example, add the CAP_NET_BIND_SERVICE
# capability to be able to listen on privileged ports (port numbers less than
# 1024).
#AmbientCapabilities=CAP_NET_BIND_SERVICE

# Debug level for logs. The higher the value, the more verbose. 5 is INFO.
#Environment="JENKINS_DEBUG_LEVEL=5"

# Set to true to enable logging to /var/log/jenkins/access_log.
#Environment="JENKINS_ENABLE_ACCESS_LOG=false"

# Servlet context (important if you want to use reverse proxying)
#Environment="JENKINS_PREFIX=/jenkins"

# Arbitrary additional arguments to pass to Jenkins.
# Full option list: java -jar jenkins.war --help
#Environment="JENKINS_OPTS="

# Maximum core file size. If unset, the value from the OS is inherited.
#LimitCORE=infinity

# Maximum file size. If unset, the value from the OS is inherited.
#LimitFSIZE=infinity

# File descriptor limit. If unset, the value from the OS is inherited.
#LimitNOFILE=8192

# Maximum number of processes. If unset, the value from the OS is inherited.
#LimitNPROC=32768

# Set the umask to control the permission bits of files that Jenkins creates.
#
# 0027 makes files read-only for group and inaccessible for others, which some
# security sensitive users might consider beneficial, especially if Jenkins
# is running on a server that is used for multiple purposes. Beware that 0027
# permissions would interfere with sudo scripts that run on the controller
# (see JENKINS-25065).
#
# Note also that the particularly sensitive parts of $JENKINS_HOME (such as
# credentials) are always written without 'other' access. So the umask values
# only affect job configuration, build records, etc.
#
# If unset, the value from the OS is inherited, which is normally 0022.
# The default umask comes from pam_umask(8) and /etc/login.defs.
#UMask=0022

[Install]
WantedBy=multi-user.target

标签:稳定版,lib,Centos,Environment,jenkins,Jenkins,JENKINS,listen
From: https://www.cnblogs.com/heyangyi/p/18082795

相关文章

  • Centos安装配置Java8
    查看Centos发行版本[root@lavm-ik3g4r3pga~]#cat/etc/redhat-releaseCentOSLinuxrelease7.9.2009(Core)查看java8安装包[root@lavm-ik3g4r3pga~]#yumlistjava-1.8*Loadedplugins:fastestmirrorRepositorybaseislistedmorethanonceintheconfiguration......
  • CentOS开启防火墙及开放指定端口
    查看防火墙状态systemctlstatusfirewalld启动防火墙systemctlstartfirewalld停止防火墙systemctlstopfirewalld查看防火墙已经开放的端口firewall-cmd--list-port添加开放指定端口firewall-cmd--zone=public--add-port=这里是需要开启的端口号/tcp--perman......
  • CentOS7防火墙
    提示修改防火墙配置文件之前,需要对之前防火墙规则做好备份重启防火墙后,需要确认防火墙状态和防火墙规则是否加载,若重启失败或规则加载失败,则所有请求都会被防火墙拒绝firewalld服务管理显示服务的状态systemctlstatusfirewalld.service启动服务systemctlstartfirewal......
  • CentOS 执行sudo命令提示“XXX不在 sudoers 文件中“问题处理
    方法一:将用户添加到sudoers文件中定义的sudo组中切换到root用户,执行命令usermod-aGwheel,为要授予其权限的用户的名称使用su-命令切换到原来的用户(或使用reboot命令重启一下系统)。测试sudo访问权限,执行sudowhoami命令如果用户有sudo访问权限,该命令将打印“root”......
  • jenkins前端部署
    下载插件NodeJSPlugin(nodejs环境)PublishoverSSH(用于执行构建后的操作)GiteePlugin(由于我用的是gitee管理代码,所以需要安装)2。a.新建项目名称b.配置源码管理(Git仓库)c.配置购置触发器d.配置构建环境(node及npm)e.配置构建(写shell脚本)source/etc/profile:加载环......
  • Jenkins+Gradle持续集成之Jenkins的安装配置自动化打包
    来源:https://www.jianshu.com/p/b6d6cd597014一、工具准备官方网站:http://jenkins-ci.org/,我的系统是win10的,所以我选择的是红色圈起的Windos版的;另外一种是war包的,下载地址:http://mirrors.jenkins-ci.org/war/latest/jenkins.war Paste_Image.png二、准备安装前提......
  • jenkins与gradle与sonar集成自动化打包代码检测
    来源:https://juejin.cn/post/6844903536061317133服务器以ubuntu操作系统,服务器上已经安装jenkins,sonar服务,并且正常启动访问。本人主要介绍gitlab,fir与sonar如何与jenkins进行集成安装gradle插件并且配置ANROID_HOME,jdk,gradle路径Jenkins->系统管理->可选插件->......
  • CentOS安装JDK17教程(完整版)
    JDK17是JavaDevelopmentKit(Java开发工具包)的第17个长期支持(LTS)版本,由Oracle公司于2021年9月发布。作为Java语言的主要发行版,JDK17带来了许多新特性、增强功能和优化。但是我们在Linux环境下使用yum安装时,发现不能直接安装JDK17,使用:yumsearchjava|grep......
  • centos8 --上yum无法使用的问题以及无法用yum安装screen,iftop,nethogs等的解决办法
    centos8--上yum无法使用的问题以及无法用yum安装screen,iftop,nethogs等的解决办法大家可能都发现了centos8已经不在更新了。当我们使用yum安装某些工具的时候,会提示安装源失败解决方案:删除repo文件然后重新下载即可修复yum安装报错问题1.进入/etc/yum.repos.d/目录cd/etc......
  • ubuntu系统Jenkins + Gitlab 集成 实现CI\CD (配置前后端)
    官网地址:Linux首先配置jdk17的环境,jenkins依附于java安装gitaptinstallgit更新aptupdate安装jdk17aptinstallopenjdk-17-jdkvim/etc/profileexportJAVA_HOME=/usr/local/java/exportJRE_HOME=$JAVA_HOME/jreexportCLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib......