OpenSystem Lab1: Install Debian Operating System

實驗描述

本實驗示範如何安裝 Debian 作業系統。

實驗環境

理學大樓 1002 教室
Cloud-A01 ~ Cloud-D12
CPU AMD Phenom™ II X6 1065T Processor
Memory 8G
Disk spaces 500G、500G
O.S. Debian Wheezy

實習簡介

本實作內容主要目的:讓同學學會如何安裝作業系統,以下將帶各位同學實習安裝 Debian 作業系統。 將來大家都有機會接觸到 Linux 作業系統,在正式學習如何操作 Linux 系統之前,必須先學會如何自行安裝(重新安裝)作業系統!

由於燒錄光碟片成本耗大,因此在課堂上我們使用網路開機方式來安裝作業系統,同學回家後將網路開機改為光碟開機,其餘過程均與課堂上相同。

以下操作過程均建立在網路環境具有 DHCP 情境下。

環境參數

為了避免輸入錯誤以及方便設置使用環境,我們使用下列按鈕來快速取代各個不同參數。

您的 IP 位址是:[Host-IP]


實習內容

準備工作

取得安裝來源

Debian 臺灣站

將光碟映像檔(.iso) 下載下來後,燒錄成光碟片。或是參考 UNetbootin,製作可開機 USB 碟來使用

若是家中環境使得安裝過程中沒有網路可以使用 (例如使用撥接上網 pppoe),請下載完整版光碟

修改 BIOS 開機次序

詳情請見課堂演示,或參考安裝前硬體和作業系統的相關設定

安裝流程

安裝過程請參考以下各圖(圖文不相同時,以文字為主!)

01

安裝首頁,先別急著按下 Install!

硬碟分割與掛載

分割區編號類型大小可開機格式化檔案系統掛載位置
#1primary512 MBBFext2/boot
#2primary5 GBFext4/
#3primary20 GBFext4/usr
#5logical10 GBFext4/var
#6logical10 GBFext4/usr/local
#7logical10 GBFext4/tmp
#8logical20 GBFext4/home
#9logical16 GBFswapswap
#10logical20 GBFext4/src1
#11logical20 GBFext4/src2
#12logical120 GBFext4/src3
#13logical120 GBFext4/src4
#14logical40 GBFext4/backup
#15logical125 GBFext4/video

由於我們現在要建立全新的電腦系統,因此將所有分割區都格式化。若將來想要重新安裝作業系統,並保留個人資料只需要格式化分割區9 以前的分割區。

設定作業系統

設定網路

使用圖形化界面的 Wicd network-manager(舊版為 network-manager) 來設定網路。

01

登入後的畫面,首先我們在右下方時間左邊的圖示上按下右鍵。

使用指令來設定網路。

首先我們先將自己的帳號加入 sudoers,儘量避免使用 root 帳號會比較安全一點!

su
adduser cloud sudo
cp /etc/sudoers /etc/sudoers.orig
nano /etc/sudoers
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL cloud ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives:
exit

再來我們要將 Wicd (or network-manager) 移除,雖然圖形界面似乎很便利,但是他常常會出來搞鬼!

sudo aptitude purge wicd wicd-daemon wicd-gtk

若要移除 network-manager 則

sudo aptitude purge network-manager network-manager-gnome

手動修改設定檔,養成好習慣,更改任何設定檔之前要先備份!

cd /etc/network
sudo cp interfaces interfaces.orig
sudo nano interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address [Host-IP] netmask 255.255.255.0 gateway 192.168.102.254

接著是設定 DNS servers,一樣要記得先備份!

cd ..
sudo cp resolv.conf resolv.conf.orig
sudo nano resolv.conf
nameserver 140.120.13.1 nameserver 140.120.1.2 nameserver 8.8.8.8

安裝驅動程式

wget -nc http://mirror.cs.nchu.edu.tw/sources.list
sudo mv /etc/apt/sources.list /etc/apt/sources.list.orig
sudo mv sources.list /etc/apt/sources.list
sudo aptitude update
sudo aptitude install firmware-linux-nonfree firmware-realtek

修改 GRUB 開機選單

為了不影響其它課程使用, 我們安裝完以後將預設系統改為第二顆硬碟(sdb). (第二週同學)

sudo rm /etc/grub.d/0[89]_Debian-*
wget -nc http://mirror.cs.nchu.edu.tw/08_Debian-Jessie-Disk2
wget -nc http://mirror.cs.nchu.edu.tw/09_Debian-Jessie-Disk1
sudo cp 0[89]_Debian-* /etc/grub.d
sudo chmod +x /etc/grub.d/0[89]_Debian-*
sudo update-grub

為了不影響其它課程使用, 我們安裝完以後將預設系統改為穩定那顆硬碟. (第一週同學)

wget -nc http://mirror.cs.nchu.edu.tw/08_Debian-Wheezy-Disk2
wget -nc http://mirror.cs.nchu.edu.tw/09_Debian-Jessie-Disk1
sudo cp 0[89]_Debian-* /etc/grub.d
sudo chmod +x /etc/grub.d/0[89]_Debian-*
sudo update-grub

重開機試試看設定是否都正確!