Linux yum的配置使用和程序包的编译安装(4)

[root@localhost yum.repos.d]# yum provides /bin/ls Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.cn99.com * updates: mirrors.aliyun.com coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts Repo : base Matched from: Filename : /bin/ls coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts Repo : @anaconda Matched from: Filename : /bin/ls

yum provides举例

9.清理本地缓存

yum clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]

10.构建缓存

yum makecache

11.搜索

yum search string1 [string2] [...] #以指定的关键字搜索程序包及Summary信息

12.查看指定包所依赖的capabilities

yum deplist package1 [package2] [...]

13.查看yum事务历史

yum history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]

14.安装及升级本地程序包

yum localinstall rpmfile1 [rpmfile2] [...] (maintained for legacy reasons only - use install) yum localupdate rpmfile1 [rpmfile2] [...] (maintained for legacy reasons only - use update)

15.包组管理的相关命令

yum groupinstall group1 [group2] [...] yum groupupdate group1 [group2] [...] yum grouplist [hidden] [groupwildcard] [...] yum groupremove group1 [group2] [...] yum groupinfo group1 [...]

16.yum的命令选项

--nogpgcheck:禁止进行gpg check; -y: 自动回答为“yes”; -q:静默模式; --disablerepo=repoidglob:临时禁用此处指定的repo; --enablerepo=repoidglob:临时启用此处指定的repo; --noplugins:禁用所有插件;

如何使用光盘当作本地yum repository?

(1)挂载光盘至某目录,例如/media/cdrom

[root@localhost yum.repos.d]# mount -r /dev/sr0 /media/cdrom/ [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/cl-root 17811456 2824736 14986720 16% / devtmpfs 489004 0 489004 0% /dev tmpfs 499980 0 499980 0% /dev/shm tmpfs 499980 6728 493252 2% /run tmpfs 499980 0 499980 0% /sys/fs/cgroup /dev/sda1 1038336 123500 914836 12% /boot tmpfs 100000 0 100000 0% /run/user/0 /dev/sr0 4276440 4276440 0 100% /media/cdrom

 

(2)创建配置文件

先把本地的CentOS-Base.repo备份一下

 

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [root@localhost yum.repos.d]# vim CentOS-Local.repo [CentOS7] name=CentOS7 rpm from disk baseurl=file:///media/cdrom/ gpgcheck=0 [root@localhost cdrom]# yum repolist #显示可用的仓库列表 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status CentOS7 CentOS7 rpm from disk 3,831 repolist: 3,831 [root@localhost cdrom]# 

如何创建yum仓库?

前面写到baseurl指向的yum repository的下必须有repodata目录,repodata目录下存放着元数据和特征码等信息,那么如何生存呢?

我们现在/xfs目录下放了一些关于xfs的rpm包:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13477.html