12345678
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 #网卡接口名称 HWADDR=00:0C:29:87:9D:1D #硬件地址(MAC地址) TYPE=Ethernet #网上类型 UUID=3efbea06-751a-4add-bec7-13db4d19bc0d #网卡唯一标识符 ONBOOT=no #开机是否启动 NM_CONTROLLED=yes#设备eth0是否可以由Network Manager图形管理工具托管 BOOTPROTO=dhcp #IP地址的获取方式12345678910111213141516171819202122232425[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 HWADDR=00:0C:29:87:9D:1D TYPE=Ethernet UUID=3efbea06-751a-4add-bec7-13db4d19bc0d ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=dhcp 有朋友肯定是会急着去启动网卡服务了,CentOS 5下不会报错,但是在CentOS6下网络服务重启后,ip配置发生了错误!原来CentOS6下的网卡的主配置文档中,默认下有NM_CONTROLLED=yes这么一行,这意味着网卡eth0得有 NetworkManager托管,这行中的yes|no的开关控制项的修改是即时生效的,你可以改为no保存后,立即可以解决上述问题!下面我们来修改一下![root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 HWADDR=00:0C:29:87:9D:1D TYPE=Ethernet UUID=3efbea06-751a-4add-bec7-13db4d19bc0d ONBOOT=yesNM_CONTROLLED=no BOOTPROTO=dhcp[root@web ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0:Determining IP information foreth0... done. [ OK ] [root@web ~]#1234567891011[root@localhost ~]# !vimvim/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0HWADDR=00:0C:29:87:9D:1DTYPE=EthernetUUID=3efbea06-751a-4add-bec7-13db4d19bc0dONBOOT=yesBOOTPROTO=dhcp(3). 删除/etc/udev/rules.d/70-persistent-net.rules 并重启即可[root@localhost ~]# rm –rf /etc/udev/rules.d/70-persistent-net.rules[root@localhost ~]# reboot
1234567[root@web ~]# vim /etc/sysconfig/networkNETWORKING=yesHOSTNAME=web.test.com[root@web ~]# vim /etc/hosts127.0.0.1 web web.test.com localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6[root@localhost ~]# reboot
123456[root@web ~]# vim /etc/resolv.conf; generated by/sbin/dhclient-scriptsearch sh.jjhh.comtest.comnameserver 211.95.1.97#上海联通DNSnameserver 8.8.8.8#google DNS#说明:nameserver 最多可以设置三个
12345[root@localhost ~]# ls -l /etc/yum.repos.d/total 16-rw-r--r-- 1 root root 2245 Apr 26 2010 CentOS-Base.repo-rw-r--r-- 1 root root 626 Apr 26 2010 CentOS-Media.repo[root@localhost ~]#123456[root@web ~]# ls -l /etc/yum.repos.d/total16-rw-r--r--.1root root1926Feb2516:57CentOS-Base.repo #是网络源,默认使用-rw-r--r--.1root root638Feb2516:57CentOS-Debuginfo.repo #测试文件-rw-r--r--.1root root630Feb2516:57CentOS-Media.repo #本地资源-rw-r--r--.1root root3664Feb2516:57CentOS-Vault.repo #以前版有yum源,这是由当前版本包废弃,通常不应该被用于生产
1[root@web ~]# yum install wget1234567891011121314151617[root@web ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo--2013-06-28 19:21:47-- http://mirrors.163.com/.help/CentOS6-Base-163.repoResolving mirrors.163.com... 123.58.173.106Connecting to mirrors.163.com|123.58.173.106|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 2006 (2.0K) [application/octet-stream]Saving to: “CentOS6-Base-163.repo”100%[============================================================================================>] 2,006 --.-K/sin0.01s2013-06-28 19:21:51 (137 KB/s) - “CentOS6-Base-163.repo” saved [2006/2006][root@web ~]# lltotal 36-rw-------. 1 root root 970 Jun 20 05:03 anaconda-ks.cfg-rw-r--r-- 1 root root 2006 Sep 1 2011 CentOS6-Base-163.repo-rw-r--r--. 1 root root 15709 Jun 20 05:03install.log-rw-r--r--. 1 root root 4178 Jun 20 05:01install.log.syslogdrwxr-xr-x 2 root root 4096 Jun 22 20:30 src[root@web ~]#12345678[root@web ~]# cd /etc/yum.repos.d/[root@web yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak[root@web yum.repos.d]# lsCentOS-Base.repo.bak CentOS-Media.repo[root@web yum.repos.d]# mv /root/CentOS6-Base-163.repo CentOS-Base.repo[root@web yum.repos.d]# lsCentOS-Base.repo CentOS-Debuginfo.repo CentOS-Vault.repoCentOS-Base.repo.bak CentOS-Media.repo[root@web yum.repos.d]#123[root@localhost ~]# yum clean all[root@localhost ~]# yum makecache[root@localhost ~]# yum update
1234567[root@localhost ~]# getenforceEnforcing[root@localhost ~]#[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive[root@localhost ~]#12345678910111213[root@localhost ~]# vim /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - SELinux is fully disabled.SELINUX=disabled# SELINUXTYPE= type of policy in use. Possible values are:# targeted - Only targeted network daemons are protected.# strict - Full SELinux protection.SELINUXTYPE=targeted~[root@localhost ~]# reboot
123456789101112131415[root@web yum.repos.d]# service iptables stopiptables: Flushing firewall rules: [ OK ]iptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Unloading modules: [ OK ][root@web yum.repos.d]# service ip6tables stopip6tables: Flushing firewall rules: [ OK ]ip6tables: Setting chains to policy ACCEPT: filter [ OK ]ip6tables: Unloading modules: [ OK ][root@web yum.repos.d]# chkconfig iptables off[root@web yum.repos.d]# chkconfig ip6tables off[root@web yum.repos.d]# chkconfig ip6tables --listip6tables 0:off 1:off 2:off 3:off 4:off 5:off 6:off[root@web yum.repos.d]# chkconfig iptables --listiptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off[root@web yum.repos.d]#
未完,请点开第二稿文:http://www.centoscn.com/CentOS/Intermediate/2013/0907/1573.html