centos 安装 jenkins

前端之家收集整理的这篇文章主要介绍了centos 安装 jenkins前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

① rpm包安装方式

② war 包安装方式



rpm包安装方式

一、准备需要用到的包:

apache-maven-3.5.0-bin.tar.gz
官网下载:https://maven.apache.org/download.cgi#

jdk-8u121-linux-x64.tar.gz
官网下载:http://www.oracle.com/technetwork/java/javase/downloads/

jenkins-2.7.4-1.1.noarch.rpm
官网下载:https://jenkins.io/download/

二、开始安装

解压包
tarxfjdk-8u121-linux-x64.tar.gz-C/usr/local/
tarxfapache-maven-3.5.0-bin.tar.gz-C/usr/local///可选,构建源码需要这个
rpm-ivhjenkins-2.7.4-1.1.noarch.rpm

重命名
mvapache-maven-3.5.0maven
mvapache-tomcat-8.5.13tomcat
mvjdk1.8.0_121jdk1.8

配置环境变量
###############
exportJAVA_HOME=/usr/local/jdk1.8
exportPATH=$PATH:$JAVA_HOME/bin
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
exportPATH=$PATH:/usr/local/maven/bin
exportJENKINS_HOME="/var/lib/jenkins"

source/etc/profile或者./etc/profile使环境变量生效

查看java版本
[root@localhost~]#java-version
javaversion"1.8.0_121"
Java(TM)SERuntimeEnvironment(build1.8.0_121-b13)
JavaHotSpot(TM)64-BitServerVM(build25.121-b13,mixedmode)

修改Jenkins启动脚本文件
vim/etc/init.d/jenkins
candidates="/usr/local/jdk1.8/bin/java//添加上你的java路径
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/bin/java
"

启动jenkins
[root@localhost~]#servicejenkinsstart
StartingJenkins[OK]

查看端口号
[root@localhost~]#netstat-lntp
ActiveInternetconnections(onlyservers)
ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programname
tcp000.0.0.0:220.0.0.0:*LISTEN1070/sshd
tcp00127.0.0.1:250.0.0.0:*LISTEN1147/master
tcp00:::54990:::*LISTEN2366/java
tcp00:::8080:::*LISTEN2366/java
tcp00:::22:::*LISTEN1070/sshd
tcp00::1:25:::*LISTEN1147/master


三、访问初始化jenkins

jenkins1.jpg

[root@localhost~]#cat/var/lib/jenkins/secrets/initialAdminPassword
f30c42b9730f4c30a099036cc35f3bf4

jenkins2.jpg

jenkins3.jpg

jenkins4.jpg

jenkins5.jpg

jenkins6.jpg


war 包安装方式

一、准备需要用到的包:

apache-maven-3.5.0-bin.tar.gz
官网下载:https://maven.apache.org/download.cgi#

jdk-8u121-linux-x64.tar.gz
官网下载:http://www.oracle.com/technetwork/java/javase/downloads/

jenkins-2.46.1.war
官网下载:https://jenkins.io/download/

二、开始安装

解压
tarxfjdk-8u121-linux-x64.tar.gz-C/usr/local/
tarxfapache-tomcat-8.5.13.tar.gz-C/usr/local/
tarxfapache-maven-3.5.0-bin.tar.gz-C/usr/local///可选,构建源码需要这个

重命名
mvapache-maven-3.5.0maven
mvapache-tomcat-8.5.13tomcat
mvjdk1.8.0_121jdk1.8

移动war包到webapps目录
mv/source/jenkins.war/usr/local/tomcat/webapps/

配置环境变量
###############
exportJAVA_HOME=/usr/local/jdk1.8
exportPATH=$PATH:$JAVA_HOME/bin
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
exportPATH=$PATH:/usr/local/maven/bin
exportJENKINS_HOME="/root/.jenkins"

source/etc/profile或者./etc/profile使环境变量生效

查看java版本
[root@localhost]#java-version
javaversion"1.8.0_121"
Java(TM)SERuntimeEnvironment(build1.8.0_121-b13)
JavaHotSpot(TM)64-BitServerVM(build25.121-b13,mixedmode)


启动tomcat
[root@localhost~]#/usr/local/java/tomcat/bin/startup.sh
UsingCATALINA_BASE:/usr/local/java/tomcat
UsingCATALINA_HOME:/usr/local/java/tomcat
UsingCATALINA_TMPDIR:/usr/local/java/tomcat/temp
UsingJRE_HOME:/usr/local/java/jdk1.8
UsingCLASSPATH:/usr/local/java/tomcat/bin/bootstrap.jar:/usr/local/java/tomcat/bin/tomcat-juli.jar
Tomcatstarted.

查看端口号

[root@dns~]#netstat-lntp
ActiveInternetconnections(onlyservers)
ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programname
tcp000.0.0.0:220.0.0.0:*LISTEN2268/sshd
tcp00127.0.0.1:250.0.0.0:*LISTEN1390/master
tcp00:::8009:::*LISTEN17403/java
tcp00:::8080:::*LISTEN17403/java
tcp00:::22:::*LISTEN2268/sshd
tcp00:::47319:::*LISTEN17403/java
tcp00::1:25:::*LISTEN1390/master
tcp00::ffff:127.0.0.1:9600:::*LISTEN18576/java
tcp00::ffff:127.0.0.1:8005:::*LISTEN17403/java


三、访问配置jenkins

http://192.168.23.253:8080/jenkins/

web界面初始化 和 rpm包界面是一样的

原文链接:https://www.f2er.com/centos/376798.html

猜你在找的CentOS相关文章