1、安装环境说明:
系统:
[root@localhost bin]# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)
[root@localhost bin]# uname -a
Linux localhost.localdomain 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2、安装步骤
(1)安装jdk
java -version没有输出,则说明未安装jdk,下面以jdk1.7的为例
yum -y install java-1.7.0-openjdk
安装完后,查看jdk的版本,确认是否安装成功
[root@localhost install]# java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (rhel-2.6.2.1.el7_1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
(2)安装apache-tomcat
下载apache-tomcat
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.65/bin/apache-tomcat-7.0.65.tar.gz
解压一下
tar -xvf apache-tomcat-7.0.65.tar.gz
拷贝到/usr/local目录下
mv apache-tomcat-7.0.65 /usr/local/tomcat
运行tomcat
cd /usr/local/tomcat/bin && ./start.sh
打开浏览器输入http://xxxx:8080,看到apache的欢迎界面,则tomcat部署好了,如果没有看见,估计是8080端口未允许访问,则执行以下命令:
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
(3)安装apache-maven
下载apache-maven
wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
解压一下
tar -xvf apache-maven-3.3.3-bin.tar.gz
拷贝到/usr/local目录下
mv apache-maven-3.3.3-bin /usr/local/maven
(4)设置环境变量
编辑/etc/profile文件,新增和导出以下变量:
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64
JRE_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64/jre
TOMCAT_HOME=/usr/local/tomcat
MAVEN_HOME=/usr/local/maven
export MAVEN_HOME
export JAVA_HOME
export JRE_HOME
export PATH
export PATH=${PATH}:${MAVEN_HOME}/bin
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
使环境变量生效
source /etc/profile
执行mvn -v,检查一下apache-maven是否安装成功
[root@localhost bin]# mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /usr/local/maven
Java version: 1.7.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-229.14.1.el7.x86_64", arch: "amd64", family: "unix"
(5)安装jenkins
wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
cp /usr/lib/jenkins/jenkins.war /usr/local/tomcat/webapps
然后重启tomcat服务
cd /usr/local/tomcat/bin
./shutdown.sh && ./startup.sh
最后在浏览器上输入http://xxxx:8080/jenkins/,