[Linux] How to Create a Local Repository From a RPM File
Posted On 2019-10-19
Usually we will create a local repository for our intranet machines to use. So your mirror repository machine can connect to the internet, but sometimes we just want to create a offline repository to use what should we do?
Step1 Get RPM File & Install
Supposed you already have a local repository which is running by apache2 or nginx. Like the example below:
│ ├── nginx
│ │ └── repodata
You can see we put single 3rdparty's rpm to each folder. For example you can see nginx folder.
First you need to download the rpm file you want.
# Nginx http://nginx.org/packages/rhel/7Server/x86_64/RPMS/
# or http://nginx.org/packages/mainline/rhel/7Server/x86_64/RPMS/
mv nginx-1.17.4-1.el7.ngx.x86_64.rpm /repo/mirror/3rdparty/nginx
createrepo -v /repo/mirror/3rdparty/nginx
Then you will see your local repository have a new repository for nginx.
Step2 Create REPO file for the machine you need
name=Nginx Local Repository
Now, you can install the package you need.
yum install nginx
Understanding Red Hat Content Delivery Network Repositories and their usage with Satellite 6