1、系统设置和升级
禁用selinux和iptables
yum update -y
reboot
2、生成账户
useradd -d /apps -pjakart jakarta
mkdir /apps/{tools,www,shell};chown -R jakarta.jakarta /apps/
3、maven
下载链接地址:%3A%2F%2Fmirrors.hust.edu.cn%2Fapache%2F
请选择bin包下载
tar zxvf apache-maven-3.1.1-bin.tar.gz -C /usr/local/
ln -s /usr/local/apache-maven-3.1.1/ /usr/local/apache-maven
vim /etc/profile
添加一下两行
export M3_HOME=/usr/local/apache-maven
export PATH=${M3_HOME}/bin:${PATH}
生效环境变量
source /etc/profile
验证maven
mvn -v
which: no javac in (/usr/local/apache-maven/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Warning: JAVA_HOME environment variable is not set.
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800)
Maven home: /usr/local/apache-maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.3.1.el6.x86_64", arch: "amd64", family: "unix"
提示没有javac,java版本使用系统自带的。建议重新下载安装:
4、安装java
卸载自带的java
下载地址jdk-6u31-linux-x64.bin
删除以前版本:
yum remove -y java
rpm -qa |grep java|xargs rpm -e
mkdir /usr/java
chmod +x jdk-6u31-linux-x64.bin
mv jdk-6u31 /usr/java/
ln -s /usr/java/jdk1.6.0_3 /usr/java/default
vim /etc/profile
export JAVA_HOME=/usr/java/default
export JRE_HOME=/usr/java/default/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=${JAVA_HOME}/bin:${PATH}
验证
[root@mb tools]# which java
/usr/java/default/bin/java
[root@mb tools]#java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
[root@mb tools]# mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800)
Maven home: /usr/local/apache-maven
Java version: 1.6.0_31, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_31/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.3.1.el6.x86_64", arch: "amd64", family: "unix"
阅读(4549) | 评论(0) | 转发(0) |