Linux配置虚礼机的网络和yum源

来源:互联网 发布:js appendchild的用法 编辑:程序博客网 时间:2024/06/15 00:39
(一)修改网卡信息
[root@localhost Desktop]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:97:56:A8"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="b1dc6c1d-fa13-43f8-bebe-89a366860ee8"
BOOTPROTO=static
IPADDR=192.168.0.108
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
DNS=114.114.114.114
DNS1=8.8.8.8


(二)修改主机名称
[root@localhost Desktop]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost108


(三)IP和主机名的映射
[root@localhost Desktop]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.108 localhost108


(四)域名的解析
[root@localhost Desktop]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
search localhost108


(五)重启网络
[root@localhost Desktop]# service network restart


(六)关闭虚礼器,修改网络模式为桥连接,然后重启
(七)测试网络连接
[root@localhost Desktop]#ping www.baidu.com
测试成功!网络配置完成!








将Centos的yum源更换为国内的阿里云源
时间:2015-04-16 01:31来源:blog.csdn.net 作者:codemanship的专栏 举报 点击:114761次
阿里云Linux安装软件镜像源
阿里云是最近新出的一个镜像源。得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源。
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/
CentOS系统更换软件安装源
第一步:备份你的原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
第三步:运行yum makecache生成缓存
yum clean all
yum makecache