Detailed steps for YUM local warehouse setup under CentOS 7
- 2020-06-23 02:22:30
- OfStack
Detailed steps for YUM local warehouse setup under CentOS 7
Use CentOS7.iso to set up the local warehouse
(1) Copy the CentOS7.iso file to the user's home directory: ~
cp CentOS7.iso ~
(2) Create the directory where the iso file will be hung
mkdir -p /mnt/cdrom
(3) Hang in the iso file in the directory just created
mount -o loop CentOS7.iso /mnt/cdrom
(4) Create repo file Local.repo and then add the following content to it
vim /etc/yum.repos.d/Local.repo
[Local]
name=Local Yum
baseurl=file:///mnt/cdrom
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
PS: There is no need to create index files using createrepo because the index files in ISO are already created in the repodata folder
Create a custom local YUM source
In this way, we have collected 1 RPM packages, and we want to make the RPM packages into our own YUM warehouse, which is convenient for offline installation and very flexible.
(1) Create the local warehouse directory, for example, I (root) create local directory in the home directory
mkdir /root/local
(2) Move all the sorted RPM packages to this directory
mv *.rpm /root/local
(3) createrepo installation
yum -y install createrepo
(3) Use createrepo to create indexes
createrepo /root/local
(4) Create repo file
vim /etc/yum.repos.d/Local.repo
Enter the following
[Local]
name=Local Yum
baseurl=file:///root/local
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
At this point, the local repository has been created in both of the above ways, and all you need to do is update the cache
yum makecache
If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!