标签: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/
二、开始安装
解压包 tar xf jdk-8u121-linux-x64.tar.gz -C /usr/local/ tar xf apache-maven-3.5.0-bin.tar.gz -C /usr/local/ //可选,构建源码需要这个 rpm -ivh jenkins-2.7.4-1.1.noarch.rpm 重命名 mv apache-maven-3.5.0 maven mv apache-tomcat-8.5.13 tomcat mv jdk1.8.0_121 jdk1.8 配置环境变量 ############### export JAVA_HOME=/usr/local/jdk1.8 export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar export PATH=$PATH:/usr/local/maven/bin export JENKINS_HOME="/var/lib/jenkins" source /etc/profile 或者 . /etc/profile 使环境变量生效 查看java版本 [root@localhost ~]# java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) 修改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 ~]# service jenkins start Starting Jenkins [ OK ] 查看端口号 [root@localhost ~]# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1070/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1147/master tcp 0 0 :::54990 :::* LISTEN 2366/java tcp 0 0 :::8080 :::* LISTEN 2366/java tcp 0 0 :::22 :::* LISTEN 1070/sshd tcp 0 0 ::1:25 :::* LISTEN 1147/master
三、访问初始化jenkins
[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword f30c42b9730f4c30a099036cc35f3bf4
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/
二、开始安装
解压 tar xf jdk-8u121-linux-x64.tar.gz -C /usr/local/ tar xf apache-tomcat-8.5.13.tar.gz -C /usr/local/ tar xf apache-maven-3.5.0-bin.tar.gz -C /usr/local/ //可选,构建源码需要这个 重命名 mv apache-maven-3.5.0 maven mv apache-tomcat-8.5.13 tomcat mv jdk1.8.0_121 jdk1.8 移动war包到webapps目录 mv /source/jenkins.war /usr/local/tomcat/webapps/ 配置环境变量 ############### export JAVA_HOME=/usr/local/jdk1.8 export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar export PATH=$PATH:/usr/local/maven/bin export JENKINS_HOME="/root/.jenkins" source /etc/profile 或者 . /etc/profile 使环境变量生效 查看java版本 [root@localhost ]# java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) 启动tomcat [root@localhost ~]# /usr/local/java/tomcat/bin/startup.sh Using CATALINA_BASE: /usr/local/java/tomcat Using CATALINA_HOME: /usr/local/java/tomcat Using CATALINA_TMPDIR: /usr/local/java/tomcat/temp Using JRE_HOME: /usr/local/java/jdk1.8 Using CLASSPATH: /usr/local/java/tomcat/bin/bootstrap.jar:/usr/local/java/tomcat/bin/tomcat-juli.jar Tomcat started. 查看端口号 [root@dns ~]# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2268/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1390/master tcp 0 0 :::8009 :::* LISTEN 17403/java tcp 0 0 :::8080 :::* LISTEN 17403/java tcp 0 0 :::22 :::* LISTEN 2268/sshd tcp 0 0 :::47319 :::* LISTEN 17403/java tcp 0 0 ::1:25 :::* LISTEN 1390/master tcp 0 0 ::ffff:127.0.0.1:9600 :::* LISTEN 18576/java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 17403/java
三、访问配置jenkins
http://192.168.23.253:8080/jenkins/
web界面初始化 和 rpm包界面是一样的
本文出自 “jinchuang” 博客,请务必保留此出处http://jinchuang.blog.51cto.com/8690689/1947028
标签:jenkins
原文地址:http://jinchuang.blog.51cto.com/8690689/1947028