Two methods (Yum + Download Pack) (reproduced) on the Linux server (Yum + Download Pack) (reproduced)

This article is reproduced article, mainly used for records, original address


For developers, installing JDK is a very simple thing, but in linux installed a real fee, I have been playing a small white in Windows. Here you simply get steps, I hope to help with pure white people like me to take a pit.

Here you introduce two installation methods:

1, YUM installation;

2, from the official website download package installation

First, get a Linux server

To install JDK under Linux, you have to have a Linux server first. As a small white, the hand of the hand is definitely Windows. It is a virtual machine to install this little white. It is simply torture; the simplest use here The way a Linux server is got from Ali Cloud. Mirror Select CentOS7.3 64.

Second, YUM installation JDK

It is very rude to use YUM installation on Linux, but still need to pay attention, otherwise it will drop. Here you say the step.

1. Execute command Yum -y List Java * View the installed Java version. After successful, you can see the following results.

2. Select a Java version for installation. Here we want to install Java1.8 because our machine is 64-bit, so select Install Java-1.8.0-OpenJDK-DEVEL.X86_64.

There is a place here to pay attention to the two Java versions that I use red frames in the figure, to choose -Devel installation, because this installation is JDK, and that does not have -Devel installed in actually JRE.

3. Execute the command yum install -y java-1.8.0-openjdk-devel.x86_64. Will see a lot of outputs in the implementation.

Patience waiting until the automatic installation is complete

4. Enter Java -Version to view the installed JDK version, which indicates that the installation is successful.

5. You may be curious, YUM installed JDK, where is it? You can find them in / usr / lib / jvm directory.

At this point, YUM is installed JDK complete.

Third, from the official website download package installation JDK

If you don’t like the way Yum installation, you want to use the official installation package for the traditional way, you can use the following steps.

1. Execute the command UserAdd Java, New User Java

2. Run the passwd java, set the Java user password

3. Enter Oracle official website, Java8 download page

Everyone can also select the corresponding version through the download of the script home.

4. Select Accept License Agreement, click JDK-8U131-Linux-x64.tar.gz to get the download link. Note that the obtained download link is sometimes efficient (how long is it unclear, anyway, definitely cannot be used, please copy it to Linux as soon as possible.

5. Go to the / home / java directory, enter the wget + address, you can start downloading

6. Wait for download success

7. View the file, discover the downloaded file name has a strange suffix, rename the download file

8. Enter the command TAR ZXVF JDK-8U131-Linux-x64.tar.gz decompressed installation package

9. Enter the command vim / etc / profile to open environment variable configuration files

Enter the following information at the bottom of the file and save










Java_Home = / home / java / jdk1.8.0_131

JRE_HOME = $ java_home / jre

PATH = $ PATH: $ java_home / bin

Classpath =.: $ Java_home / lib / dt.jar: $ java_home / lib / Tools.jar

Export java_home

Export jre_home

Export Path

Export ClassPath

10. Enter the command source / etc / profile, refresh the environment variable profile, make it take effect immediately; enter Java -Version to view the installed JDK version

You have to do this, then dropped it. Although this is enough, there is still a step in operation. Build a / usr / bin / java’s Java hyperlink.

Ln -s /Home/java/jdk1.8.0_131/bin/java / usr / bin / java

Why build this hyperlink, because some of your own registered Linux services (such as SpringBoot JAR registration services), this hyperlink is automatically created when using Java, Yum installation by default, this hyperlink is automatically created, this hyperlink is automatically created.If you download the package yourself, this hyperlink requires you to create manually.

At this point, the JDK is installed from the official website to the package.


The above is the full content of this article, I hope this paper has a certain reference value for everyone’s study or work. If you have any questions, you can leave a message, thank you for your support of the family.

Related Posts