CentOS 6.4 安装使用体验汇总1
时间:2014-02-24 00:41 来源:www.it.net.cn 作者:IT网
1
2
3
4
5
6
7
8
[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地址的获取方式
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:87:9D:1D
TYPE=Ethernet
UUID=3efbea06-751a-4add-bec7-13db4d19bc0d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
有朋友肯定是会急着去启动网卡服务了,CentOS 5下不会报错,但是在CentOS6下网络服务重启后,ip配置发生了错误!原来CentOS6下的网卡的主配置文档中,默认下有NM_CONTROLLED=yes这么一行,这意味着网卡eth0得有 NetworkManager托管,这行中的yes|no的开关控制项的修改是即时生效的,你可以改为no保存后,立即可以解决上述问题!下面我们来修改一下!
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:87:9D:1D
TYPE=Ethernet
UUID=3efbea06-751a-4add-bec7-13db4d19bc0d
ONBOOT=yes
NM_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 ~]#
1
2
3
4
5
6
7
8
9
10
11
[root@localhost ~]# !vim
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:87:9D:1D
TYPE=Ethernet
UUID=3efbea06-751a-4add-bec7-13db4d19bc0d
ONBOOT=yes
BOOTPROTO=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
1
2
3
4
5
6
7
[root@web ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=web.test.com
[root@web ~]# vim /etc/hosts
127.0.0.1 web web.test.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@localhost ~]# reboot
1
2
3
4
5
6
[root@web ~]# vim /etc/resolv.conf
; generated by /sbin/dhclient-script
search sh.jjhh.com test.com
nameserver 211.95.1.97 #上海联通DNS
nameserver 8.8.8.8 #google DNS
#说明:nameserver 最多可以设置三个
1
2
3
4
5
[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 ~]#
1
2
3
4
5
6
[root@web ~]# ls -l /etc/yum.repos.d/
total 16
-rw-r--r--. 1root root 1926Feb 2516:57CentOS-Base.repo #是网络源,默认使用
-rw-r--r--. 1root root 638Feb 2516:57CentOS-Debuginfo.repo #测试文件
-rw-r--r--. 1root root 630Feb 2516:57CentOS-Media.repo #本地资源
-rw-r--r--. 1root root 3664Feb 2516:57CentOS-Vault.repo #以前版有yum源,这是由当前版本包废弃,通常不应该被用于生产
1
[root@web ~]# yum install wget
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[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.repo
Resolving mirrors.163.com... 123.58.173.106
Connecting to mirrors.163.com|123.58.173.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2006 (2.0K) [application/octet-stream]
Saving to: “CentOS6-Base-163.repo”
100%[============================================================================================>] 2,006 --.-K/sin0.01s
2013-06-28 19:21:51 (137 KB/s) - “CentOS6-Base-163.repo” saved [2006/2006]
[root@web ~]# ll
total 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:03 install.log
-rw-r--r--. 1 root root 4178 Jun 20 05:01 install.log.syslog
drwxr-xr-x 2 root root 4096 Jun 22 20:30 src
[root@web ~]#
1
2
3
4
5
6
7
8
[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]# ls
CentOS-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]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Vault.repo
CentOS-Base.repo.bak CentOS-Media.repo
[root@web yum.repos.d]#
1
2
3
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
[root@localhost ~]# yum update
1
2
3
4
5
6
7
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]#
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
[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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@web yum.repos.d]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[root@web yum.repos.d]# service ip6tables stop
ip6tables: 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 --list
ip6tables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@web yum.repos.d]# chkconfig iptables --list
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@web yum.repos.d]#
(责任编辑:IT)
(责任编辑:IT) |




