網頁

2012年5月4日 星期五

CentOS學習筆記 - yum(一)

最近公司在某電信業者下申請了個雲端的os環境,一個剛install好的cent os,要將產品放上去,先ssh進去後,想看看httpd server安裝了什麼,打入yum list | grep httpd,就回應了以下的訊息


Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os error was
[Errno 4] IOError: <urlopen error (-3, '\xe8\xa7\xa3\xe6\x9e\x90\xe5\x90\x8d\xe7\xa8\xb1\xe6\x99\x82\xe7\x99\xbc\xe7\x94\x9f\xe6\x9a\xab\xe6\x99\x82\xe6\x80\xa7\xe7\x9a\x84\xe9\x8c\xaf\xe8\xaa\xa4')>
Error: Cannot find a valid baseurl for repo: base


看到這個就去google,發現是DNS設定的問題,試了下:
ping www.google.com <- 沒回應

再試dig www.google.com

回應:

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> www.google.com
;; global options:  printcmd
;; connection timed out; no servers could be reached



確定是DNS的設定後,直接vim /etc/resolv.conf,發現沒有nameserver的設定,打入
nameserver 168.95.1.1
nameserver 8.8.8.8

save後,再試dig www.google.com
回應:

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> www.google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64989
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;www.google.com. IN A

;; ANSWER SECTION:
www.google.com. 243895 IN CNAME www.l.google.com.
www.l.google.com. 185 IN A 74.125.31.147
www.l.google.com. 185 IN A 74.125.31.99
www.l.google.com. 185 IN A 74.125.31.103
www.l.google.com. 185 IN A 74.125.31.104
www.l.google.com. 185 IN A 74.125.31.105
www.l.google.com. 185 IN A 74.125.31.106
......

再來yum list | grep httpd就可以用了,It's okey now。

沒有留言:

張貼留言