Sunday 6 March 2022

How to Configure Local Synced YUM repository on CentOS 7 using vsFTP



YUM (YellowDog Updater Modified) is a package management tool for RPM based Linux system that helps to install, uninstall, and update packages. Local yum repository is used to save bandwidth, fasten package installations, network installations and systems updates for n numbers of systems in a local area network.
 
This article describes How to Configure Local Synced YUM repository on CentOS 7 using vsFTP Server.
 
Step 1. Install vsFTP Server: Follow the article How to Install and Configure Anonymous vsFTP Server on CentOS 7.
 
Step 2. Configure Local Yum Repo: Run the following command to install packages to manage repo: 
 
[root@linuxcnf ~]# yum install yum-utils createrepo -y
Loaded plugins: fastestmirror
…………………….
Installed:
  createrepo.noarch 0:0.9.9-28.el7      yum-utils.noarch 0:1.1.31-54.el7_8
 
Complete!
[root@linuxcnf ~]#
 
Step 3. Sync Repository Data: Run the following command to sync the repository from CentOS repository: 
 
[root@linuxcnf ~]# mkdir –p /var/ftp/base
[root@linuxcnf ~]# reposync --gpgcheck -l --repoid=base --newest-only --download_path=/var/ftp/base/
Loaded plugins: fastestmirror
…………………..
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# mkdir –p /var/ftp/extras
[root@linuxcnf ~]# reposync --gpgcheck -l --repoid=extras –newest-only --download_path=/var/ftp/extras/
Loaded plugins: fastestmirror
……………………..
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# mkdir –p /var/ftp/updates
[root@linuxcnf ~]# reposync --gpgcheck -l --repoid=updates --newest-only --download_path=/var/ftp/updates/
Loaded plugins: fastestmirror
……………………..
[root@linuxcnf ~]#
 
Step 4. Update Repository: Run the following commands to update and create metadata for local repository: 
 
[root@linuxcnf ~]# createrepo /var/ftp/base/
Spawning worker 0 with 10072 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# createrepo /var/ftp/extras/
Spawning worker 0 with 277 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# createrepo /var/ftp/updates/
Spawning worker 0 with 1508 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@linuxcnf ~]#
 
Step 6. Verify the Configuration: Configure the repository on client as below and validate if it is working or not. Move all the exiting repo files from the location /etc/yum.repos.d/ to other location and create a new file with the below contents:
 
[root@linuxcnf ~]# vi /etc/yum.repos.d/mylocal.repo
[mylocalrepo-Base]
name=Local Sync Base Repo
baseurl=http://192.168.1.104/base/
gpgcheck=0
enabled=1
 
[mylocalrepo-Extras]
name=Local Sync Extras Repo
baseurl=http://192.168.1.104/extras/
gpgcheck=0
enabled=1
 
[mylocalrepo-Updates]
name=Local Sync Updates Repo
baseurl=http://192.168.1.104/updates/
gpgcheck=0
enabled=1
 
Save the file and finally Run the below command to check the repo status:
 
[root@linuxcnf ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: mylocalrepo-Base mylocalrepo-Extras mylocalrepo-Updates
Cleaning up list of fastest mirrors
Other repos take up 167 M of disk space (use --verbose for details)
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
mylocalrepo-Base                                         | 2.9 kB     00:00
mylocalrepo-Extras                                       | 2.9 kB     00:00
mylocalrepo-Updates                                      | 2.9 kB     00:00
(1/3): mylocalrepo-Extras/primary_db                       | 136 kB   00:00
(2/3): mylocalrepo-Updates/primary_db                      | 1.9 MB   00:00
(3/3): mylocalrepo-Base/primary_db                         | 6.1 MB   00:00
repo id                            repo name                              status
mylocalrepo-Base                   Local Sync Base Repo                   10,072
mylocalrepo-Extras                 Local Sync Extras Repo                    277
mylocalrepo-Updates                Local Sync Updates Repo                 1,508
repolist: 11,857
[root@linuxcnf ~]#
 
Done!!! Local yum Repositories is configured using vsFTP (FTP Server) and synced with CentOS 7 base repository data on CentOS 7. Run the repo sync command on periodically to sync the data.

No comments:

Post a Comment