I always forget how to create a local repository, so make a note of it as a memorandum.
When I want to install a new tool on Linux OS, I think that it is normal to install the package from the repository prepared by commands such as yum and apt, but if for some reason I can not connect to the Internet, it is as it is The prepared package cannot be used with.
As a method for devices that cannot connect to the Internet to use the package, the package can be installed by preparing the iso file used for installation locally and setting the yum target to that iso file. This method is a recognition called a local repository.
In this article, I will introduce one of the methods.
In this article, I will introduce the procedure that I actually implemented and created. The procedure is roughly as follows.
Set up the iso file locally. This time, set it in / tmp. This time, I used the scp function of teraterm.
Next, mount the installed iso file. This time, create a directory called / var / yum / localdvd and mount it there.
Execution command
# mkdir -p /var/yum/localdvd
# mount -t iso9660 -o loop /tmp/[ISO file name]/var/yum/localdvd
Create a configuration file that uses the mounted iso file as a local repository.
Execution command
# vim /etc/yum.repos.d/localdvd.repo
conf:/etc/yum.repos.d/localdvd.repo
[localdvd]
name=localdvd
baseurl=file:///var/yum/localdvd
enabled=1
gpgcheck=no
Execute the following command to display the list of packages and check if the settings are reflected correctly. If set correctly, a list of lists will be displayed.
Execution command
# yum --disablerepo=\* --enablerepo=localdvd list
After that, you can use the yum install command to specify the installation of the packages in the package list even if you do not have an internet connection.
Recommended Posts