Try   HackMD

Linux Ubuntu 18.04 LTS 安裝筆記

雙系統 / 虛擬機 / 新筆電 安裝整理

用一條USB線就可以讓你的stm32板子跟電腦對話了嘎~

本範例使用環境:

  • OS : Windows 10
  • IDE: eclipse(luna版本)
  • 燒錄軟體: 內建ST-Link
  • Terminal: hercules_3-2-8.exe
  • 開發板:stm32f429 Discovery kit

1. 雙系統安裝

基本上大致有以下幾個步驟:

  1. 電腦管理檢查你的磁碟狀態
  2. 切割你要留給Ubuntu的磁區 (依用途有不同大小,若要使用ROS建議使用SSD固態硬碟、至少128GB以上)
  3. 到Ubuntu官網下載你要的版本之ISO檔案(本範例為18.04版本)
  4. 準備一顆空的隨身碟並格式化它
  5. 使用製作開機碟軟體將ISO檔燒進上述隨身碟
  6. 把你的電腦的BIOS的 Fast boot和 Security boot關閉
  7. 關機,插上上述隨身碟(裡面已經是Ubuntu的iso檔),開機,狂敲你的BIOS鍵並選擇你的隨身碟進行boot開機
  8. 成功進入Ubuntu,點選Install Ubuntu開始進行安裝
  9. 照下面文章仔細研讀(要非常小心不然會洗掉原本的系統!就GG了)
  10. 如果上述步驟均成功,恭喜你完成安裝雙系統的Linux Ubuntu!!

首先要先奉勸大家:

將資料備份!! 將資料備份!! 將資料備份!!

因為太重要了要說三次以上,除非你狠下心來買一台新電腦(像弱弱的我哈哈)

Linux的檔案系統切分和Windows的C, D槽不太一樣
是從 root(/) 往下延展開來,
/home 跟其他磁區等
若想自己分配 swap space 等這些磁區,
大小比例可以從下面文章或其他網友分享參考

參考以下文章:

(1) Ubuntu18.04 UEFI開機 自行分配磁區(/, /home,swap space)教學

(2) Ubuntu18.04 "和Windows一起安裝"懶人安裝法(Ubuntu自己分磁區)教學

(3) 我的作法

在嘗試超過10小時的雙系統安裝失敗後,有了上次慘痛的經驗(不小心洗掉Windows)
本來已經下定決心**買台新電腦,並用清除電腦資料並install Ubuntu這個選項~
新筆電來後(內灌好Windows 10)
看著美美的windows覺得洗掉很浪費 (雖然其實甚麼都沒有啊)

幾個注意事項:

  1. 選擇 English為語言
  2. 鍵盤模式也選英文(美式)
  3. 安裝時不要連接網路勾選"支援第三方軟體"

接著會進入Ubuntu安裝選項:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

我想了很久決定使用第一個(和windows一起安裝)
沒想到進入了一個 前所未有的畫面啊!

以下截自網友經驗圖,和windows7一起安裝
中間的兩塊長方形,兩者中間處把游標放上去就可以左右移動了
依據這個分配,就是你雙系統的分配!

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

居然會有這麼人性化又貼心的選項~~~真的是太感動了
我最後的分配是:windows 128 Linux 360左右
畢竟這台電腦初衷也是練習Linux跟ROS
之前學姊說至少要128GB的SSD才不會慢到瘋掉
那我開360應該綽綽有餘?!
總之就給它安裝下去

經過約10分鐘後
閃出一個畫面:Installation Complete!!
真的是天降甘霖 久病得良醫的舒爽感啊!!

之後記得檢查你BIOS中關於開機設定的優先順序
記得順序要把Ubuntu放在Windows前面
開機後才會直接進入Ubuntu的 GRUB介面
讓你選擇要進入 Windows 還是 Ubuntu喔!
畫面如下:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

各家電腦廠牌的進入BIOS系統按鍵參考:
.ASUS : F2 或 狂敲ESC (真的狂敲,不要懷疑)
.Acer : F2
.HP:F2
.Lenova: F2
.MSI:Delete鍵 (我的新筆電)
.技嘉:F2
.SONY: F10
.TOSHIBA: 先按ESC鍵,在螢幕上出現提示信息時再按F1鍵
若沒有列在上面,也可以上網搜尋喔~應該滿容易找到的

2. 虛擬機安裝

我使用的是Oracle VM Virtualbox來練習,
步驟算簡單,也不太會遇到甚麼問題,
新手可以先用虛擬機練習,是最安全又快速的方法喔!

參考文章:在Oracle VM Virtualbox虛擬機安裝Ubuntu18.04 教學

3. 新筆電

我使用的是Oracle VM Virtualbox來練習,
步驟算簡單,也不太會遇到甚麼問題,
新手可以先用虛擬機練習,是最安全又快速的方法喔!

參考文章:在Oracle VM Virtualbox虛擬機安裝Ubuntu18.04 教學

4. 小問題

(1) 解析度問題

終於安裝好Ubuntu 18.04版後,很開心地使用雙系統!(意外成功XD)
但進入後發現解析度很奇怪,非常粗糙,眼睛看了不舒服
上網查發現要打開Terminal打以下指令:

xrandr

先使用這個指令,看你的顯示器支援的min, current跟max resolution為何
很神奇的是我的狀況如下:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

左邊icon打開像齒輪那個(setting),進入setting / device / display 發現只有一個resolution 1024*768 (4:3) 沒得選擇

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

網路上也有各種解法,
我嘗試使用 sudo xdiagnose這種方法,但沒有效果(而且記得要先 sudo apt-get install xdiagnose不然會command not found)
網路上說把跳出來的Xdiagnose視窗按下Apply再重開機就會可以選擇了
但我照做卻沒有效果,

最終解決方法:

依序打以下指令:

sudo gedit /etc/default/grub

這個步驟是要打開一個文件,強制更改解析度設定
Terminal接著應該會要你打密碼,你就打你的密碼
然後應該會開啟一份文件:

#GRUB_GFXMODE=640x480這行註解打開
並把 640x480改成你想要的解析度 (e.g. 1920x1080)

附圖範例為:1280*800

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

然後按下save 並離開
再打:

sudo update-grub

更新玩grub後重新開機一次
應該就會看到改變了!!!

tags: Linux Ubuntu ROS Dualboot 雙系統 Virtual Machine 虛擬機 Oracle VM VirtualBox