Linux Server Installation JDK running environment tutorial, linuxjdk

Source: Internet
Author: User
Tags oracle database installation

Linux Server Installation JDK running environment tutorial, linuxjdk

Alan may be on a business trip to Shanghai in a few days. What should I do on a business trip? Of course, the deployment project is launched! Therefore, you must learn to install and deploy the project running environment on the Linux service! Today, let's talk about the most basic jdk running environment deployment and installation, and share with you some more complex project environment deployment, for example, oracle database installation, redis non-relational database installation, and project deployment. Let's take a look at what to do next!

 

Practice is the only criterion for testing truth

Step 1:Suppose that the production environment has given you a server to install jdk, you should first check whether jdk has been installed on the server and whether the existing jdk can be used, if you cannot use the existing jdk, uninstall the existing jdk on the server first.

# Check whether jdk has been installed on the server

Command: java-version

If jdk-related version information is available, for example:

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

# View the jdk software package information installed on the server

Command: rpm-qa | grep gcj

If there is jdk package information, such:

Libgcj-4.4.4-13.el6.i686
Java-1.5.0-gcj-1.5.0.0-29.1.el6.i686

# Uninstall a software package

Command: yum-y remove java-1.5.0-gcj-1.5.0.0-29.1.el6.i686

For specific information, see the actual output. Some linux servers come with OpenJDK or have already installed jdk. Learn to determine whether the version can be used by yourself, for example, whether the version is your desired version, whether to use the jdk of oracle or the OpenJDK of linux. If you are not sure about the jdk, contact the Customer's onsite personnel to determine the jdk version used in the server production environment.

 

Step 2:Download jdk. First download jdk on oracle

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

Many people on the Internet will tell you how to do this. I tell you, this is just a few nonsense. I don't know what this Nima is about, alan tried this method. The gz package downloaded in this way cannot be decompressed through gzip, which indicates that the downloaded package is faulty, if you are interested, do not decompress the package in gzip mode. After decompression, you can see what the downloaded package is. Alan will not go deep into it. Let's continue to look at it.

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

Therefore, we first need to get the jdk installation package. Where is the jdk installation package? You can search for it online, but you 'd better download it from the oracle official website, which is safer and safer.

Official website address: Workshop.

Here, Alan chose JDK 8. 9 is too new, and Alan has never touched it,

Click the DOWNLOAD button under jdk to DOWNLOAD the interface. Remember to agree to the Agreement. Here, we will DOWNLOAD the following version to show Alan:

Select the Linux x64's tar.gz package and click to download it to the local computer. We generally use a windows system and place it anywhere, as long as you can find it.

 

 

Step 3:Upload the downloaded jdk installation package to the linux server. First, make sure that you can ping the linux Server locally and enable the ssh service on the linux server, in this way, you can use tools to connect to the linux server and upload files. If you cannot ping the linux server, you need to find a solution or communicate with the customer's on-site personnel to provide support, then install a file upload tool locally. Here we use WinSCP, which is easy to use and convenient for demonstration. Of course, some customer environments have their own special O & M environment, you need to use the tools they provide. Some companies with high security levels can only access real servers through bastion hosts.

Open WinSCP, fill in the connection information, upload our jdk installation package through sftp protocol, fill in the package, and click save to save

Click Login to access files in linux.

Drag and Drop the jdk installation package to the corresponding location of the linux server. Here, I store it in the/usr/lib/java directory file and create the directory mkdir/usr/lib/java.

 

Step 4:Decompress the jdk installation package and install and configure environment variables.

# Create an installation directory (variable as needed)

Command: mkdir/usr/java

Here we use putty to access the linux server. It is very simple and easy to use like WinSCP.

Enter the linux user name and password to log in. Similarly, You need to enable the ssh service on the linux server and switch to the jdk installation package storage path.

We can see that the jdk installation package is here, that is, the one we dragged in. Let's decompress it.

Alan will not decompress it once it has been decompressed. The decompressed file jdk1.8.0xxx can be renamed java8 for convenience.

Command: mv jdk1.8.0xxx java8

Switch to the user's home directory. You can use cd ~ Command to find the. bashrc File

What is not found, because it is a hidden file, we can use ls-a to display all files, including hidden files

Next, use vi. edit the bashrc command to open the file and edit it. Press I to enter the editing mode. Add the environment variable configuration content to the file and press exit to exit the editing mode. Return to the command mode input: wq save and exit vim

Refresh the. bashrc file.

Note: The environment variable we configure now belongs to the current user. If you want to configure the global environment, use the following method. Of course, there are other methods, things are dead, and people are living.

 

 

Last step:Let's test whether the jdk running environment has been successfully installed. You can test the environment by running the java-version command or directly entering the java command.

In this way, the jdk runtime environment is successfully installed on the Linux server.

 

Conclusion: A grass can also report spring, a drop of water, can also moisturize, a breeze, can also send a good, a fire of a star, can also be restored. Although I am small, I also have value. believe in myself, I am born to be useful!

 

Alimail: AlanLee

Blog: http://www.cnblogs.com/AlanLee

This article is from the blog site. You are welcome to join the blog site.

 

Related Article

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.