本文將對FreeBSD安裝過程提供詳細的圖解,在安裝之前,先提出幾點建議供大家參考:
1、採用迷你安裝。
2、安裝時啟用inetd,並在編輯inetd.conf檔案時,把帶有“ftp”的行前面的“#”號去掉。這樣作是為了以後安裝軟體時可以用ftp上傳檔案。
3、添加一個wheel組的使用者,這樣在系統工作正常後可以在windows系統上通過終端登入軟體(如SecureCRT)進行所有操作。
FreeBSD4.7在最小安裝時支援SSH終端登入,所以我們需要使用支援SSH協議的終端軟體,如SecureCRT。
例如:我添加的使用者名稱是ylf,隸屬wheel系統組。
系統產生一個使用者目錄/home/ylf。
我可以通過SecureCRT以ylf身份登入到系統,然後通過su命令切換到root使用者。
同時我也可以在IE瀏覽器內鍵入ftp://192.168.0.1,並輸入ylf使用者名稱和密碼登入ftp將需要的檔案上傳到自己的使用者目錄裡。/
(註:192.168.0.1是我的伺服器串連內網的網卡IP地址)。
以下除系統安裝部分,我都是採用終端方式操作。
4、分區時將/home、/usr和/var劃的大一些,因為/usr為程式目錄,/var要存放日誌,/home是使用者主目錄,我的使用者檔案如網頁、 ftp上傳檔案等都放在這裡。還有最好保留一部分空間留作以後需要的時候用。我的機器上有2塊硬碟,一快18.2G SCSI硬碟,一塊40G IDE硬碟。我是這樣劃分的。
128M /
20G /home
2G /ftp
256M /tmp
6 G /usr
5G /var
其中/ftp是為匿名ftp使用者訪問專用。剩餘空間留作備用。當然如果硬碟空間少的話,做我們的實驗也是夠用的。
關於安裝方面的文章,大家也可以參考delphij寫的《FreeBSD伺服器的安裝與最佳化》一文。
本系統安裝過程圖解是專為初學者提供的。整個系統的定製過程都是針對連載文章的系統要求作的。
我們採用光碟片啟動安裝FreeBSD的方式,並且硬碟上只有FreeBSD一個系統。
首先修改CMOS使系統能夠通過光碟片引導。
插入FreeBSD的第一張盤。正常引導後進入定製核心介面,如圖一:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖一
選Skip kernel configuration and continue with installation跳過核心定製,我們在整個系統安裝結束後會重新定製核心。
接著進入系統安裝主介面,圖二:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done" resized="true" pop="Click here to open new window CTRL+Mouse wheel to zoom in/out">
圖二
選擇Standard開始標準安裝。
接著出現提示告訴你下一步將要進行Fdisk操作,按斷行符號繼續(圖略)。
進入Fdisk Partition Editor介面,圖三:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done" resized="true" pop="Click here to open new window CTRL+Mouse wheel to zoom in/out">
圖三
為了保證與FreeBSD共存的系統能夠啟動,預設情況下FreeBSD會保留一部分磁碟空間(64 cyl)。我們裝的是單系統,這部分空間沒有用,按“Shift+F”將所有空間都給FreeBSD,圖四:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done" resized="true" pop="Click here to open new window CTRL+Mouse wheel to zoom in/out">
圖四
這裡選擇No。
接著按“Q”完成。然後提示需要劃分FreeBSD檔案系統。斷行符號繼續。
進入Disklable Editor介面,按A先讓系統自動劃分,圖五:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖五
然後移動游標到/var和/usr,按D將這兩個分區先刪除。把游標移到最上面,按C分別建立/var,/usr,/home,/ftp分區。如圖六:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖六
其中/ftp分區專為匿名Ftp使用。/var用於存放日誌,/usr存放程式,/home存放使用者資料。
我這裡是4G的硬碟,如果硬碟空間大,應該適當加大這4個分區的容量。
按“Q”繼續。
出現Choose distributions(選擇安裝組件)介面,如圖七:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done" resized="true">
圖七
這裡選Minimal迷你安裝。選擇OK繼續。
出現Choose Installation Media選擇安裝媒體介面,圖八:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖八
這裡選擇 1 CD/DVD,通過光碟片安裝。OK繼續。
出現確認介面,這是最後一次後悔的機會!選YES開始安裝,圖略。
經過一段時間後,出現安裝成功提示。OK繼續,圖略。
出現是否配置網路裝置提示。選YES,圖九:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖九
接下來會列出你的網路裝置,選擇第一塊網卡,斷行符號,會問你是否啟用IPv6協議,選NO繼續。問你是否使用DHCP,選NO繼續。
出現網卡配置介面,圖十:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十
這裡只要添入主機名稱和IP地址就可以,其他的在後續安裝中會配置。
接著問你是否現在啟用這塊網卡介面,選YES。然後問你是否使用本系統作為網關,選YES。
出現是否配製inetd(Internet超級伺服器)介面。選YES,圖十一:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十一
提示是否啟用inetd,選YES。圖略
提示是否編輯inetd的設定檔,inetd.conf,選YES。圖略
接著出現檔案編輯介面,圖十二:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done" resized="true">
圖十二
移動游標到帶有ftp的行,將前面的#刪掉,只刪除頭兩行的即可。按ESC退出並儲存。
接著問你是否啟用匿名ftp訪問,選YES,後面的提示也選YES繼續,圖略。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十三
圖十三對匿名使用者的組和使用者目錄進行了設定,不用改動,直接選OK繼續。
接著問你是否建立一個ftp登陸時的歡迎資訊。選NO不建立繼續。
接下來的幾個提示:
是否使本機運行NFS伺服器,選NO。圖略
是否使本機運行NFS客戶,選NO。圖略
是否配製預設安全性原則,選NO。圖略
列出當前對inetd做過的設定,OK繼續。圖略
是否定製系統控制台,選NO。圖略
設定系統時區,依次選NO——Asia——China——East China——YES
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十四
圖十四詢問是否啟用Linux二進位相容支援,這將使FreeBSD可以運行所有Linux程式。選YES。
接著提示是否配製非USB滑鼠,選NO繼續。圖略
接著問是否瀏覽Package collection,選NO繼續,圖略
問是否添加系統使用者和組,選YES,圖略
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十五
圖十五選擇USER Add a new user to the system,添加一個新使用者。OK 繼續。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十六
這裡添加一個wheel組的使用者ylf,用於終端登入時可以用這個使用者切換到root。
OK後回到前一個介面,選EXIT退出。圖略
這時提示要求輸入root使用者密碼。需要輸入2次。圖略
然後問你是否想回到主介面對配置做改動,選NO——Exit Install退出安裝,圖略。
最後提示是否退出重新啟動,選YES,記得要拿出光碟片。圖十七。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十七
為了讓系統可以重新編譯核心和使用ports安裝應用程式。我們重新運行系統配置程式安裝核心編譯支援和ports。
以root使用者登入後,運行:
# /stand/sysinstall
出現系統配置主介面,圖十八:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十八
選擇Configure後斷行符號繼續。出現FreeBSD Configuration菜單,圖十九:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖十九
選擇Distributions後 OK繼續。出現組件安裝選擇介面,圖二十:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new windownCTRL+Mouse wheel to zoom in/out';}" border=0 twffan="done">
圖二十
選擇src——sys和ports,OK後出現選擇安裝媒體介面,選通過光碟片安裝,圖略
這樣就把核心編譯支援和ports安裝到系統。
安裝完成後,選Exit——Exit Install退出。
安裝完系統後,要重新編譯核心。目的是要系統支援Firrwall和提高運行效率。
注意:這之後的過程在終端上操作要方便許多。SecureCRT支援在終端介面上直接拷貝和粘貼常值內容。
轉到核心檔案目錄:
# cd /usr/src/sys/i386/conf