当前位置:文档之家› redhat yum源的搭建和使用

redhat yum源的搭建和使用

redhatyum源的搭建和使有SDON一、yumftp源的搭建1.安装createrepo和vsftpd并配置FTP服务器1、安装rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm #createrepo.noarch --- 用于生成repodata 数据库,生成依赖性关系rpm -ivh vsftpd-2.0.5-16.el5_4.1.i386.rpm # 上面的软件包在光盘或者是网上都有,可以直接下载使用。

2、ftp配置(1)vsftp的匿名用户为linux系统的ftp用户,可以修改/etc/passwd,将ftp用户的home目录从/var/ftp 更改为你的目标路径。

这里改为/hbbackup/yum/启动vsftp:servicevsftpdstart;chkconfigvsftp on注意:注意修改/hbbackup/yum/目前权限。

(2)配置匿名用户vi /etc/vsftpd/vsftpd.conf# Allow anonymous FTP? (Beware - allowed by default if you comment this out).anonymous_enable=YES2.生成yum源。

挂载镜像文件:mount -o loop rhel-server-6.8-x86_64-dvd.iso /cdrom复制镜像文件:cp -r /cdrom /* /hbbackup/yum/rhel-server-6.8-x86_64-dvd生成repodata:#cd /hbbackup/yum/rhel-server-6.8-x86_64-dvd#createrepo .默认就会在/hbbackup/yum/rhel-server-6.8-x86_64-dvd,下面有filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml四个文件。

对于其他光盘也可以采用类似的方式实现,这里不再赘述。

3.客户端的配置(1)安装yum包这里不在赘述,对redhat默认安装就有,但是对于RHEL的,请在网上下载相应的yum套装进行安装。

(2)配置客户端/etc/yum.repos.d/源配置文件[root@localhostyum.repos.d]# catrhel-source.repo[rhel-source]baseurl=ftp://192.168.1.173/rhel-server-6.8-x86_64-dvdenabled=1gpgcheck=0gpgkey=ftp://192.168.1.173/rhel-server-6.8-x86_64-dvd/RPM-GPG-KEY-redhat-release清除缓存并下载新的镜像缓存yum clean allyummakecache此后,即可以轻松使用yum进行升级了。

(3)YUM升级[root@localhostyum.repos.d]# yum update vsftpd4.yum更新crash示例[root@localhostyum.repos.d]#yum list crashLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository 'rhel6.8' is missing name in configuration, using idRepository 'rhel6.6' is missing name in configuration, using idInstalled Packagescrash.x86_64 6.1.0-5.el6@anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Available Packagescrash.x86_64 7.1.0-6.el6 rhel6.8[root@localhostyum.repos.d]#yum install crashLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository 'rhel6.8' is missing name in configuration, using idRepository 'rhel6.6' is missing name in configuration, using idSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package crash.x86_64 0:6.1.0-5.el6 will be updated---> Package crash.x86_64 0:7.1.0-6.el6 will be an update--> Finished Dependency ResolutionDependencies Resolved====================================================================================================================================Package Arch Version Repository Size======================================================================================================== ============================Updating:crash x86_64 7.1.0-6.el6 rhel6.82.5 MTransaction Summary======================================================================================================== ============================Upgrade 1 Package(s)Total download size: 2.5 MIs this ok [y/N]: yDownloading Packages:crash-7.1.0-6.el6.x86_64.rpm| 2.5 MB 00:00Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionUpdating : crash-7.1.0-6.el6.x86_641/2Cleanup : crash-6.1.0-5.el6.x86_642/2Verifying : crash-7.1.0-6.el6.x86_641/2Verifying : crash-6.1.0-5.el6.x86_642/2Updated:crash.x86_64 0:7.1.0-6.el6Complete![root@localhostyum.repos.d]# rpm -qa | grep crashcrash-trace-command-1.0-5.el6.x86_64crash-gcore-command-1.0-5.el6.x86_64crash-7.1.0-6.el6.x86_645.yum回退crash示例[root@localhostyum.repos.d]# yum historyLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.ID | Login user | Date and time | Action(s) | Altered-------------------------------------------------------------------------------8 | root <root> | 2016-07-14 15:08 | Update | 17 | root <root> | 2016-07-14 15:01 | Downgrade | 26 | root <root> | 2016-07-14 14:33 | Update | 25 | root <root> | 2016-07-14 14:31 | Update | 14 | root <root> | 2016-07-14 13:43 | Update | 33 | root <root> | 2016-07-13 17:20 | I, U | 42 | root <root> | 2016-07-13 17:17 | Update | 1 <1 | System <unset> | 2016-07-01 12:48 | Install | 644>history list[root@localhostyum.repos.d]# yum history info 8Loaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Transaction ID : 8Begin time : Thu Jul 14 15:08:48 2016Begin rpmdb : 647:2d2eea2db190bc270f3be0fe7a3f9b323a87d9a9End time : 15:08:51 2016 (3 seconds)End rpmdb : 647:adc517b57c083c03d3cfc3e0c005364c8ab5bcd0User : root <root>Return-Code : SuccessCommand Line : install crashTransaction performed with:Installed rpm-4.8.0-37.el6.x86_64@anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Installed subscription-manager-1.12.14-7.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6 Installed yum-3.2.29-60.el6.noarch@anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Installed yum-metadata-parser-1.1.2-16.el6.x86_64@anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Packages Altered:Updated crash-6.1.0-5.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Update 7.1.0-6.el6.x86_64 @rhel6.8history info[root@localhostyum.repos.d]# rpm -qa | grep crashcrash-trace-command-1.0-5.el6.x86_64crash-gcore-command-1.0-5.el6.x86_64crash-7.1.0-6.el6.x86_64[root@localhostyum.repos.d]# yum history undo 8Loaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Repository 'rhel6.8' is missing name in configuration, using idRepository 'rhel6.6' is missing name in configuration, using idUndoing transaction 8, from Thu Jul 14 15:08:48 2016Updated crash-6.1.0-5.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6Update 7.1.0-6.el6.x86_64 @rhel6.8Resolving Dependencies--> Running transaction check---> Package crash.x86_64 0:6.1.0-5.el6 will be a downgrade---> Package crash.x86_64 0:7.1.0-6.el6 will be erased--> Finished Dependency ResolutionDependencies Resolved======================================================================================================== ============================Package Arch Version Repository Size======================================================================================================== ============================Downgrading:crash x86_64 6.1.0-5.el6 rhel6.62.3 MTransaction Summary======================================================================================================== ============================Downgrade 1 Package(s)Total download size: 2.3 MIs this ok [y/N]: yDownloading Packages:crash-6.1.0-5.el6.x86_64.rpm| 2.3 MB 00:00Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : crash-6.1.0-5.el6.x86_641/2Cleanup : crash-7.1.0-6.el6.x86_642/2Verifying : crash-6.1.0-5.el6.x86_641/2Verifying : crash-7.1.0-6.el6.x86_642/2Removed:crash.x86_64 0:7.1.0-6.el6Installed:crash.x86_64 0:6.1.0-5.el6Complete![root@localhostyum.repos.d]# rpm -qa | grep crashcrash-trace-command-1.0-5.el6.x86_64crash-6.1.0-5.el6.x86_64crash-gcore-command-1.0-5.el6.x86_64[root@localhostyum.repos.d]#6.配置过程遇到问题:(1)Vsftpd出现refusing to run with writable anonymous rootyum makecache时碰到这个错误:500 OOPS: vsftpd: refusing to run with writable anonymous root对于vsftpd的根目录/home/ftp 其权限为:drwxrwxrwx即完全没有限制(或许是不小心执行了chmod 777 /home/ftp);但vsftpd出于安全考虑对/home/ftp是不允许没有限制的,这导致了上述错误的发生。

相关主题