Wise people learn when they can; fools learn when they must - Arthur Wellesley

Thursday, 2 March 2017

RHEL6-(12) CONFIGURE YUM REPO


RHEL6-(12) CONFIGURE YUM REPO

CONFIGURE YUM REPOSITORY:SERVER SIDE:RHEL-6:

Yellowdog updater, Modified (Yum) is a software package manager that installs, updates and removes packages on RPM-based Linux distributions. Yum makes it easier to maintain groups of machines without having to manually update each one using rpm and bothering about dependencies.

YUM VIA FTP:


[root@rhel6-client1 ~]# cd /media/
[root@rhel6-client1 media]# ls -l
total 0
[root@rhel6-client1 media]# cd /
[root@rhel6-client1 /]# mount -t iso9660 -o ro /dev/sr0 /media
[root@rhel6-client1 /]# cd /media/
[root@rhel6-client1 media]# ls -ltr
total 3428

[root@rhel6-client1 media]# ls -l /var/ftp/pub/
total 0
[root@rhel6-client1 media]# cd Packages
[root@rhel6-client1 Packages]# pwd
/media/Packages
[root@rhel6-client1 Packages]# ls -ltr |more
total 3347656
[root@rhel6-client1 Packages]# nice -19 cp * /var/ftp/pub/
[root@rhel6-client1 Packages]# cd /var/ftp/pub/

[root@rhel6-client1 pub]# ls -l |grep -i vsftp*
-r--r--r--. 1 root root   154392 Feb 16 13:02 vsftpd-2.2.2-11.el6.x86_64.rpm

[root@rhel6-client1 pub]# rpm -ivh vsftpd-2.2.2-11.el6.x86_64.rpm
warning: vsftpd-2.2.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
        package vsftpd-2.2.2-11.el6.x86_64 is already installed

Here it is already installed.

If not installed, then install it via above command and

[root@rhel6-client1 pub]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]

[root@rhel6-client1 pub]# service vsftpd status
vsftpd (pid 11657) is running...

[root@rhel6-client1 pub]# chkconfig --list vsftpd
vsftpd          0:off   1:off   2:off   3:off   4:off   5:off   6:off

[root@rhel6-client1 pub]# chkconfig vsftpd on

[root@rhel6-client1 pub]# chkconfig --list vsftpd
vsftpd          0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@rhel6-client1 pub]# ls -l |grep -i createrepo*
-r--r--r--. 1 root root    96124 Feb 16 12:59 createrepo-0.9.9-17.el6.noarch.rpm

[root@rhel6-client1 pub]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        python-deltarpm is needed by createrepo-0.9.9-17.el6.noarch

 [root@rhel6-client1 pub]# ls -l |grep -i deltarpm
-r--r--r--. 1 root root    72680 Feb 16 12:59 deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
-r--r--r--. 1 root root    27836 Feb 16 13:01 python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

[root@rhel6-client1 pub]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]

[root@rhel6-client1 pub]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]

[root@rhel6-client1 pub]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

[root@rhel6-client1 pub]# vi /etc/yum.repos.d/yumserver.repo
[localrepo]
name=localrepo
baseurl=file:///var/ftp/pub/
enabled=1
gpgcheck=0

:wq!

[root@rhel6-client1 pub]# createrepo -v /var/ftp/pub/

[root@rhel6-client1 pub]# yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
localrepo                                                                   | 2.9 kB     00:00 ...
localrepo/primary_db                                                        | 3.1 MB     00:00 ...
Setting up Update Process
No Packages marked for Update

[root@rhel6-client1 pub]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]

[root@rhel6-client1 pub]# chkconfig iptables off
[root@rhel6-client1 pub]# setsebool -P ftp_home_dir=1

[root@rhel6-client1 pub]# yum install samba
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.6.9-151.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package            Arch                Version                       Repository              Size
===================================================================================================
Installing:
 samba              x86_64              3.6.9-151.el6                 localrepo              5.0 M

Transaction Summary
===================================================================================================
Install       1 Package(s)

Total download size: 5.0 M
Installed size: 18 M
Is this ok [y/N]: y รง

CONFIGURE YUM REPOSITORY: CLIENT SIDE: RHEL-6:

[root@rhel6-test1 ~]# mount -t iso9660 -o ro /dev/sr0 /media

[root@rhel6-test1 ~]# cd /media/Packages/

[root@rhel6-test1 Packages]# ls -l vsftpd*
-r--r--r--. 47 root root 154392 May  9  2012 vsftpd-2.2.2-11.el6.x86_64.rpm
[root@rhel6-test1 Packages]# rpm -ivh vsftpd-2.2.2-11.el6.x86_64.rpm
warning: vsftpd-2.2.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]

[root@rhel6-test1 Packages]# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]

[root@rhel6-test1 Packages]# chkconfig vsftpd on
[root@rhel6-test1 Packages]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]

[root@rhel6-test1 Packages]# /etc/init.d/iptables save
[root@rhel6-test1 Packages]# chkconfig iptables off
[root@rhel6-test1 Packages]# vi /etc/yum.repos.d/client.repo
[client]
name=client
baseurl=ftp://192.168.110.135/pub/
enabled=1
gpgcheck=0

:wq!

[root@rhel6-test1 Packages]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: client
Cleaning up Everything

[root@rhel6-test1 Packages]# yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
client                                                                             | 2.9 kB     00:00
client/primary_db                                                                  | 3.1 MB     00:00
Setting up Update Process
No Packages marked for Update

[root@rhel6-test1 Packages]# yum install samba
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.6.9-151.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================
 Package               Arch                   Version                        Repository              Size
==========================================================================================================
Installing:
 samba                 x86_64                 3.6.9-151.el6                  client                 5.0 M

Transaction Summary
==========================================================================================================
Install       1 Package(s)

Total download size: 5.0 M
Installed size: 18 M
Is this ok [y/N]: n
Exiting on user Command
[root@rhel6-test1 Packages]#
ERROR:

[root@dr01 ~]# yum install samba
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ftp://192.168.234.153/pub/repodata/repomd.xml: [Errno 14] PYCURL ERROR 9 - "Server denied you to change to the given directory"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: client. Please verify its path and try again

[root@dr01 Packages]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: client
Cleaning up Everything
[root@dr01 Packages]# yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ftp:///192.168.234.153/pub/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp:'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: client. Please verify its path and try again

[root@dr01 Packages]# yum repolist all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ftp://192.168.234.153/pub/repodata/repomd.xml: [Errno 14] PYCURL ERROR 9 - "Server denied you to change to the given directory"
Trying other mirror.
repo id                            repo name                          status
client                             client                             enabled: 0
repolist: 0
[root@dr01 Packages]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: client
Cleaning up Everything
[root@dr01 Packages]# yum info kernel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ftp://192.168.234.153/pub/repodata/repomd.xml: [Errno 14] PYCURL ERROR 9 - "Server denied you to change to the given directory"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: client. Please verify its path and try again

[root@dr01 Packages]# ls -l ftp*
-r--r--r--. 66 root root 59060 Nov  9  2012 ftp-0.17-53.el6.x86_64.rpm
[root@dr01 Packages]# rpm -ivh ftp-0.17-53.el6.x86_64.rpm
warning: ftp-0.17-53.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:ftp                    ########################################### [100%]
[root@dr01 Packages]#

[root@dr01 Packages]# yum clean all
[root@dr01 Packages]# yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ftp://192.168.234.153/pub/repodata/repomd.xml: [Errno 14] PYCURL ERROR 9 - "Server denied you to change to the given directory"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: client. Please verify its path and try again
[root@dr01 Packages]# ftp 192.168.234.153
Connected to 192.168.234.153 (192.168.234.153).
220 (vsFTPd 2.2.2)
Name (192.168.234.153:root): root
530 Permission denied.
Login failed.
ftp> bye
221 Goodbye.
[root@dr01 Packages]#

[root@pr01 ~]# ls -ld /var/ftp/pub
drwxr-xr-x. 3 root root 249856 Feb 28 22:21 /var/ftp/pub
[root@pr01 ~]# chmod 777 /var/ftp/pub
[root@pr01 ~]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@pr01 ~]#

[root@pr01 ~]# yum install -y ftp
[root@pr01 ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@pr01 ~]#
You should never connect as root over FTP. It is an old and insecure protocol and there really is no reason why you would want to use it as root. Look into ssh or sftp as alternatives.

That said, if you really want to open this huge security hole, you will need to edit your /etc/vsftpd.conf file and add or uncomment this line:

 local_enable=YES



echo "userlist_deny=NO" >> /etc/vsftpd/vsftpd.conf

yum clean all
rm -f /var/lib/rpm/__db*
rpm --rebuilddb







No comments:

Post a Comment