How to create a local repository for Linux OS

I always forget how to create a local repository, so make a note of it as a memorandum.

What is a local repository?

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.

Implementation procedure

In this article, I will introduce the procedure that I actually implemented and created. The procedure is roughly as follows.

  1. Place the iso file locally
  2. Mount the iso file
  3. Create a configuration file
  4. Check if the settings are correct

Place the iso file locally

Set up the iso file locally. This time, set it in / tmp. This time, I used the scp function of teraterm.

Mount the iso file

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

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

Check if the settings are correct

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

How to create a local repository for Linux OS
How to create a shortcut command for LINUX
How to create a repository from media
Create a local pypi repository
[Go] How to create a custom error for Sentry
How to create a Conda package
How to create a virtual bridge
How to create a Dockerfile (basic)
How to check Linux OS version
How to create a config file
How to create a SAS token for Azure IoT Hub
How to create a clone from Github
How to create a git clone folder
How to create * .spec files for pyinstaller.
How to install a package using a repository
How to create a label (mask) for segmentation with labelme (semantic segmentation mask)
How to install Windows Subsystem For Linux
How to create a Python virtual environment (venv)
How to create a JSON file in Python
Try to create a new command on linux
[Note] How to create a Ruby development environment
How to create a Kivy 1-line input box
How to set up a local development server
How to create a multi-platform app with kivy
How to create a Rest Api in Django
[Note] How to create a Mac development environment
What I learned by implementing how to create a Default Box for SSD
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
Read the Python-Markdown source: How to create a parser
Create a dataset of images to use for learning
How to create a submenu with the [Blender] plugin
Create a QR code for the URL on Linux
How to install Linux on a 32bit UEFI PC
How to build a development environment for TensorFlow (1.0.0) (Mac)
How to create a simple TCP server / client script
[Python] How to create a 2D histogram with Matplotlib
How to build a Python environment on amazon linux 2
How to create a kubernetes pod from python code
[Linux] How to put your IP in a variable
How to create a USB that Linux and Win10 installer and winpe can boot UEFI
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
A super introduction to Linux
How to call a function
How to hack a terminal
A memo on how to easily prepare a Linux exercise environment
How to set up Ubuntu for Windows Subsystem for Linux 2 (WSL2)
How to manage a README for both github and PyPI
How to make a hacking lab-Kali Linux (2020.1) VirtualBox 64-bit Part 2-
[For beginners] How to use for statements on Linux (variables, etc.)
How to create a flow mesh around a cylinder with snappyHexMesh
How to define multiple variables in a python for statement
How to make a hacking lab-Kali Linux (2020.1) VirtualBox 64-bit edition-
How to make a Python package (written for an intern)
[Python Kivy] How to create a simple pop up window
How to substitute a numerical value for a partial match (Note 1)
How to write a test for processing that uses BigQuery
I tried to create a bot for PES event notification
How to create an ISO file (CD image) on Linux
[PowerShell] How to search for rows like Linux grep (Windows)
I want to create a Dockerfile for the time being.
How to make a Japanese-English translation