1. 程式人生 > >Centos6.6安裝後一些常見問題詳解

Centos6.6安裝後一些常見問題詳解

dns step onf 同步 lba 6.2 dcloud ins res

<一>、centos6.6通過VM最小化安裝後上不了網的解決方法:

在安裝centos6.6時,沒有在網絡設置中設置網卡自動啟動的,安裝完系統後,是不能聯網的,解決方法如下:

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

把裏面的ONBOOT=no 改成yes

/etc/init.d/network restart 重啟網絡就可以了

百牛信息技術bainiu.ltd整理發布於博客園

<二>、Centos6.6通過VM最小化安裝後,找不到網卡,通過配置eth0後也上不了網的解決方法:

在學習centos6.6時,我們通過VM安裝Centos6.6系統來學習,在實驗中需要用到多臺服務器來進行實驗,但增加一個服務器都重裝一次系統太浪費時間了,我們可以通過VM的克隆方法來添加多臺服務器,但問題出現了:為Centos6.6創建VMWare的虛擬機後,復制,創建一個新的克隆鏡像,啟動和配置網卡無效。

1.配置ifcfg-eth0文件

[[email protected] ~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0

把ONBOOT=no 改成yes

保存退出

/etc/init.d/network restart 重啟網絡報錯,

2. [[email protected] MrXiong ~]# ifconfig 顯示不到eth0信息

3.[[email protected] MrXiong ~]# ifup eth0 出錯device eth0does not seem to be present, delaying initialization

經過度娘和谷哥的幫助,找到原因是:

新克隆的虛擬機鏡像的網卡mac地址已經變更。打開虛擬機的.vmx文件,ethernet0.generatedAddress項記錄了該虛擬機的mac地址。

解決方法:

編輯如下文件
vim /etc/udev/rules.d/70-persistent-net.rules

一般文件內容是這樣的:

# This file was automatically generated by the/lib/udev/write_net_rules
# program, run by thepersistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep eachrule on a single
# line, and change only the value of the NAME=key.

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:20:ea:34",ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:5b:63:e3",ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

註釋掉eth0的那個段落,然後將eth1的修改為eth0

修改完後如下:

# This filewas automatically generated by the /lib/udev/write_net_rules
# program, run by thepersistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep eachrule on a single
# line, and change only the value of the NAME=key.

# PCI device 0x8086:0x100f (e1000)
#SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:20:ea:34",ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:5b:63:e3",ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

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

把HWADDR地正改成上面新的eth0 MAC地址

HWADDR=00:0c:29:5b:63:e3

保存退出

reboot重啟服務器後生效

現在用ifconfig 可以查看到eth0相關信息

<三>、新安裝centos6.6最少安裝後,從163網站下載yum本置文件時出現wget命令不能使用的解決方法:

在centos6.6中,wget是默認安裝了,可以直接使用wget來下載,但在6.6最小化安裝後,wget是默認沒有安裝的。

[[email protected] yum.repos.d]# wgethttp://mirrors.163.com/.help/CentOS6-Base-163.repo
-bash: wget: command not found

通過本地yum安裝wget

[[email protected] yum.repos.d]# yum installwget

安裝wget後,我們就可以通過wget下載163的yum

首先備份/etc/yum.repos.d/CentOS-Base.repo

[[email protected]/]mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下載對應版本repo文件, 放入/etc/yum.repos.d/(操作前請做好相應備份)

[[email protected] /]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[[email protected] yum.repos.d]# mvCentOS6-Base-163.repo CentOS-Base.repo
[[email protected] yum.repos.d]yum clean all
[[email protected] yum.repos.d]yum makecache

<四>centos6.6安裝setup命令

在centos5.8中,我們可以通過setup命令來對firewall,network,system services等進行配置

技術分享

但在centos6.6最小化安裝後,發覺setup命令不管用,從網上度娘和谷哥了一下,發現centos6.6最小化安裝,沒有把setuptool安裝上去,我們可以通過以下方法來解決:

我們可以通過

yum install setuptool –y

yum install system-config-firewall-tui –y

install system-config-network-tui –y

yum install ntsysv –y

安裝完上面幾個rpm包後,就會出現我們熟悉的setup字符圖形界面。

技術分享

然後我們可以通過以上熟悉的界面來設置IP,route,dns

<五>、centos6.6 與網絡時間服務器ntp同步使用ntpdate命令出錯

在5.8中,我們使用ntpdate time.nist.gov進行時間效對,但我安裝了最小化centos6.6後,發現無論使用/usr/sbin/ntpdate time.nist.gov還是直接ntpdate time.nist.gov都出現錯誤

[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[[email protected] ~]# ntpdatetime.nist.gov      
-bash: ntpdate: command not found
[[email protected] ~]# /usr/sbin/ntpdatetime.nist.gov
-bash: /usr/sbin/ntpdate: No such file ordirectory

解決方法:

通過yum安裝ntpdate

[[email protected] ~]# yum install ntpdate –y

安裝完後,就可以使用ntpdate命令進行時間效對

[[email protected] ~]# ntpdate time.nist.gov
 7Nov 02:01:14 ntpdate[4878]: step time server 206.246.122.250 offset-28812.162590 sec

<六>、centos6.6安裝mini後通過yum安裝man命令

[[email protected] ~]# yum install man -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 *base: mirrors.grandcloud.cn
 *extras: mirrors.grandcloud.cn
 *updates: mirrors.grandcloud.cn
base                                       | 3.7kB     00:00

Centos6.6安裝後一些常見問題詳解