YUM and FTP Server Configuration in RHEL 7 (Step by Step)

0

To show the mounted DVD or ISO image of RHEL-7.0.
[root@yum ~]# df  -h
/dev/sr0 3.5G 3.5G 0 100% /run/media/root/RHEL-7.0 Server.x86_64

This command will enter the all rpm packages directory from media DVD or local disk iso image.
[root@yum ~]# cd  /run/media/root/RHEL-7.0\ Server.x86_64/Packages/ 

For installing yum server we need to install two rpm packages named vsftpd and createrepo. We install thease package directly from media disk or iso image using rpm command.
[root@yum ~]# rpm   -ivh   vsftpd-3.0.2-9.el7.x86_64.rpm
warning: vsftpd-3.0.2-9.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing… ################################# [100%]
package vsftpd-3.0.2-9.el7.x86_64 is installed

[root@yum ~]# rpm   -ivh   createrepo-0.9.9-23.el7.noarch.rpm
warning: createrepo-0.9.9-23.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing… ################################# [100%]
package createrepo-0.9.9-23.el7.noarch is installed

Now, need to start and enable the vsftpd service. Enable is used for automatically start any service after booting the machine.
[root@yum ~]# systemctl   start   vsftpd
[root@yum ~]# systemctl  enable   vsftpd

To enable the firewall need to allow the ftp service.
[root@yum ~]# firewall-cmd     – -permanent     – -add-service=ftp
Success
[root@yum ~]# firewall-cmd     – -reload
Success

To copy the all rpm Packages to pub directory with parent :
[root@yum ~]# cd   /run/media/root/RHEL-7.0\ Server.x86_64/
[root@yum ~]# cp   -pfrv   Packages/    /var/ftp/pub/
real 5m23.665s
user 0m0.287s
sys 1m43.170s

This command will remove the default repo file or keep file as backup.
[root@yum ~]# rm   -fr   /etc/yum.repos.d/packagekit-media.repo
or
[root@yum ~]# mv   /etc/yum.repos.d/packagekit-media.repo /etc/yum.repos.d/packagekit-media.repo.bak

For installing rpm package using yum command need to create new repo file with proper syntax.
[root@yum ~]# vim    /etc/yum.repos.d/yum.repo
[YUM]
name=yum
baseurl=ftp://192.168.20.105/pub/Packages/
enabled=1
gpgcheck=0
:wq! (Save and Exit)

Database create using createrepo command:
[root@yum ~]# createrepo    –database    /var/ftp/pub/Packages/
Spawning worker 0 with 2153 pkgs
Spawning worker 1 with 2152 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

YUM clean:
[root@yum ~]# yum  clean  all
Cleaning repos: InstallMedia YUM
Cleaning up everything

YUM Repolist shown:
[root@yum ~]# yum   repolist   all
YUM | 2.9 kB 00:00:00
YUM/primary_db | 3.4 MB 00:00:00
repo id repo name status
InstallMedia RHEL-7.0 Server.x86_64 disabled
YUM yum enabled: 4,305
repolist: 4,305

If you need any queries please comment below, I will reply as soon as possible.