VDS Requirements
Installation is performed on dedicated servers or VDS with KVM virtualization on tariffs with at least 2048 MB of RAM.
Debian\Ubuntu
Installing the latest Java versions
Updating information about packages:
# apt update
Installing the latest version:
# apt-get install default-jdk
Installing OpenJDK 7, 8, 9
There are cases when you don’t need the latest version, but, for example, JDK7. There are no current repositories with this version for Ubuntu\Debian anymore. Therefore, to solve this problem, download the required version from the official Oracle website. In order to download JDK7 from the Oracle website, you need to register on it. After registration, download the archive to your computer and upload it to your server in any convenient way (using rsync or scp, or using an FTP client) in the /usr/lib/java/ directory.
Next, using the example of OpenJDK 7, we will show you how to install the required version. The installation of OpenJDK 8 and 9 is similar.
Create a directory and go to it:
# mkdir /usr/lib/java/ && cd /usr/lib/java/
Download the archive and unzip it.
If you have a Linux computer, you can do this by running rsync from it (/home/user/downloads is the path to the directory where the archive with JDK7 is located, and root@1.2.3.4 — your server’s user and IP address):
# rsync -avP /home/user/downloads/jdk-7u80-linux-x64.tar.gz root@1.2.3.4:/usr/lib/java/
If you have a Windows computer, you can use FTP.
Next, on the server where you need to install JDK7, unpack the archive:
# tar -zxvf jdk-7u80-linux-x64.tar.gz -С /usr/lib/java/java-7-oracle
Let’s check the Java version:
# /usr/lib/java/java-7-oracle/bin/java -version
As a result, we get the output:
# java -version
java version "1.7.0_261"
OpenJDK Runtime Environment (rhel-2.6.22.2.el7_8-x86_64 u261-b02)
OpenJDK 64-Bit Server VM (build 24.261-b02, mixed mode)
We create a symbolic link in order not to access the full path to the binary file.:
# ln -s /usr/lib/java/java-7-oracle/bin/java /usr/bin/java
CentOS\AlmaLinux\RockyLinux
The situation is different for CentOS, AlmaLinux, and RockyLinux — only Java versions 1.7 and 1.8 are stored in the repositories, and they can be installed with a single command. For example, to install JDK version 7, enter the command:
# yum install java-1.7.0-openjdk
At the same time, if we need OpenJDK version 8, it is enough to run the command:
# yum install java-1.8.0-openjdk
Consider installing more recent versions of OpenJDK on CentOS, AlmaLinux, and RockyLinux OS.
To do this, it is enough to enable the epel repository.:
# yum -y install epel-release
Then install the required version of OpenJDK. To install version 1.10, enter:
# yum -y install java-10-openjdk-devel
To install version 1.11, enter:
# yum -y install java-11-openjdk-devel
Checking it out:
# java -version
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-2.el8_7) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-2.el8_7) (build 11.0.18+10-LTS, mixed mode, sharing)
