手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

搭建CnetOS6.5 x64最小化系统及在线yum源的配置

[日期:2017-06-18] 来源:Linux社区  作者:jasmine-Jobs [字体: ]

相关问题说明:

当配置在线yum源成功后,进行yum clean all之后,用yum makecache生成yum缓存时,报如下错误:

[root@xiaolyu11 network-scripts]# yum makecache
Loaded plugins: fastestmirror, security
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/CentOS/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'Connection time-out')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[root@xiaolyu11 network-scripts]#

解决方法:

1. 修改DNS。添加辅助dns。

[root@xiaolyu11 network-scripts]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE
=eth0
TYPE
=Ethernet
ONBOOT
=yes
NM_CONTROLLED
=yes
BOOTPROTO
=static
IPADDR
=192.168.31.11
NETMASK
=255.255.255.0
GETWAY
=192.168.31.1
DNS1
=8.8.8.8
DNS2
=8.8.4.4

也就是ifcfg-eth0末尾添加两行DNS配置,如果原来有8.8.8.8,那么也一定要加上8.8.4.4,这两个地址是google提供的免费DNS服务器的IP地址。

2. 重启network 服务

[root@xiaolyu11 network-scripts]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining
if ip address 192.168.31.11 is already in use for device eth0...
                                                          [  OK  ]
该警告一般是由于网卡解析arp协议导致的,可在网卡的配置文件中加入ARPCHECK=NO参数来屏蔽该检查

[root@xiaolyu11 network-scripts]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE
=eth0
TYPE
=Ethernet
ONBOOT
=yes
NM_CONTROLLED
=yes
BOOTPROTO
=static
IPADDR
=192.168.31.11
NETMASK
=255.255.255.0
GETWAY
=192.168.31.1
DNS1
=8.8.8.8
DNS2
=8.8.4.4
ARPCHECK
=no 

网卡配置文件末尾添加:ARPCHECK=no

再次重启网络服务:

3. yum makecache,成功:

[root@xiaolyu11 network-scripts]# yum makecache
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                     | 3.7 kB     00:00     
base/group_gz                                                            | 226 kB     00:00     
base/filelists_db                                                        | 6.4 MB     00:06     
base/primary_db                                                          | 4.7 MB     00:04   

如果在配置在线yum源的过程中,也出现关于镜像地址问题,尤其是宿主机和虚拟机可以通信,虚拟机又可以ping www.baidu.com通常的情况下,

请按照上面的方面进行解决。

四、快照和克隆:

说明快照和克隆,必须在虚拟机中,不能在xshell中进行。

1. 快照:

 

快照比较简单,这里不详细描述。

2. 克隆:

首先说明:要克隆一个虚拟机,必须是在虚拟机关机的情况下才可以克隆,所以克隆一个虚拟机之前,应该先将该虚拟机关机。

在VMware中选择->【VM】->【Manage】->【clone】:

进入如下界面:

克隆完成后,需要做的相关工作:

1)开机运行虚拟机,vim /etc/sysconfig/network-scripts/ifcfg-eth0 

     删掉mac地址和uuid,不然的话和我原来的机器一模一样,这个克隆机还是不能用。下次重启的时候会自动生成新的mac地址和uuid。

如果有ip地址,ip地址也要修改。

我这里暂时还没有做集群,所以主机名,这里就不修改了。修改方法见上面。

原配置文件:

修改后的配置文件:

2)删掉网卡。

   rm-rf   /etc/udev/rules.d/70-persistent-net.rules

 

重启系统:reboot

有一点:我也很奇怪:就是为什么配置文件中没有mac地址和uuid呢?

vim /etc/sysconfig/network-scripts/ifcfg-eth0

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-06/144904.htm

linux
相关资讯       YUM源配置  CnetOS6.5 x64最小化系统 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款