本文共 4030 字,大约阅读时间需要 13 分钟。
① rpm包安装方式
② war 包安装方式
rpm包安装方式
一、准备需要用到的包:
官网下载: 官网下载: 官网下载:二、开始安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 解压包 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
1 2 | [root@localhost ~] # cat /var/lib/jenkins/secrets/initialAdminPassword f30c42b9730f4c30a099036cc35f3bf4 |
war 包安装方式
一、准备需要用到的包:
官网下载: 官网下载: 官网下载:二、开始安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 解压 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包界面是一样的
本文转自无形于有形 51CTO博客,原文链接:http://blog.51cto.com/jinchuang/1947028,如需转载请自行联系原作者