1.安装JDK7
1.1 下载JDK7
可能不能直接使用wget下载,可使用迅雷下载
http://download.oracle.com/otn-pub/Java/jdk/7/jdk-7-linux-i586.tar.gz
拷贝到目录/usr/local
1.2 解压安装包
-
[root@localhost local]#tar -zxvf jdk-7-linux-i586.tar.gz
1.3修改环境变量
-
[root@localhost local]# vi /etc/profile
添加下面几行
-
exportJAVA_HOME=/usr/local/jdk1.7.0
-
exportJRE_HOME=/usr/local/jdk1.7.0/jre
-
exportCLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
-
exportPATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
1.4 执行命令
-
[root@bogonopt]# source /etc/profile
这样环境变量的修改就生效了
1.5 验证JDK安装结果
-
[root@localhostjdk1.7.0]# java -version
-
java version"1.7.0"
-
Java(TM) SERuntime Environment (build 1.7.0-b147)
-
Java HotSpot(TM)Client VM (build 21.0-b17, mixed mode)
-
ng:1.0pt;}
2.安装maven
2.1 下载maven
-
[root@localhostlocal]# wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
2.2 解压maven
-
[root@localhostlocal]# tar -zxvf apache-maven-3.3.9-bin.tar.gz
2.3 配置maven安装路径
修改文件/etc/profile,添加下面三行
-
MAVEN_HOME=/usr/local/apache-maven-3.3.9
-
export MAVEN_HOME
-
export PATH=${PATH}:${MAVEN_HOME}/bin
让修改生效
-
[root@localhost local]# source /etc/profile
2.4 验证安装结果
-
[root@localhost local]# mvn -v
-
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
-
Maven home: /usr/local/apache-maven-3.3.9
-
Java version: 1.7.0, vendor: Oracle Corporation
-
Java home: /usr/local/jdk1.7.0/jre
-
Default locale: en_US, platform encoding: UTF-8
-
OS name: "linux", version: "2.6.32-431.el6.i686", arch: "i386", family: "unix"
3.安装Jenkins
3.1 下载jenkins
http://211.162.52.227/files/4054000003480AF6/ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/redhat-stable/jenkins-2.7.3-1.1.noarch.rpm
将安装包拷贝到目录/usr/local
3.2.安装jenkins
-
[root@localhost local]# rpm -ivh jenkins-2.7.3-1.1.noarch.rpm
jenkins的安装目录是/usr/lib/jenkins,里面有个WAR包jenkins.war
3.3.修改jenkins配置文件
添加下面一行
-
/usr/local/jdk1.7.0/bin/java
-
[root@localhost jenkins]# vi /etc/sysconfig/jenkins
-
candidates="
-
/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
-
/usr/local/jdk1.7.0/bin/java"
3.4 启动jenkins
-
[root@localhostjenkins]# service jenkins start
-
StartingJenkins [ OK ]
3.5 开放端口8080
jenkins的默认端口号是8080,防火墙要开放这个端口,外部才能访问。
添加下面一行
-
-<span style="font-family: Arial, Helvetica, sans-serif;">A INPUT -mstate --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT</span>
-
[root@localhostjenkins]# vi /etc/sysconfig/iptables
-
# Firewallconfiguration written by system-config-firewall
-
# Manualcustomization of this file is not recommended.
-
*filter
-
:INPUT ACCEPT[0:0]
-
:FORWARD ACCEPT[0:0]
-
:OUTPUT ACCEPT[0:0]
-
-A INPUT -mstate --state ESTABLISHED,RELATED -j ACCEPT
-
-A INPUT -p icmp-j ACCEPT
-
-A INPUT -i lo-j ACCEPT
-
-A INPUT -mstate --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-
-A INPUT -mstate --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-
<pre code_snippet_id="1876506" snippet_file_name="blog_20160911_9_9918486" name="code" class="java">-<span style="font-family: Arial, Helvetica, sans-serif;">A INPUT -mstate --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT</span>
-A INPUT -jREJECT --reject-with icmp-host-prohibited-A FORWARD -jREJECT --reject-with icmp-host-prohibited
3.6 重启防火墙
-
[root@localhostjenkins]# service iptables restart
-
iptables:Setting chains to policy ACCEPT: filter [ OK ]
-
iptables:Flushing firewall rules: [ OK ]
-
iptables:Unloading modules: [ OK ]
-
iptables:Applying firewall rules: [ OK ]
3.7 浏览器访问jenkins
http://192.168.1.105:8080
进入目录/var/lib/jenkins/secrets
查看密码
-
[root@localhost secrets]# vi initialAdminPassword
-
2aa80bb4a1ce4a269996b1b2ba6cefc1
3.8 查看运行日志
-
[root@localhost jenkins]# more /var/log/jenkins/jenkins.log
(责任编辑:IT) |