标签:jenkins安装
Jenkins是个啥?
Jenkins是一个开源软件项目,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能
先来部署下Jenkins运行环境吧
操作系统环境如下
[root@puppet-master ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m [root@puppet-master ~]# uname -r 2.6.32-358.el6.x86_64 [root@puppet-master ~]# uname -m x86_64
创建www用户
[root@puppet-master ~]# useradd www
创建软件存放目录
[root@puppet-master ~]# mkdir /jenkins/{soft,service,data} -pv mkdir: created directory `/jenkins‘ mkdir: created directory `/jenkins/soft‘ mkdir: created directory `/jenkins/service‘ mkdir: created directory `/jenkins/data‘
把jdk、tomcat以及maven软件放在/jenkins/soft目录下
[root@puppet-master ~]# ll /jenkins/soft/ total 193844 -rw-r--r-- 1 root root 8059952 May 13 00:02 apache-maven-3.3.1-bin.tar.gz -rw-r--r-- 1 root root 9128610 May 13 00:02 apache-tomcat-8.0.27.tar.gz -rw-r--r-- 1 root root 181302755 May 13 00:03 jdk-8u74-linux-x64.tar.gz
把Jenkins目录授权为www,data为Jenkins数据目录
[root@puppet-master ~]# chown -R www.www /jenkins/ [root@puppet-master ~]# ll /jenkins/ total 12 drwxr-xr-x 2 www www 4096 May 13 00:36 data drwxr-xr-x 2 www www 4096 May 13 00:05 service drwxr-xr-x 2 www www 4096 May 13 00:35 soft
配置jdk环境
[www@puppet-master soft]# tar fxz jdk-8u74-linux-x64.tar.gz [www@puppet-master soft]# mv jdk1.8.0_74 jdk
配置jdk环境变量
[root@puppet-master ~]# tail -n3 /etc/profile export JAVA_HOME=/jenkins/soft/jdk export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
加载profile文件
[root@puppet-master ~]# source /etc/profile
查看jdk版本
[root@puppet-master ~]# java -version java version "1.8.0_74" Java(TM) SE Runtime Environment (build 1.8.0_74-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
配置maven环境
[root@puppet-master soft]# tar fxz apache-maven-3.3.1-bin.tar.gz [root@puppet-master soft]# mv apache-maven-3.3.1 maven
配置maven环境变量
[root@puppet-master ~]# tail -n2 /etc/profile export MAVEN_HOME=/jenkins/soft/maven export PATH=$MAVEN_HOME/bin:$PATH
设置maven执行权限。因为如果使用Jenkins过程,使用mvn 过程会提示权限问题
[root@puppet-master bin]# pwd /jenkins/soft/maven/bin [root@puppet-master bin]# ll total 32 -rw-r--r-- 1 root root 230 Mar 14 2015 m2.conf -rwxr-xr-x 1 root root 7075 Mar 14 2015 mvn -rw-r--r-- 1 root root 6007 Mar 14 2015 mvn.cmd -rwxr-xr-x 1 root root 1796 Mar 14 2015 mvnDebug -rw-r--r-- 1 root root 1513 Mar 14 2015 mvnDebug.cmd -rwxr-xr-x 1 root root 1843 Mar 14 2015 mvnyjp [root@puppet-master bin]# chmod +x * [root@puppet-master bin]# ll total 32 -rwxr-xr-x 1 root root 230 Mar 14 2015 m2.conf -rwxr-xr-x 1 root root 7075 Mar 14 2015 mvn -rwxr-xr-x 1 root root 6007 Mar 14 2015 mvn.cmd -rwxr-xr-x 1 root root 1796 Mar 14 2015 mvnDebug -rwxr-xr-x 1 root root 1513 Mar 14 2015 mvnDebug.cmd -rwxr-xr-x 1 root root 1843 Mar 14 2015 mvnyjp
加载maven环境变量
[root@puppet-master soft]# source /etc/profile
查看maven版本
[root@puppet-master ~]# mvn -v Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-14T04:10:27+08:00) Maven home: /jenkins/soft/maven Java version: 1.8.0_74, vendor: Oracle Corporation Java home: /jenkins/soft/jdk/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-358.el6.x86_64", arch: "amd64", family: "unix"
切换www用户配置tomcat
解压
[www@puppet-master soft]$ tar fxz apache-tomcat-8.0.27.tar.gz -C /jenkins/service [www@puppet-master soft]$ mv /jenkins/service/apache-tomcat-8.0.27 /jenkins/service/tomcat
启动tomcat
[www@puppet-master tomcat]$ /jenkins/service/tomcat/bin/catalina.sh start Using CATALINA_BASE: /jenkins/service/tomcat Using CATALINA_HOME: /jenkins/service/tomcat Using CATALINA_TMPDIR: /jenkins/service/tomcat/temp Using JRE_HOME: /jenkins/soft/jdk Using CLASSPATH: /jenkins/service/tomcat/bin/bootstrap.jar:/jenkins/service/tomcat/bin/tomcat-juli.jar Tomcat started.
查看tomcat端口
[www@puppet-master bin]$ lsof -i:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 4847 www 46u IPv6 23255 0t0 TCP *:webcache (LISTEN)
模拟访问
[www@puppet-master bin]$ curl -I http://127.0.0.1:8080 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Thu, 12 May 2016 17:21:29 GMT
下载Jenkins war包,把webapps目录的所有文件删除,因为都米有什么用处,Jenkinswar放在webapps下即可。然后启动tomcat
[www@puppet-master webapps]$ pwd /jenkins/service/tomcat/webapps [www@puppet-master webapps]$ wget [www@puppet-master webapps]$ ll total 65032 drwxrwxr-x 10 www www 4096 May 13 01:57 jenkins -rw-r--r-- 1 www www 66587456 May 13 01:57 jenkins.war
设置Jenkins数据存放目录,设置tomcat catalina.sh启动文件
CATALINA_OPTS="-DJENKINS_HOME=/jenkins/data" //添加的内容
# OS specific support. $var _must_ be set to either true or false. //在这行上面添加内容如上
启动tomcat
[www@puppet-master tomcat]$ /jenkins/service/tomcat/bin/catalina.sh start Using CATALINA_BASE: /jenkins/service/tomcat Using CATALINA_HOME: /jenkins/service/tomcat Using CATALINA_TMPDIR: /jenkins/service/tomcat/temp Using JRE_HOME: /jenkins/soft/jdk Using CLASSPATH: /jenkins/service/tomcat/bin/bootstrap.jar:/jenkins/service/tomcat/bin/tomcat-juli.jar Tomcat started.
访问Jenkins,http://192.168.33.131:8080/jenkins
[www@puppet-master bin]$ cat /jenkins/data/secrets/initialAdminPassword
7bad46e07efe4037a4e8a5e361a42adb
定制Jenkins插件或者选择安装插件
就先到这吧。。。下次在搞Jenkins功能选项图解。。。
标签:jenkins安装
原文地址:http://noodle.blog.51cto.com/2925423/1773743