Issue
I have to install open-jdk on a computer that cannot connect to the Internet.
I have rarely used CentOS 7 outside of school, so I don't know how to search.
I tried hard for three days and succeeded in installing open-jdk through this command from Internet-connected system.
yum install java-1.8.0-openjdk-devel
And I also learned to register environment variables.
But it is too difficult for me to install it in an environment where the Internet is not available.
You don't have to tell me everything. If you give me the guidelines, I will study hard.
Please tell me a good way.
My system os version is CentOS 7 (7.9-2009) and I want to install version 1.8.0 of open-JDK.
Solution
You can try this method:
First, install yum-downloadonly plug-in.
$ yum install yum-plugin-downloadonly yum-utils createrepo
Then create the directory for installation. /openjdk-installroot directory is a folder for temporarily storing many rpms.
$ mkdir /openjdk
$ mkdir /openjdk-installroot
Download many rpms to the /openjdk-installroot directory using --downloadonly(yum-plugin-downloadonly). Then create repo database through creatrepo.
$ yum install --downloadonly --installroot=/openjdk-installroot --releasever=7 --downloaddir=/openjdk java-1.8.0-openjdk-devel.x86_64
$ createrepo --database /openjdk
Now, You can delete the /openjdk-installroot directory.
$ rm -rf /openjdk-installroot
You must move the /openjdk directory to CentOS 7 system of target.(Use DVD, CD, USB, etc.)
Almost finally, you should make a repo as below to install openjdk.
vi /etc/yum.repos.d/offline-openjdk.repo
[offline-openjdk]
name=offline-openjdk
baseurl=file:///openjdk
enabled=0
gpgcheck=1
Finally, you can use this command to finish the installation.
$ yum --disablerepo=\* --enablerepo=offline-openjdk install --nogpgcheck java-1.8.0-openjdk-devel.x86_64
I checked that this installation method able to used with CentOS 7.9-2009 (release date: 2020-09-29)
Thank you. Have a good day.
Answered By - Robot Jung Answer Checked By - Timothy Miller (WPSolving Admin)