linux下的yum的安装和配置

1、挂载DVD光盘到/mnt   因为配置时候路径名里面不能有空格,否则不能识别  [root@ mnt]# mount /dev/cdrom /mnt  

2、在目录/etc/yum.repos.d/创建文件文件名.repo 

3、配置本地yum源

cd /etc/yum.repos.d/   #进入yum配置目录 

touch  rhel7.repo   #建立yum配置文件 

vim  rhel7.repo   #编辑配置文件,添加以下内容 

[rhel-yum]
 
name=rhel7
 
baseurl=file:///mnt
 
enabled=1
 
gpgcheck=0

4、测试使用yum命令自动安装软件

yum clean all   #清除yum缓存 

yum makecache  #缓存本地yum源中的软件包信息

5、安装软件

例如安装mlocate

yum -y install mlocate

6、查询

例如查询所有安装httpd的目录和文件

rpm -ql mlocate