本地以及网络yum源的配置以及实现开机自动挂载镜像



配置本地yum源

将iso镜像文件挂在本地/var/ftp/pub/rhel7.0

vim  /etc/yum.repo.d/yum.repo     yum源配置文件总是以 .repo 结尾,如*.repo

[source]       yum 源名

name=rhel7         

baseurl=file:///var/ftp/pub/rhel7.0      file表示读取使用本地文件

gpgcheck=0/1     是否启用gpg检查gpgkey 0表示不检查  1表示检查 建议设为0


Yum clean all      更新yum源


配置网络yum源:

1、FTP

要求yum源主机上安装FTP服务,并将iso文件挂载到/var/ftp/pub/目录中的一个目录上    如将iso文件挂载到 /var/ftp/pub/rhel7.0。        源主机IP为172.25.11.250

在客户机上:

Vim   /etc/yum.repo.d/yum.repo 

[source]       

name=rhel7         

baseurl=ftp://172.25.10.250/pub/rhel7.0   当使用FTP网络yum源时,获取源文件方式为ftp://ftp源主机IP/pub/挂载目录     

gpgcheck=0/1 


yum clean all 

HTTP

要求yum源主机上安装apche服务,并将iso文件挂载到/var/www/html/目录中的一个目录上  如将iso文件挂载到 /var/www/html/rhel7.0     源主机IP为172.25.11.250


在客户机上

Vim /etc/yum.repo.d/yum.repo


[source]       

name=rhel7         

baseurl=http://172.25.10.250/rhel7.0   当使用HTTP网络yum源的时候获取文件方式为http://http源主机IP/挂载目录     

gpgcheck=0/1


yum clean all



如何实现iso镜像开机自动挂载、

Vim /etc/fstab


/rhel-server-7.0-x86_64-dvd.iso    /var/ftp/pub/rhel7.0  iso9660  ro,relatime  0  0

存放镜像的绝对路径       挂载点       类型    挂载参数(只读)    不备份 不检测

Mount  -a   重读挂载信息

将挂载项写进fstab 就可以实现开机自动挂载了




      

常见问题:1 作为yum源的主机对应的FTP或HTTP服务没有开启     

          2  yum源主机防火墙没有关闭




如果有写的不当的、请大家多多指教、、、