Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Rpm package specifies the installation path

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Rpm packages generally have a default installation path, how do you want to change the default path, is there any way? Of course there is. Let's look at the following example.

For example, when installing 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 in another path, such as / home/java directory?

First, check the details of the rpm package.

[root@oracle ~] # 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 01 Mar 2013 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) 2011, Oracle and/or its affiliates. All rights reserved. Also under other license (s) as shown at the Description field.

Signature: (none)

Packager: Java Software

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 be deployed with the Java Platform Standard

Edition Runtime Environment.

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

Let's set the parameters like this so that we can install JDK in the directory you specify.

[root@sharesan] # 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 definition:

Badreloc is to force files to be installed where you want them.

Relocate is to install only the files that should be installed under oldpath to newpath, to install some of the files to another path, 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 to other paths, such as oracleasm-support-2.1.8-1.el6.x86_64.rpm

[root@oracle] # 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: (not relocatable)

Version: 2.1.8 Vendor: Oracle Corporation

Release: 1.el6 Build Date: Sat 09 Feb 2013 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 09 Feb 2013 06:50:30 AM CST, Key ID 72f97b74ec551f03

Packager: Joel Becker

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, and the-- prefix parameter can only be removed.

[root@sharesan ~] # java-version

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

The JAVA version number is not displayed at this time because the environment variable has not been changed.

Let's modify the environment variable of JAVA

[root@sharesan 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

[root@sharesan jdk1.6.0_43] # source / etc/profile

Make the environment variable effective.

If you check it again, the JAVA version number will be displayed.

[root@sharesan jdk1.6.0_43] # java-version

Java version "1.6.043"

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

Java HotSpot (TM) 64-Bit Server VM (build 20.14-b01, mixed mode)

Let me add:

When installing JDK, you need to check whether the original system has another JAVA version number. If it is not consistent with what you want to install, please uninstall it and then install it.

[root@sharesan ~] # java-version

Java version "1.7.045"

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

OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Make a search

[root@sharesan ~] # 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

Forced unloading

[root@sharesan] # rpm-e-- nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64

[root@sharesan ~] # 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

[root@sharesan] # 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 clean.

[root@sharesan ~] # java-version

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report