1. 程式人生 > >CentOS-6.4-minimal版中安裝JDK_Maven_Subversion以及修改rpm包安裝路徑

CentOS-6.4-minimal版中安裝JDK_Maven_Subversion以及修改rpm包安裝路徑

完整版見https://jadyer.github.io/2013/09/07/centos-config-develop/
/**
 * @see -------------------------------------------------------------------------------------------------
 * @see 安裝JDK
 * @see [[email protected] ~]# cd /
 * @see [[email protected] /]# mkdir app
 * @see [[email protected] ~]# groupadd Develop                            #新增Develop組
 * @see [
[email protected]
~]# useradd -g Develop Jadyer #建立Jadyer使用者並將其分配到Develop組 * @see [[email protected] ~]# passwd Jadyer #設定或修改Jadyer使用者密碼 * @see [[email protected] /]# chown -R Jadyer:Develop /app #將/app目錄的擁有者修改為Jadyer使用者和Develop組 * @see [
[email protected]
software]$ tar zxvf jdk-8u40-linux-x64.tar.gz #解壓jdk * @see [[email protected] software]$ mv jdk1.8.0_40/ /app/jdk1.8.0_40 #統一存放應用在/app目錄中 * @see [[email protected] ~]# vi /etc/profile #配置環境變數,最後[:x]儲存即可 * @see #Set Java Environment Variable * @see JAVA_HOME=/app/jdk1.8.0_40 * @see PATH=$PATH:$JAVA_HOME/bin * @see export JAVA_HOME PATH * @see [
[email protected]
~]# echo $PATH #檢視當前PATH * @see [[email protected] ~]# source /etc/profile #令環境變數生效 * @see [[email protected] ~]# echo $PATH #再看下PATH * @see [[email protected] ~]# java -version #驗證是否成功 * @see [[email protected] ~]$ java -version #重複驗證(普通使用者重連伺服器後才會生效) * @see ------------------------------------------------------------------------------------------------- * @see 安裝Maven * @see [[email protected] ~]$ cd /app/ * @see [[email protected] app]$ tar -zxvf apache-maven-3.2.5-bin.tar.gz * @see [[email protected] app]$ rm -rf apache-maven-3.2.5-bin.tar.gz * @see [[email protected] Jadyer]# vi /etc/profile * @see #Set Maven Environment Variable * @see MAVEN_HOME=/app/apache-maven-3.2.5 * @see PATH=$PATH:$MAVEN_HOME/bin * @see export MAVEN_HOME PATH * @see [[email protected] Jadyer]# source /etc/profile * @see [[email protected] Jadyer]# echo $PATH * @see [[email protected] Jadyer]# mvn -version * @see [[email protected] ~]$ mvn -version * @see [[email protected] ~]$ cd /app/code/ * @see [[email protected] code]$ mkdir MavenRepository * @see [[email protected] code]$ vi /app/apache-maven-3.2.5/conf/settings.xml * @see <localRepository>/app/code/MavenRepository</localRepository> * @see [[email protected] code]$ cp /app/apache-maven-3.2.5/conf/settings.xml MavenRepository/ * @see ------------------------------------------------------------------------------------------------- * @see 安裝Subversion * @see https://www.open.collab.net/files/documents/60/11125/CollabNetSubversion-client-1.8.13-1.x86_64.rpm * @see [[email protected] ~]$ rpm -q Subversion * @see [[email protected] ~]$ rpm -ivh /app/CollabNetSubversion-client-1.8.13-1.x86_64.rpm * @see warning: /app/CollabNetSubversion-client-1.8.13-1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 35bcca43: NOKEY * @see Preparing... ########################################### [100%] * @see 1:CollabNetSubversion-cli########################################### [100%] * @see [[email protected] Jadyer]# svn --version * @see [[email protected] Jadyer]# vi /etc/profile * @see #Set Subversion Environment Variable * @see SVN_HOME=/opt/CollabNet_Subversion * @see PATH=$PATH:$SVN_HOME/bin * @see export SVN_HOME PATH * @see [[email protected] Jadyer]# source /etc/profile * @see [[email protected] Jadyer]# svn --version * @see [[email protected] ~]$ svn --version * @see ------------------------------------------------------------------------------------------------- * @create 2015-5-27 下午3:19:19 * @author 玄玉<http://blog.csdn.net/jadyer> */
/**
 * @see -------------------------------------------------------------------------------------------------
 * @see 關於rpm的安裝路徑
 * @see rpm包通常都有預設的安裝路徑,但也有辦法更新它的預設安裝路徑,只不過不是所有的rpm都允許安裝到其它路徑
 * @see 下面以CollabNetSubversion-client-1.8.13-1.x86_64.rpm和jdk-6u45-linux-amd64.rpm為例
 * @see -------------------------------------------------------------------------------------------------
 * @see [[email protected] app]$ rpm -qpi CollabNetSubversion-client-1.8.13-1.x86_64.rpm
 * @see warning: CollabNetSubversion-client-1.8.13-1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 35bcca43: NOKEY
 * @see Name        : CollabNetSubversion-client   Relocations: (not relocatable)
 * @see Version     : 1.8.13                            Vendor: CollabNet
 * @see Release     : 1                             Build Date: Mon 23 Mar 2015 02:49:36 AM EDT
 * @see Install Date: (not installed)               Build Host: cu128.cloud.maa.collab.net
 * @see Group       : Utilities/System              Source RPM: CollabNetSubversion-client-1.8.13-1.src.rpm
 * @see Size        : 39281894                         License: Proprietary
 * @see Signature   : DSA/SHA1, Mon 23 Mar 2015 02:49:51 AM EDT, Key ID 80233a5a35bcca43
 * @see Packager    : Alexander Thomas (AT) <[email protected]>
 * @see URL         : http://open.collab.net
 * @see Summary     : A Concurrent Versioning system similar to but better than CVS.
 * @see Description :
 * @see CollabNet Subversion client is a free download of open-source Subversion,
 * @see compiled and tested by CollabNet. For more information about CollabNet
 * @see Subversion, visit the CollabNet community at http://open.collab.net.
 * @see -------------------------------------------------------------------------------------------------
 * @see [[email protected] app]$ rpm -qpi jdk-6u45-linux-amd64.rpm
 * @see Name        : jdk                          Relocations: /usr/java 
 * @see Version     : 1.6.0_45                          Vendor: Oracle and/or its affiliates.
 * @see Release     : fcs                           Build Date: Tue 26 Mar 2013 07:54:12 PM EDT
 * @see Install Date: (not installed)               Build Host: jb6-lin-amd64.sfbay.sun.com
 * @see Group       : Development/Tools             Source RPM: jdk-1.6.0_45-fcs.src.rpm
 * @see Size        : 127250396                        License: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Also under other license(s) as shown at the Description field.
 * @see Signature   : (none)
 * @see Packager    : Java Software <[email protected]>
 * @see URL         : http://www.oracle.com/technetwork/java/javase/overview/index.html
 * @see Summary     : Java(TM) Platform Standard Edition Development Kit
 * @see Description :
 * @see The Java Platform Standard Edition Development Kit (JDK) includes both
 * @see the runtime environment (Java virtual machine, the Java platform classes
 * @see and supporting files) and development tools (compilers, debuggers,
 * @see tool libraries and other tools).
 * @see 
 * @see The JDK is a development environment for building applications, applets
 * @see and components that can be deployed with the Java Platform Standard
 * @see Edition Runtime Environment.
 * @see -------------------------------------------------------------------------------------------------
 * @see 通過二者的Relocations引數,我們可以看到Subversion是不允許重定位的,而jdk則允許
 * @see 所以,Subversion只能安裝在預設路徑下,而jdk則可以修改其預設安裝路徑/usr/java為其它路徑,方法如下
 * @see [[email protected] app]$ rpm -ivh --badreloc --relocate /usr/java=/app/jdk1.6.0_45 jdk-6u45-linux-amd64.rpm
 * @see badreloc是將檔案強制安裝到指定位置
 * @see relocate是將檔案從oldpath安裝到newpath
 * @see -------------------------------------------------------------------------------------------------
 * @create 2015-5-27 下午7:08:43
 * @author 玄玉<http://blog.csdn.net/jadyer>
 */