Install jdk_1.8 and linuxjdk_1.8 in linux
Reprinted from http://blog.csdn.net/ldl22847/article/details/7605650
1. Download the jdk rpm installation package, here the jdk-7u4-linux-i586.rpm as an example to explain
: Http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. moving the jdk-7u4-linux-i586.rpm to the appropriate installation directory, the installation software should not be in the/home path, so it is easy to involve access permissions of different users, so the maintenance of the program is quite unfavorable. Here, the installation package will be moved to the/opt directory.
Mv jdk-7u4-linux-i586.rpm/opt; move the installation package to the/opt directory
Cd/opt
3. Grant the running permission to the installation package
Chmod 755 jdk-7u4-linux-i586.rpm
3. Install the rpm installation package
Rpm-I jdk-7u4-linux-i586.rpm
Introduction to RPM Installation
It is becoming increasingly popular to use RPM packages to release software. The main reason is that this software release method is convenient for users to install, upgrade, and delete from the system. In addition, RPM allows you to manage more software installed in the system. For example, you can check which software packages have been installed in the system, check what files are installed in these software packages, where these files are stored, and so on.
Here I will provide a simple getting started manual for beginners to view and quickly use RPM. These RPM commands are the most commonly used. For more complex functions, you do not need to worry about them for the time being. You can check man's manual when necessary. :)
Let's start. The command format used to install an RPM package is as follows:
# Rpm-ivh package. ix86.rpm
In the preceding command, the package is a hypothetical name. ix86 indicates that the package is optimized for a specific CPU. For example, package may be a ldconfig-1.9.5-14, while ix86 is i386.
The "-I" parameter indicates that the package is to be installed, while the "-v" parameter increases the output information, "-h" indicates that hashes is displayed as a progress bar during the installation process.
The above is all about installing an RPM package, which is very simple and easy to use. Of course, if you encounter some package dependency problems during the installation process, it will be a little troublesome. The package dependency problem is that the package you are installing requires the support of other packages to work normally. A common problem is that the installed package requires a specific version of a software or function library to work properly. In this case, you can install or upgrade the dependent software package, and then continue to install the software package you need to install.
Next we will look at some other very useful rpm commands.
If you want to see which files are installed after an RPM package is installed, you can use this command:
# Rpm-ql packagename
This packagename is the name of the package you want to query, such as the ldconfig-1.9.5-14mdk; and the "-p" parameter indicates to query the package database to see if the package has been installed; the "-l" parameter lists the complete paths of all installed files in the queried package.
The following is an example:
[Wh @ infonet wh] $ rpm-ql ldconfig-1.9.5-14mdk
/Sbin/ldconfig
/Usr/doc/ldconfig-1.9.5
/Usr/doc/ldconfig-1.9.5/README
In addition to querying the information of a software package, you can also conveniently delete a specific RPM software package. The command parameter used is "-e", in the following format:
# Rpm-e packagename
"-E" indicates that the specific packagename is deleted.
It is worth noting that the rpm management mechanism does not allow you to delete a software package if it is also dependent on other software packages. Once you delete this software package, other software packages dependent on it will not work properly.
I have learned how to install and delete an rpm package. Let's see how to upgrade an existing rpm package. The upgrade is similar to the installation. You can refer to the following command:
# Rpm-Uvh package. ix86.rpm
The "-U" parameter indicates an upgrade. The values of "v" and "h" are the same as those described above.
At this point, we have learned how to install, delete, and upgrade a software released using rpm.
4. Set Environment Variables
[Root @ localhost opt] # vi/etc/profile; edit the System Configuration File
Enter I and add the following content.
========================================================== ========================================================== =
Export JAVA_HOME =/usr/java/jdk1.8.0 _ 141
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export PATH = $ PATH: $ JAVA_HOME/bin
Press the exc key, enter the colon, and then enter: wq to save and exit.
========================================================== ========================================================== =
Is the configuration file effective: source/etc/profile
View the installation version
[root@geteway ~]# java -versionjava version "1.8.0_141"Java(TM) SE Runtime Environment (build 1.8.0_141-b15)Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)