Centos7-Yum-使用光盘作为Yum源及变更阿里云为yum源
YUM源为本地光盘:
挂载光盘 # mkdir /mnt/centos/ # mount -t iso 9660 /dev/cdrom /mnt/cdrom/ //光驱设备 # mount -o loop /usr/local/centos-7-x86_64.iso /mnt/cdrom 变更yum文件 # vim /etc/yum.repos.d/CentOS-CD.repo baseurl=file:///mnt/cdrom/ enable=1 若需要关闭网络YUM源则 # mv CentOS-Base.repo CentOS-Base.repo.bak
若需要设置开机挂载
# vim /etc/rc.local (开机启动时,会执行该文件内的操作)
mount -t iso 9660 /dev/cdrom /mnt/cdrom/ 任意一条
mount -o loop /usr/local/centos-7-x86_64.iso /mnt/cdrom 任意一条
YUM源变更为阿里云:
方法一:下载相关repo文件
# cd /etc/yum.repo.d # mv CentOS-Base.repo CentOS-Base.repo.bak # wget http://mirrors.aliyun.com/repo/Centos-7.repo # mv Centos-7.repo CentOS-Base.repo # yum clean all # yum maecache # yum -C search 包名