创建本地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 restart
Stopping 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 -Base
baseurl=http://10.93.58.70/centos6/
enabled=1
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
[extra]
name=CentOS-$releasever -extras
baseurl=http://10.93.58.70/centos6/extras/
enabled=0
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
[update]
name=CentOS-$releasever -updates
baseurl=http://10.93.58.70/centos6/updates/
enabled=0
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
5,最后测试一下镜像
[root@Ansible ~]#yum repolist
Loaded plugins: aliases,changelog,fastestmirror,kabi,ovl,presto,refresh-packagekit,
: security,tmprepo,verify,versionlock
Loading support for CentOS kernel ABI
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 -Base 6,713
repolist: 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