RPM package Specifies the installation path

Source: Internet
Author: User


RPM package generally has a default installation path, how do you want to change the default path, there is no way? Of course. Let's take a look at the following example.

For example, when installing the JDK (Java development Kit) or JRE (Java Runtime Environment), the default installation path for this Redhat package file is/usr/java. What if you want to install it under a different path, for example, in the/home/java directory?

First, check the RPM package for more information

[Email protected] ~]# Rpm-qpi jdk-6u43-linux-amd64.rpm

NAME:JDK Relocations:/usr/java

VERSION:1.6.0_43 Vendor:oracle and/or its affiliates.

Release:fcs Build Date:fri Mar 09:03:27 PM CST

Install Date: (not installed) Build host:jb6-lin-amd64.sfbay.sun.com

Group:development/tools Source rpm:jdk-1.6.0_43-fcs.src.rpm

size:127075557 License:copyright (c), Oracle and/or its affiliates. All rights reserved. Also under other license (s) as shown at the Description field.

Signature: (None)

Packager:java Software <[email protected]>

Url:http://www.oracle.com/technetwork/java/javase/overview/index.html

Summary:java (TM) Platform standard Edition Development Kit

Description:

The Java Platform Standard Edition Development Kit (JDK) includes both

The runtime Environment (Java Virtual Machine, the Java platform classes

and supporting files) and development tools (compilers, debuggers,

Tool libraries and other tools).


The JDK is a development environment for building applications, applets

and components that can is deployed with the Java Platform standard

Edition Runtime Environment.


This JDK is installed by default under/usr/java .


Here we set the parameters so that the JDK can be installed in the directory you specify.

[Email protected] ~]# rpm-i--badreloc--relocate/usr/java=/home/java jdk-6u43-linux-amd64.rpm

Unpacking JAR files ...

Rt.jar ...

Jsse.jar ...

Charsets.jar ...

Tools.jar ...

Localedata.jar ...

Plugin.jar ...

Javaws.jar ...

Deploy.jar ...

ln:creating Symbolic Link '/usr/java/jdk1.6.0_43 ': No such file or directory

Parameter explanation:

Badreloc is forcing the files to be installed where you want them.

Relocate is to install only the files that should be installed in the OldPath to NewPath, to install a subset of the files to other paths, instead of replacing all the files in this package.

But neither prefix nor relocate can really be used, because some packages or files are not allowed to be loaded into other paths, such as oracleasm-support-2.1.8-1.el6.x86_64.rpm


[Email protected] ~]# Rpm-qpi oracleasm-support-2.1.8-1.el6.x86_64.rpm

Warning:oracleasm-support-2.1.8-1.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Ec551f03:nokey

Name:oracleasm-support Relocations: (notrelocatable)

version:2.1.8 vendor:oracle Corporation

Release:1.el6 Build Date:sat 06:46:49 AM CST

Install Date: (not installed) Build host:ca-build44.us.oracle.com

Group:system Environment/kernel Source rpm:oracleasm-support-2.1.8-1.el6.src.rpm

size:221696 LICENSE:GPL

SIGNATURE:RSA/8, Sat 06:50:30 AM CST, Key ID 72f97b74ec551f03

Packager:joel Becker <[email protected]>

url:http://oss.oracle.com/projects/oracleasm/

Summary:the Oracle Automatic Storage Management support programs.

Description:

Tools to manage the Oracle Automatic Storage Management Library Driver


not relocatable cannot be relocated, the installation directory cannot be modified, only the--prefix parameter is removed.


[Email protected] ~]# java-version

-bash:/usr/bin/java:no such file or directory

The Java version number is not displayed because the environment variable has not been modified yet.

Modify the Java environment variables below

[Email protected] jdk1.6.0_43]# Vi/etc/profile

java_home=/home/java/jdk1.6.0_43

Path= $JAVA _home/bin: $PATH

Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export Java_home

Export PATH

Export CLASSPATH

"/etc/profile" 85L, 1961C written


[Email protected] jdk1.6.0_43]# Source/etc/profile

Make the environment variable effective.

Again, there is a Java version number displayed.

[Email protected] jdk1.6.0_43]# java-version

Java Version "1.6.0_43"

Java (TM) SE Runtime Environment (build 1.6.0_43-b01)

Java HotSpot (TM) 64-bit Server VM (build 20.14-b01, Mixed mode)



Add:

When installing the JDK, you need to check if the original system has other Java version number, if you want to install the inconsistency, please uninstall and then install.

[Email protected] ~]# java-version

Java Version "1.7.0_45"

OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)

OpenJDK 64-bit Server VM (build 24.45-b08, Mixed mode)

To find

[Email protected] ~]# Rpm-aq |grep java

Java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64

Tzdata-java-2013g-1.el6.noarch

Java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64

Force Uninstall

[Email protected] ~]# rpm-e--nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64

[Email protected] ~]# Rpm-aq |grep java

Tzdata-java-2013g-1.el6.noarch

Java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64

[Email protected] ~]# rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64

Check again and find that it has been uninstalled cleanly.

[Email protected] ~]# java-version

-bash:/usr/bin/java:no such file or directory


This article is from the "Hollows Jie Sun" blog, be sure to keep this source http://xjsunjie.blog.51cto.com/999372/1639371

RPM package Specifies the installation path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.