Ubuntu 通常作為第二套系統安裝,在 Windows 下安裝的細節此處不贅述。
裝好 Ubuntu 後,開機預設進入 Ubuntu,Windows 被排到最後。要調整順序並移除不需要的開機項,可以這樣做:
進入 /etc/grub.d,裡面檔案都以數字開頭,而 grub 的開機項正是按這些數字排序。把 30_os-prober(Windows 的開機項)改名為 09_os-prober,排在 10_linux(Ubuntu 的開機項)之前即可。另外可以建一個 bak 資料夾,把其他檔案移進去,開機選單就會清爽很多。
最後別忘了重新產生設定:
grub-mkconfig # 或 update-grub
它會重建 /boot/grub/grub.cfg,重啟後選單就更新了。
從 Ubuntu Software Center 搜尋 fcitx,或用 apt-get 安裝小企鵝輸入法與對應輸入法表(如 wubi-pinyin)。裝完切換:
im-switch -s fcitx
注意這條指令不要加 sudo。重啟後就能呼出小企鵝。
Linux 下設定環境變數的位置有幾處:
/etc/environment /etc/profile /etc/bash.bashrc ~/.profile ~/.bashrc
從路徑不難判斷:前三個對所有使用者有效,後兩個只對當前使用者有效。載入順序是:
/etc/environment → /etc/profile → ~/.profile → /etc/bash.bashrc → ~/.bashrc
用 /etc/environment 時要特別小心:系統並不是「執行」這個檔案,而是按 KEY=VALUE 的模式取值,所以它每一行都必須是「變數名=變數值」,而且它不是腳本檔,export PATH 這種語句寫在裡面本身就是錯的;變數值也必須是值本身,不能帶引號或引用,像 PATH=$PATH:/usr/java14/jre/bin 這樣寫也是錯的。
結論:要設全域變數,建議用 /etc/profile;只想為當前使用者設定,用 ~/.profile。這兩個都是標準腳本檔,可以寫 export。例如設定 JAVA_HOME:
export JAVA_HOME=/usr/local/jdk1.6.0_41 export PATH=$PATH:$JAVA_HOME/bin
安裝 Ubuntu 為第二系統後,原本 Windows 的分區不會自動掛載,每次存取都不方便。編輯:
sudo gedit /etc/fstab
每一行是一個分區的掛載設定,包含 <file system> <mount point> <type> <options> <dump> <pass> 六欄:file system 是硬碟分區(用 UUID 表示)、mount point 是掛載點、type 是檔案系統;options 一般設 defaults 即可,這樣會擁有完整操作權限;dump 與 pass 都寫 0。
查詢分區用 sudo fdisk -l,查 UUID 用:
sudo ls -l /dev/disk/by-uuid
一份格式化後的 fstab 樣本:
# /etc/fstab: static file system information. # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> UUID=425b56c8-30b7-44aa-8cbc-d5ee1277588c / ext3 errors=remount-ro 0 1 UUID=e1c58c29-65e3-48b9-a21d-29c55e8ec84b none swap sw 0 0 UUID=02DA67F0DA67DE83 /c ntfs defaults 0 0 UUID=F6766E93766E5501 /d ntfs defaults 0 0 UUID=3392A6E3D8359343 /e ntfs defaults 0 0