Linux Server installation JDK running Environment tutorial

Source: Internet
Author: User
Tags oracle database installation

Little Alan may be going to Shanghai on business for a few days, what do you do for business? Of course the deployment project is on the line! So you have to learn to install the deployment project running environment on Linux Services! Let's talk to you today. The most basic JDK run environment deployment installation, follow up with you to share some more complex project environment deployment, such as Oracle database installation, Redis non-relational database installation, and project deployment and so on, and then we see how to do it!

Practice is the only standard to test truth

First step: assuming that the production environment gives you a server to install the JDK, you should first check that the server has the JDK installed, can use the existing JDK, and cannot use the existing JDK to uninstall the server already has the JDK

#查看服务器是否安装过jdk

Command: Java-version

If you have JDK-related version information, for example:

OpenJDK Runtime Environment (IcedTea6 1.7.4) (rhel-1.21.b17.el6-i386)
OpenJDK Client VM (build 14.0-b16, Mixed mode)

#查看服务器安装的jdk软件包信息

Command: Rpm-qa|grep GCJ

If you have JDK package information, for example:

libgcj-4.4.4-13.el6.i686
java-1.5.0-gcj-1.5.0.0-29.1.el6.i686

#卸载软件包

Command: Yum-y Remove java-1.5.0-gcj-1.5.0.0-29.1.el6.i686

Specifically what you need to see according to the actual output, some Linux servers have their own openjdk, or have installed the JDK, to learn to determine whether they can use, such as the version is the version of its own, is the use of Oracle's JDK, Or use Linux to bring OPENJDK, if you are not sure, it is necessary to communicate with the customer site-related personnel to determine the server production environment using the JDK version.

The second step: Download the JDK, first load the JDK on Oracle

Command:wget http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

Online a lot of people will tell you to do so, I tell you, this is blind a few of the Nima, this is a thing I do not know, little Alan himself has to try this way, this way to download the GZ package can not be extracted by gzip, that the download package is problematic, Interested can not be extracted by gzip, decompression after you can see this download down what is the thing, little Alan will not go into the drill, we continue to look down

GZIP:TAR-XZVF jdk-8u111-linux-x64.tar.gz-c Usr/java

No GZIP:TAR-XVF jdk-8u111-linux-x64.tar.gz-c Usr/java

So, first we need to get the JDK installation package, where is the JDK installation package? You can search for it online, but it's best to go to Oracle's website to download one, which is safer and more secure.

Official address: http://www.oracle.com/technetwork/java/javase/downloads/index.html, the address may be changed, flexible, Baidu "JDK download" You can also see Oracle's official website in general.

Here little Alan chose Jdk8, 9 is too new, little Alan has not touched,

Click the download button below the JDK to download the interface, remember to agree to the agreement, here in order to hit the arrow little Alan will download the following version:

Choose Linux x64 tar.gz package, click Download to local, we generally use the Windows system bar, casually thrown in a place, as long as you can find it.

Third Step: upload the downloaded JDK installation package to the Linux server, first you want to ensure that you can ping the Linux server locally, and the Linux server to open the SSH service, so that the tool can be linked to the Linux server and upload files, If Ping does not on the Linux server to find a way to solve or communicate with the customer on-site, to provide support, and then install a file on their own local tool, we use WINSCP, this tool is relatively simple and easy to work, convenient to demonstrate, Of course, some customer environments have their own dedicated operations environment, you want to use the tools they provide, some of the higher security level of the company can only through the bastion machine to access to the real server

Open the WINSCP, fill in the connection information, upload our JDK installation package via the SFTP protocol, and then click Save.

By clicking Login, you will be able to access the files in Linux.

Drag and drop the JDK installation package to the location of the Linux server, I'll store it in the/usr/lib/java directory file and create the directory: Mkdir/usr/lib/java.

Fourth Step: unzip the JDK installation package and install the environment variables.

#创建安装目录 (varies according to actual situation)

Command: Mkdir/usr/java

Here we use the Putty tool to access the Linux server, which is as simple and easy to use as WINSCP.

Enter the Linux user name password can log in, the same need to open the Linux Server SSH service, switch to the JDK installation package storage path

We can see the JDK installation package here, the one we dragged in, let's unzip it.

Little Alan has been decompressed, the decompression will get such a file: Jdk1.8.0xxx at this time for convenience can change a name into Java8

Command: MV Jdk1.8.0xxx java8

Switch to the user home directory, you can use the CD ~ command to locate the. bashrc file

Could not find what is the case, because it is a hidden file, we can display all files through ls-a, including hidden files

Next through the vi BASHRC command edit open this file and edit, open and press I can enter the editing mode, at the end of the file Add environment variable configuration content Press exit exit Edit mode return command mode input: Wq Save and exit vim

Refresh the. bashrc file

Note: We are now configuring this environment variable belongs to the current user, if you want to configure the global is to use the following way, of course, there are other ways, here no longer elaborated, the thing is dead, people are alive

The final step: Let's test if the JDK runtime is successfully installed, either through the Java-version command or by entering the Java command directly, you can test

This will successfully install the JDK running environment on the Linux server.

Concluding remarks: A plant of grass, can also spring, a drop of water beads, can also nourish, a hint of wind, also can send cool, a star fire, can also prairie. Although I am small, also has the value, believes oneself, is born my material must be useful!

Cute bo master: Alanlee

Blog Address: Http://www.cnblogs.com/AlanLee

This article is from the blog garden, welcome everyone to join the blog park.

Linux Server installation JDK running Environment tutorial

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.