centos6 安装 jenkins2.7

一、java安装

1、到官网下载

jdk-8u131-linux-x64.tar.gz

官网地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2、解压安装包,重命名为jdk

[root@QIANZI-BASE home]# tar -zvxfjdk-8u131-linux-x64.tar.gz

[root@QIANZI-BASE home]# mv jdk1.8.0_131jdk

3、安装jdk到/usr/local/

[root@QIANZI-BASE home]# mv jdk /usr/local/

[root@QIANZI-BASE home]# cd /usr/local/

4、配置环境变量

[root@QIANZI-BASE local]# vim /etc/profile

 

在文件尾添加:

export JAVA_HOME=/usr/local/jdk

export JRE_HOME=/usr/local/jdk/jre

exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

exportPATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

5、使立即生效

source /etc/profile

6、验证

[root@QIANZI-BASE local]# java -version

java version "1.8.0_131"

Java(TM) SE Runtime Environment (build1.8.0_131-b11)

Java HotSpot(TM) 64-Bit Server VM (build25.131-b11, mixed mode)

 

ln -s /usr/local/java/bin/java/usr/bin/java

二、下载jenkins rpm包

1、下载安装

wget http://mirrors.jenkins-ci.org/redhat-stable/jenkins-2.7.2-1.1.noarch.rpm

rpm -ivh jenkins-2.7.2-1.1.noarch.rpm

chkconfig --list Jenkins

/etc/init.d/jenkins start

java -jar /usr/lib/jenkins/jenkins.war--httpPort=80  建议使用

netstat -ntlup |grep java

ps -ef |grep Jenkins

2、访问配置

http://192.168.201.65/

nkins secrets]# cat/root/.jenkins/secrets/initialAdminPassword

20bb79eebd794c35a6ea09d07417f86d

这里选择安装插件

安装插件

3、创建管理员

admin ******


4、登录http://192.168.201.65/

三、配置维护

1、修改端口

vi/etc/sysconfig/jenkins
找到JENKINS_PORT="8080"将端口修改成自己的端口。

 

报错

WARNING: FAILEDorg.eclipse.jetty.server.Server@28261e8e: java.net.SocketException: Permissiondenied

java.net.SocketException: Permission denied

找到jenkins.war包

直接运行

[root@jenkins sysconfig]# java -jar /usr/lib/jenkins/jenkins.war --httpPort=80

[root@jenkins sysconfig]# java -jar/usr/lib/jenkins/jenkins.war --httpPort=80

Running from: /usr/lib/jenkins/jenkins.war

webroot: $user.home/.jenkins

Aug 03, 2017 6:51:50 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: Logging initialized @761ms

Aug 03, 2017 6:51:50 PM winstone.Logger logInternal

INFO: Beginning extraction from war file

Aug 03, 2017 6:51:51 PM org.eclipse.jetty.util.log.JavaUtilLogwarn

WARNING: Empty contextPath

Aug 03, 2017 6:51:51 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: jetty-9.2.z-SNAPSHOT

Aug 03, 2017 6:51:52 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: NO JSP Support for /, did not findorg.eclipse.jetty.jsp.JettyJspServlet

Jenkins home directory: /root/.jenkins found at:$user.home/.jenkins

Aug 03, 2017 6:51:52 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: Started w.@4bef0fe3{/,file:/root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}

Aug 03, 2017 6:51:52 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: StartedServerConnector@6111ba37{HTTP/1.1}{0.0.0.0:80}

Aug 03, 2017 6:51:52 PMorg.eclipse.jetty.util.log.JavaUtilLog info

INFO: Started @3453ms

Aug 03, 2017 6:51:52 PM winstone.Logger logInternal

INFO: Winstone Servlet Engine v2.0 running:controlPort=disabled

Aug 03, 2017 6:51:53 PM jenkins.InitReactorRunner$1onAttained

INFO: Started initialization

Aug 03, 2017 6:51:53 PM jenkins.InitReactorRunner$1onAttained

INFO: Listed all plugins

Aug 03, 2017 6:51:54 PM jenkins.InitReactorRunner$1onAttained

INFO: Prepared all plugins

Aug 03, 2017 6:51:54 PM jenkins.InitReactorRunner$1onAttained

INFO: Started all plugins

Aug 03, 2017 6:51:54 PM jenkins.InitReactorRunner$1onAttained

INFO: Augmented all extensions

Aug 03, 2017 6:51:56 PM jenkins.InitReactorRunner$1onAttained

INFO: Loaded all jobs

Aug 03, 2017 6:51:56 PMhudson.model.AsyncPeriodicWork$1 run

INFO: Started Download metadata

Aug 03, 2017 6:51:56 PMorg.jenkinsci.main.modules.sshd.SSHD start

INFO: Started SSHD at port 45606

Aug 03, 2017 6:51:56 PM jenkins.InitReactorRunner$1onAttained

INFO: Completed initialization

Aug 03, 2017 6:51:57 PMorg.springframework.context.support.AbstractApplicationContext prepareRefresh

INFO: Refreshingorg.springframework.web.context.support.StaticWebApplicationContext@68d8b318:display name [Root WebApplicationContext]; startup date [Thu Aug 03 18:51:57CST 2017]; root of context hierarchy

Aug 03, 2017 6:51:57 PMorg.springframework.context.support.AbstractApplicationContextobtainFreshBeanFactory

INFO: Bean factory for application context[org.springframework.web.context.support.StaticWebApplicationContext@68d8b318]:org.springframework.beans.factory.support.DefaultListableBeanFactory@28d6337e

Aug 03, 2017 6:51:57 PMorg.springframework.beans.factory.support.DefaultListableBeanFactorypreInstantiateSingletons

INFO: Pre-instantiating singletons inorg.springframework.beans.factory.support.DefaultListableBeanFactory@28d6337e:defining beans [authenticationManager]; root of factory hierarchy

Aug 03, 2017 6:51:57 PMorg.springframework.context.support.AbstractApplicationContext prepareRefresh

INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@7e69d52a:display name [Root WebApplicationContext]; startup date [Thu Aug 03 18:51:57CST 2017]; root of context hierarchy

Aug 03, 2017 6:51:57 PMorg.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory

INFO: Bean factory for application context[org.springframework.web.context.support.StaticWebApplicationContext@7e69d52a]:org.springframework.beans.factory.support.DefaultListableBeanFactory@2a336227

Aug 03, 2017 6:51:57 PM org.springframework.beans.factory.support.DefaultListableBeanFactorypreInstantiateSingletons

INFO: Pre-instantiating singletons inorg.springframework.beans.factory.support.DefaultListableBeanFactory@2a336227:defining beans [filter,legacy]; root of factory hierarchy

Aug 03, 2017 6:51:57 PM jenkins.install.SetupWizardinit

INFO:

 

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

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

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

 

Jenkins initial setup is required. An admin user hasbeen created and a password generated.

Please use the following password to proceed toinstallation:

 

20bb79eebd794c35a6ea09d07417f86d

 

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

 

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

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

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

 

Aug 03, 2017 6:52:00 PM hudson.model.UpdateSiteupdateData

INFO: Obtained the latest update center data file forUpdateSource default

Aug 03, 2017 6:52:01 PM hudson.model.UpdateSiteupdateData

INFO: Obtained the latest update center data file forUpdateSource default

Aug 03, 2017 6:52:01 PM hudson.WebAppMain$3 run

INFO: Jenkins is fully up and running

Aug 03, 2017 6:52:01 PM javax.jmdns.impl.HostInfonewHostInfo

WARNING: Could not intialize the host network interfaceon nullbecause of an error: jenkins: jenkins: Name or service not known

java.net.UnknownHostException: jenkins: jenkins: Nameor service not known

        atjava.net.InetAddress.getLocalHost(InetAddress.java:1505)

        atjavax.jmdns.impl.HostInfo.newHostInfo(HostInfo.java:75)

        atjavax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:407)

        atjavax.jmdns.JmDNS.create(JmDNS.java:60)

        athudson.DNSMultiCast$1.call(DNSMultiCast.java:33)

        atjenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)

        atjava.util.concurrent.FutureTask.run(FutureTask.java:266)

        atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        atjava.lang.Thread.run(Thread.java:748)

Caused by: java.net.UnknownHostException: jenkins: Nameor service not known

        atjava.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

        atjava.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)

        atjava.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)

        atjava.net.InetAddress.getLocalHost(InetAddress.java:1500)

        ... 9more

 

Aug 03, 2017 6:52:02 PMhudson.model.DownloadService$Downloadable load

INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller

Aug 03, 2017 6:52:04 PMhudson.model.DownloadService$Downloadable load

INFO: Obtained the updated data file forhudson.tools.JDKInstaller

Aug 03, 2017 6:52:04 PMhudson.model.AsyncPeriodicWork$1 run

INFO: Finished Download metadata. 8,289 ms

2、log目录

[root@jenkins jenkins]# tail -f jenkins.log

Aug 03, 2017 6:49:04 PM jenkins.model.Jenkins$21onAttained

INFO: Completed termination

Aug 03, 2017 6:49:04 PM jenkins.model.Jenkins_cleanUpDisconnectComputers

INFO: Starting node disconnection

Aug 03, 2017 6:49:04 PM jenkins.model.Jenkins_cleanUpShutdownPluginManager

INFO: Stopping plugin manager

Aug 03, 2017 6:49:04 PM jenkins.model.Jenkins_cleanUpPersistQueue

INFO: Persisting build queue

Aug 03, 2017 6:49:04 PM jenkins.model.Jenkins cleanUp

INFO: Jenkins stopped

四、jenkins设置

jvm设置

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xms256m-Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m"

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐