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.
Step 1. Install HTTP Web
Server: Follow the article How to
Install Apache/httpd Web 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 base, extras and updates repositories from CentOS repository:
[root@linuxcnf ~]# mkdir –p /var/www/html/base [root@linuxcnf ~]# reposync --gpgcheck -l
--repoid=base --newest-only --download_path=/var/www/html/base/ Loaded plugins:
fastestmirror
…………………..
[root@linuxcnf ~]#
|
[root@linuxcnf ~]# mkdir –p /var/www/html/extras [root@linuxcnf ~]# reposync --gpgcheck -l --repoid=extras
–newest-only --download_path=/var/www/html/extras/
Loaded plugins:
fastestmirror
……………………..
[root@linuxcnf ~]#
|
[root@linuxcnf ~]# mkdir –p /var/www/html/updates [root@linuxcnf ~]# reposync --gpgcheck -l
--repoid=updates --newest-only --download_path=/var/www/html/updates/
Loaded plugins:
fastestmirror
……………………..
[root@linuxcnf ~]#
|
Step 4. Update Repository: Run
the following commands to update and create metadata for local repository:
Step 5. Configure HTTP Service:
Open the HTTP configuration file and find
“Directory” and replace path with /var/www/html/Base.
Also find “Options Indexes FollowSymLinks” and change it to “Options All Indexes FollowSymLinks” as
shown below screen:
[root@linuxcnf ~]# createrepo /var/www/html/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/www/html/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/www/html/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 ~]#
|
[root@linuxcnf ~]# vi /etc/httpd/conf/httpd.conf
…………………….
<Directory
"/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access
to the default document root:
<Directory
"/var/www/html">
#
…………………….
#
Options All Indexes FollowSymLinks
…………………….
[root@linuxcnf ~]#
|
Step 6. Restart HTTP Service:
Run the following command to restart the service to reflect the changes:
[root@linuxcnf ~]# systemctl restart httpd
[root@linuxcnf ~]#
|
Step 7. 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/ and create a new file with the below
contents:
[root@linuxcnf ~]# vi /etc/yum.repos.d/mylocal.repo
[mylocalrepo-base]
name=Local Sync Repo -
Base
baseurl=http://192.168.1.103/base/
gpgcheck=0
enabled=1
[mylocalrepo-extras]
name=Local Sync Repo -
Extras
baseurl=http://192.168.1.103/extras/
gpgcheck=0
enabled=1
[mylocalrepo-updates]
name=Local Sync Repo -
Updates
baseurl=http://192.168.1.103/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
Cleaning up list of
fastest mirrors
Other repos take up
317 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 Repo - Base 10,072
mylocalrepo-extras Local Sync Repo - Extras 277
mylocalrepo-updates Local Sync Repo - Updates 1,508
repolist: 11,857
[root@linuxcnf ~]# |
No comments:
Post a Comment