0

The local YUM repository is the most effective way to perform any type of package installation without any internet connection. If the yum repository has setup with the offline packages anyone with default package configurations. The main aim to create such a offline repository it works faster than online repository which can be configured locally.

How to Create Local YUM Repository

Step-1 (Mount the Local Media)

Mount the local media like CD, DVD, USB stick or ISO image to your PC.

Step-2 (Copy or Extract the Media)

You need to copy the data from your physical media to your local PC where the EL distro is installed. If you have ISO images of EL based distro to root of filesystem.

[root@techbrown ~]# cd /
[root@techbrown /]# mkdir localrepo

Copy the Local Media to localrepo DIR

[root@techbrown /]# cp -rv /media/* /localrepo/

Extract the ISO images to the localrepo DIR
Open the ISO image in Archive Manger the extract it to localrepo DIR.

Step-2 (Remove the Online Repository)
[root@techbrown ~]# rm -rf /etc/yum.repos.d/*
Step-3 (Create Local Repository)
[root@techbrown ~]# vim /etc/yum.repos.d/local.repo
For CentOS
[centos]
name=centos
baseurl=file:///localrepo/
enabled=1
gpgcheck=0
For RHEL
[rhel]
name=rhel
baseurl=file:///localrepo/
enabled=1
gpgcheck=0
For SL
[sl]
name=sl
baseurl=file:///localrepo/
enabled=1
gpgcheck=0
For OL
[ol]
name=ol
baseurl=file:///localrepo/
enabled=1
gpgcheck=0

to save and exit :wq!

Step-4 (Update the local Repository)

If you need to add local some packages to the repo you need to add to the db of local repository.

[root@techbrown ~]# createrepo /localrepo/
Step-5 (Enable the Local Repository)
[root@techbrown ~]# yum clean all
Sample output
Loaded plugins: fastestmirror, langpacks
Cleaning repos: centos7
Cleaning up everything
Cleaning up list of fastest mirrors
[root@techbrown ~]# yum repolist all
Sample Output
Loaded plugins: fastestmirror, langpacks
centos | 3.6 kB 00:00:00
(1/2): centos/group_gz | 154 kB 00:00:00
(2/2): centos/primary_db | 5.1 MB 00:00:00
Determining fastest mirrors
repo id repo name status
centos centos enabled: 8,652
repolist: 8,652
[root@techbrown ~]# yum update
Sample Output
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No packages marked for update
Step-6 (Test the local repository)

Install some package to test the repository

[root@techbrown /]# yum install gimp -y
Sample Output
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package 2:gimp-2.8.10-3.el.x86_64 already installed and latest version
Nothing to do

That’s all for now.

How to Mount NTFS File System on CentOS / RHEL

Previous article

How to Install cPanel and WHM on CentOS / RHEL

Next article

You may also like

Comments

Leave a reply

Your email address will not be published. Required fields are marked *

More in Linux