java – CentOS 7 : How can i install open-jdk on a computer that cannot connect to the Internet? (using yum install command)
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.
Read more here: Source link