创建本地yum源
1,安装一个Apache环境,我这里就是采用yum安装,比较方便。
[root@Ansible ]#yum -y install httpd
稍微改一下配置文件即可
[root@Ansible ]# vim /etc/httpd/conf/httpd.conf 改一下ServerName ServerName 10.93.58.70:80
重启一下服务
[root@Ansible ]# /etc/init.d/httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]
最后在浏览器上输入http://10.93.58.70/如果有http默认的页面就对了。
2,新建一个centos6文件夹
[root@Ansible ]#mkdir -p /var/www/html/centos6
3,挂载一个ISO镜像文件,并将文件拷贝到/var/www/html/centos6路径下面
[root@Ansible ]#mount /dev/dvd/ /mnt/[root@Ansible ]#cd /mnt[root@Ansible mnt ]# cp -rp ./* /var/www/html/centos6/
4,删除 /etc/yum.repods.d下面的文件只保留CentOS-Base.repo
[root@Ansible yum.repos.d]#vim CentOS-Base.repo[base]name=CentOS-$releasever -Basebaseurl=http://10.93.58.70/centos6/enabled=1gpgcheck=0gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
5,最后测试一下镜像
[root@Ansible ~]#yum repolistLoaded plugins: aliases, changelog, fastestmirror, kabi, ovl, presto, refresh-packagekit, : security, tmprepo, verify, versionlockLoading support for CentOS kernel ABILoading mirror speeds from cached hostfilerepo id repo name statusbase CentOS-6 -Base 6,713repolist: 6,713
6,把这台设置好的CentOS-Base.repo拷贝一份直接导入到新安装的系统里面去这样就可以使用本地的yum源了。
[root@Ansible ~]# scp -rp /etc/yum.repos.d/CentOS-Base.repo root@10.93.58.72: /etc/yum.repos.d/CentOS-Base.repo[root@Ansible ~]#yum repolist
7.结束,收工!