CentOS 7 安装 Jenkins过程详解
Jenkins是一个开源的、基于Java开发的持续集成工具,它可以从代码库自动获取用户的最新代码,执行构建任务,并部署到测试或生产环境,本文将详细介绍在CentOS 7上安装Jenkins的过程。
安装JDK
Jenkins需要Java环境才能运行,因此在安装Jenkins之前,我们需要先安装JDK。
1、更新系统软件包:
sudo yum update -y
2、安装OpenJDK:
sudo yum install java-1.8.0-openjdk-devel -y
3、验证JDK是否安装成功:
java -version
安装Maven
Maven是Java项目构建工具,Jenkins可以与Maven集成,因此我们需要安装Maven。
1、下载Maven:
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
2、解压Maven:
tar -zxvf apache-maven-3.6.3-bin.tar.gz
3、配置环境变量:
export MAVEN_HOME=/path/to/apache-maven-3.6.3 export PATH=$PATH:$MAVEN_HOME/bin
4、验证Maven是否安装成功:
mvn -version
安装Jenkins
1、下载Jenkins:
wget http://mirrors.tuna.tsinghua.edu.cn/jenkins/war-stable/latest/jenkins.war
2、启动Jenkins:
java -jar jenkins.war --httpPort=8080 --daemon --prefix=/jenkins --noCertificateCheck --allowRemoteRootAccess --useLocalCacheDir=false --listenAddress=0.0.0.0 --webroot="${IROOT}/jenkins" --daemonize --name=myjenkins --logfile="${IROOT}/jenkins/jenkins.log" --mode=master --installUtility="${IROOT}/jenkins/jenkins.install.InstallUtility.sh" --adminUserName=admin --adminPassword=admin123 --httpInterface=org.eclipse.jetty.server.Server --warFile="/path/to/jenkins.war" --daemonMode=true --handlerCountMax=500 --handlerCountMaxIdle=200 --handlerCountMaxActive=500 --maxThreads=200 --systemMessage="Welcome to Jenkins!" --preferredClassLoader=java.net.URLClassLoader --pluginManagerStrategy=default --workDir="${IROOT}/jenkins" --launcherType=simple --unpackWARs=true --command="/usr/local/bin/gosu jenkins java ${JAVA_OPTS} -Dhudson.DNSMultiCast.disabled=true -Dhudson.DNSMultiCastMasterAddress=${JENKINS_SLAVE_AGENT_NAME} -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "${HUDSON_HOME}/jenkins.war" --httpPort=8080" --envVars="LANG=en_US.UTF-8,TZ=Asia/Shanghai" --daemonHome="${IROOT}/jenkins" --home="${IROOT}/jenkins" --parentProcessesOnly=false --inheritIO=true --killWhenUnneeded=true --properties="hudson.model.UpdateSite=https://updates.jenkins-ci.org/update-center;hudson.model.DownloadService.managerUrl=https://updates.jenkins-ci.org/download/plugins/;hudson.securityRealm.lockoutThreshold=0;hudson.securityRealm.enableAutoLockout=false;hudson.securityRealm.key=abcdefghijklmnopqrstuvwxyz;hudson.securityRealm.secretKey=abcdefghijklmnopqrstuvwxyz;hudson.slaves.reconnectionDelay=300;hudson.model.SlaveComputer$SlaveAgentProtocolListener=-1;hudson.model.SlaveComputer$SlaveAgentProtocolVersion=-1;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$PomLoaderImpl$PomRetriever$PomNotFoundExceptionStrategy=INCLUDE_PLUGINS;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginLookupStrategy=LEGACY_FIRST;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginCandidatesStrategy=FASTEST;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginInstallationStrategy=CLEAN_UP;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginWrapperStrategy=WRAPPER;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginVersionComparatorStrategy=LATEST_ONLY;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginVersionStrategy=LATEST_ONLY;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginCategoryStrategy=FIXED;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginCategoryFilterStrategy=ALL;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginDependencyStrategy=FIXED;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginDescriptorFilterStrategy=ALL;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginDescriptorStrategy=FIXED;hudson.model.UpdateSite$UpdateSiteMonitor$PluginManagerImpl$DefaultPluginManagerImpl$PluginInstallationFailedExceptionStrategy=TERMINATE_EXECUTION;hudson." />
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/328500.html