发布时间 : 星期一 文章redhat yum源的搭建和使用更新完毕开始阅读261cfacfaaea998fcd220ea8
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=YES
2. 生成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-dvd enabled=1 gpgcheck=0
gpgkey=ftp://192.168.1.173/rhel-server-6.8-x86_64-dvd/RPM-GPG-KEY-redhat-release
清除缓存并下载新的镜像缓存
yum clean all yummakecache
此后,即可以轻松使用yum进行升级了。 (3)YUM升级
[root@localhostyum.repos.d]# yum update vsftpd
4. yum更新crash示例
[root@localhostyum.repos.d]#yum list crash
Loaded plugins: product-id, security, subscription-manager
This 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 id Repository 'rhel6.6' is missing name in configuration, using id Installed Packages
crash.x86_64 6.1.0-5.el6 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6 Available Packages
crash.x86_64 7.1.0-6.el6 rhel6.8
[root@localhostyum.repos.d]#yum install crash
Loaded plugins: product-id, security, subscription-manager
This 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 id Repository 'rhel6.6' is missing name in configuration, using id Setting up Install Process Resolving 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 Resolution
Dependencies Resolved
========================================================================================================
============================
Package Arch Version Repository Size
==================================================================================================================================== Updating:
crash x86_64 7.1.0-6.el6 rhel6.8 2.5 M
Transaction Summary
==================================================================================================================================== Upgrade 1 Package(s)
Total download size: 2.5 M Is this ok [y/N]: y
Downloading Packages:
crash-7.1.0-6.el6.x86_64.rpm | 2.5 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction
Updating : crash-7.1.0-6.el6.x86_64 1/2
Cleanup : crash-6.1.0-5.el6.x86_64 2/2
Verifying : crash-7.1.0-6.el6.x86_64 1/2
Verifying : crash-6.1.0-5.el6.x86_64 2/2
Updated:
crash.x86_64 0:7.1.0-6.el6
Complete!
[root@localhostyum.repos.d]# rpm -qa | grep crash crash-trace-command-1.0-5.el6.x86_64 crash-gcore-command-1.0-5.el6.x86_64 crash-7.1.0-6.el6.x86_64
5. yum回退crash示例
[root@localhostyum.repos.d]# yum history
Loaded plugins: product-id, security, subscription-manager
This 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@localhostyum.repos.d]# yum history info 8
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Transaction ID : 8
Begin time : Thu Jul 14 15:08:48 2016
Begin rpmdb : 647:2d2eea2db190bc270f3be0fe7a3f9b323a87d9a9 End time : 15:08:51 2016 (3 seconds)
End rpmdb : 647:adc517b57c083c03d3cfc3e0c005364c8ab5bcd0 User : root
Command Line : install crash Transaction performed with:
Installed rpm-4.8.0-37.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6
Installed 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.6 Installed yum-metadata-parser-1.1.2-16.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6 Packages Altered:
Updated crash-6.1.0-5.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6 Update 7.1.0-6.el6.x86_64 @rhel6.8 history info
[root@localhostyum.repos.d]# rpm -qa | grep crash crash-trace-command-1.0-5.el6.x86_64 crash-gcore-command-1.0-5.el6.x86_64 crash-7.1.0-6.el6.x86_64
[root@localhostyum.repos.d]# yum history undo 8
Loaded plugins: product-id, security, subscription-manager
This 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 id Repository 'rhel6.6' is missing name in configuration, using id Undoing transaction 8, from Thu Jul 14 15:08:48 2016
Updated crash-6.1.0-5.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201409260744.x86_64/6.6 Update 7.1.0-6.el6.x86_64 @rhel6.8 Resolving 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 Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================== Downgrading:
crash x86_64 6.1.0-5.el6 rhel6.6 2.3 M
Transaction Summary
==================================================================================================================================== Downgrade 1 Package(s)