Specify the installation path for the rpm package

Source: Internet
Author: User

Specify the installation path for the rpm package

The rpm package usually has a default installation path. How do you change the default path? Of course. Let's take a look at the example below.
For example, when JDK (Java Development Kit) or JRE (Java Runtime Environment) is installed, the default installation path of the RedHat package file is/usr/java. What if you want to install it in another path, such as the/home/java directory?
1. First, view the rpm package details
[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 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 <[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 des 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 in/usr/java by default.

 

In this way, we can set the parameters so that JDK can be installed in the directory you specified.
[Root @ bkjia ~] # 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 description:
Badreloc forces the file to be installed wherever you want.
Relocate only installs the files that should be installed in the oldpath to newpath, so as to install some files to other paths, rather than 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 mounted 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 <[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, and the installation directory cannot be modified. Only the -- prefix parameter is removed.


[Root @ bkjia ~] # Java-version
-Bash:/usr/bin/java: No such file or directory
The JAVA version is not displayed because the environment variable has not been modified.
Next, modify the JAVA environment variables.
[Root @ bkjia 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 @ bkjia jdk1.6.0 _ 43] # source/etc/profile
Make environment variables take effect.
Check that the JAVA version number is displayed.
[Root @ bkjia 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 pipeline 14-b01, mixed mode)

 


Add:
When installing JDK, you need to check whether the original system has other JAVA version numbers. if the version numbers are inconsistent with the ones you want to install, uninstall them and install them again.
[Root @ bkjia ~] # 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)
Search
[Root @ bkjia ~] # 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
[Root @ bkjia ~] # Rpm-e -- nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
[Root @ bkjia ~] # 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 @ bkjia ~] # 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 @ bkjia ~] # Java-version
-Bash:/usr/bin/java: No such file or directory

Getting started with creating an RPM package

In Linux, how does one create an RPM package?

Create your own rpm package

Directory structure and configuration after rpm installation in Linux

Brief Introduction and demo of rpm and yum

Redhat Linux --- rpm command details

Use FPM to easily create an RPM package

This article permanently updates the link address:

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.