Upload
others
View
1.916
Download
0
Embed Size (px)
Citation preview
2017/10/11
1
第4章
文書、上網及程式學習機實作
-遠端桌面操作實作
內容
• Raspberry Pi 桌面環境
• Rasbian 桌面中文化
• Pi-終端機與遠端桌面
• Xdrp 方式
• Windows VNC
• UbuntuMate安裝使⽤
Raspberry Pi 桌面環境
注意
• 哪些⼈需要 Desktop 版本
–需要在桌面視窗環境操作的⼈員
• 上網、學程式(需⽤桌面視窗環境)、簡易文書
• 影⾳播放
–專⽤ Koki 類播放器 OSMC, LibreElec
• 伺服器類
–文字命令模式
2017/10/11
2
x86 桌面選擇回顧
• x86 桌面的選擇
– Ubuntu 、 Mint 系列
• ⼀般⼈員上網、文書處理、影⾳
– RedHat 企業版系列
• 要求穩定的⼯作站
Pi 桌面的選擇
• Ubuntu 系列
– Lubuntu、Xubuntu、Ubuntu Mate
–建議⽤途:⼀般⼈員上網、文書處理 (影⾳不建議)
• Raspbian
– PIXEL 桌面
–建議⽤途:程式學習、IO 控制
Raspbian Desktop
Raspbian Desktop
• 2016-09-23:– New PIXEL desktop environment - ………– Chromium web browser included– Infinality font rendering patches included– RealVNC server and viewer included– SenseHAT emulator included
2017/10/11
3
新視窗架構 (2016-09 以後)
• PIXEL desktop environment
– Pi Improved Xwindows Environment, Lightweight
中文化
• 已安裝中文字形
面版中文設定
• 選擇
變更地域
先選 zh(chinese)再選 TW(Taiwan ROC)在確認是否 UTF-8
2017/10/11
4
設定 時區 Wi-Fi country
可以先按 OK 中文化
• 會重新開機
文字命令模式設定
• 比較可靠 (圖形設定可能會失敗)
2017/10/11
5
命令
sudo raspi-config
設定為 zh-tw UTF-8
再設定時區等 設定 wi-fi country
• ⼀般可以不⽤設定
2017/10/11
6
完成會重新開機 中文化
選單
瀏覽器
新增移除軟體 安裝中文輸入法
• 常見的就有 gcin、iBus、hime、 fxitx、rime、scim、uim 等
– Scim:老牌的輸入法
– ibus::ubuntu主推荐的,較為主流的輸入法。
– Gcin:台灣 Linux 較常⽤的輸入法框架,易上手
– Hime:gcin 分支出來的輸入法
2017/10/11
7
酷⾳輸入
搜尋 chewing 酷音
文字命令模式
• ibus
• sudo apt-get install ibus ibus-chewing
• scim
• sudo apt-get install scim scim-chewing
安裝 Libreoffice 中文軟體包
• 選單中文化
已中文化選單
2017/10/11
8
Raspbian VNC 使⽤
啟⽤ VNC server
• 啟⽤ raspi-config 中 VNC server
VNC 連線 Windows 使⽤ VNC 連線
2017/10/11
9
選擇下載
輸入密碼
• 內定:
– pi
– raspberry
2017/10/11
10
Pi Ubuntu 桌面環境
訊息首頁
• 或搜尋 pi ubuntu
版本選擇 下載
2017/10/11
11
安裝與設定
• 下載、解壓縮、燒錄到 SD
• 開機:選擇語言後依指示設定
Raspbian 桌面中文化
基本操作
• 下載燒錄
• 網路設定
• 更新
參考相關單元
地區設定
sudo raspi-config
2017/10/11
12
Change Locate 字元及選⽤
選擇字元集
• 去除 en_GB.UTF UTF-8
• 選取 en_US.UTF-8 UTF-8
• 繁體:選取 zh_TW.UTF-8 UTF-8
• 簡體:選取 zh_ CN.UTF-8 UTF-8
內定字元集
• 繁體:選 zh_TW.UTF-8
• 簡體:選 zh_CN.UTF-8
2017/10/11
13
處理中
• 處理中
問題
• 如果 Desktop 桌面中文無法顯示,可能沒有安裝到字型安裝
• 安裝必要的中文字型
• 2016-09-23 以後 Raspbian 已內建中文字形
• 但 2017-8 之後
中文字型安裝
中文字型安裝-1
文泉驛微米黑
sudo apt-get install -y ttf-wqy-microhei
文泉驛正黑
sudo apt-get install -y ttf-wqy-zenhei
文泉驛點陣宋體 X11
sudo apt-get install -y xfonts-wqy
2017/10/11
14
中文字型安裝-2
• 教育部標準楷書
sudo apt-get install -y fonts-moe-standard-kai
• 教育部標準宋體
sudo apt-get install -y fonts-moe-standard-song
中文字型安裝-3
• 文鼎楷書體 Unicode
sudo apt-get install -y fonts-arphic-ukai
• 文鼎明體 Unicode
sudo apt-get install -y fonts-arphic-uming
中文字型安裝-4
• cwTeX 明體
sudo apt-get install -y fonts-cwtex-ming
• cwTeX 楷體
sudo apt-get install -y fonts-cwtex-kai
• cwTeX 粗黑體
sudo apt-get install -y fonts-cwtex-heib
• cwTeX 圓體
sudo apt-get install -y fonts-cwtex-yen
• cwTeX 仿宋體
sudo apt-get install -y fonts-cwtex-fs
中文字型安裝-5
• 花園明朝(日本)
sudo apt-get install -y fonts-hanazono
• Android 案型
sudo apt-get install -y fonts-droid
2017/10/11
15
中文其他字型
• http://wiki.debian.org.hk/w/Where_can_I_find_fonts_for_GNU/Linux
• 或網路搜尋相關安裝方法 中文輸入法
安裝中文注⾳輸入法
酷⾳輸入法
sudo apt-get install -y scim
sudo apt-get install -y scim-tables-zh
sudo apt-get install -y scim-chewing
拼⾳輸入法
sudo apt-get install -y scim
sudo apt-get install -y scim-tables-zh
sudo apt-get install -y scim-pinyin
其他
• 參考
http://wiki.debian.org.hk/w/Make_Debian_support_Chinese
2017/10/11
16
LibreOffice 中文化
安裝中文
• 繁體中文
sudo apt-get install libreoffice-l10n-zh-tw
• 簡體中文
sudo apt-get install libreoffice-l10n-zh-cn
自帶瀏覽器中文化
• 2016-09-23 以後
– Chromium 瀏覽器 已支援中文化
Screen keyboard
• sudo apt-get install matchbox-keyboard
2017/10/11
17
Raspberry Pi 控制連線
Pi 序列終端機
網路未設定好或無網路時使⽤
注意
• 此方法適⽤無線網路先行設定 SSID 及 PSK
• 如使⽤有線網路可以參考網路設定,並⽤ SSH 登入
• 樹莓派 3 因內UART 為藍芽晶片使⽤,使⽤上需要調整
RPi Serial 連線
TX
RX
TX
RX
2017/10/11
18
驅動程式安裝
• FTDI
• 旺玖科技 PL2003
(⼀般坊間 PL-2303HXA/XA
晶片,不支援 Win 8,須購
買 PL-2303HXD 晶片)
DVK512 驅動程式安裝
• Chipset
– Silicon-Lab Cp2102 Windows 7/8.1/10 自動安裝
–或 http://www.silabs.com/ 網站下載
檢視 COMx
• 電腦內容連接埠
putty
• 如沒出現文字,嘗試按⼀下 enter
自動偵測9600 也 OK
2017/10/11
19
登入
• 輸入帳號密碼
樹莓派 3 終端機
• 使⽤ 115,200 的 baud rate 連線會出現亂碼
• 內建的硬體 UART 分配給 Bluetooth 晶片使⽤
• 原 UART (GPIO的 14 & 15)改成 mini-UART
–原硬體 UART 有獨立的 clock divisor, Baud Rate 可維持在 115,200
–但 mini-UART 使⽤系統核心時脈,Baud Rate 只能跑到 72,000 左右
解決方法-1
• 編輯 SD 卡內
config.txt
• 加 core_freq=250
• 但此方法會降低 CPU 速度
Pi 3 Default Clock Settingsarm_freq=1200core_freq=400sdram_freq=450Pi 3 Default Underclock Settingsarm_freq=600core_freq=250sdram_freq=450
Raspberry Pi SSH 登入
如設定好網路
2017/10/11
20
需要事先得知 IP
• 如有銀幕時 Raspbian 開機會顯示 IP
• DHCP 若無法得知 IP 時,可以⽤⼀些軟體⼯具查出 IP
– IP 分享器中 DHCP Clients 查詢
– http://www.nirsoft.net/ 找⼯具軟體
• 可以事先在 cmdline.txt 指定 IP (參考網路設定)
如果是 2016-11-25 以後版本
• 內定 ssh 關閉
• 啟動方法1
–在驅動分割區(FAT32)放入⼀個檔名為 ssh 的檔案
–啟動時會要求修改內定密碼
–啟動分割區唯⼀個 FAT32 格式稍路好在Windows 電腦中可以看到及建立檔案
• sudo raspi-config 中啟動
ssh 登入
遠端桌面 (Remote Desktop)
2017/10/11
21
前言
• Pi 若在測試學習階段
–需要 hdmi 顯示器或 Hdmi to VGA 轉換
–鍵盤、滑鼠
• 經濟方案
– UART USB ( pi 終端機) 登入設定
或 ssh 登入設定
–遠端桌面操作
遠端桌面方式
• RDP (遠端桌面協定 Remote Desktop Protocol)
– Xrdp (server)
– Remmina (client)
– Rdesktop (client)
– FreeRDP (client)
–Microsoft Windows-遠端桌面
• VNC(Virtual Network Computing)
– TightVNC
• XDMCP (X顯示監控協定, X Display Manager Control Protocol)
PI 遠端桌面 VNC
2017/10/11
22
VNC
• 2016-09 Raspbian 內建 VNC ,只要啟動即可
• 使⽤者端下載 VNC Viewer
Raspbian 啟動 vnc
• raspi-config 啟動 vnc server (限2016-09 以後)
下載 VNC Viewer
• VNC
– RealVNC, https://www.realvnc.com/
– TightVNC, http://www.tightvnc.com/
– TigerVnc, http://tigervnc.org/
– UltraVNC, http://www.uvnc.com/
執行連線
• 啟動程式
• 輸入樹莓派 IP
• 輸入帳號密碼
–內定 pi / raspberry
2017/10/11
23
Xdrp 方式
條件
• Raspberry Pi
– Raspbian
–網路
– Xrdp 軟體 (安裝好即可⽤)
–先行設定
• UART 2 USB 或ssh 設定網路與軟體安裝
• Windows 端
–遠端桌面(內建)
PI 端安裝
• sudo apt-get update
• sudo apt-get -y install xrdp
安裝好之後
• 安裝完畢之後,xrdp 服務直接被啟動了
• 之後開機後也會自動啟動
2017/10/11
24
Windows 端
• 開啟元端桌面連線
顯示選項
驗證 剛開始啟動
2017/10/11
25
啟動完成-全銀幕 啟動完成-浮動視窗
注意:
• xrdp 的通訊埠是 Port 3389
VNC Client
2017/10/11
26
⽤戶端 vnc 程式
• Windows
– UltraVNC
– TightVNC
– TigerVNC
– TurboVNC
• Linux
– Krdc
TighVNC
TighVNC TighVNC
2017/10/11
27
TighVNC
TigerVNC
TigerVNC TigerVNC
2017/10/11
28
TigerVNC TigerVNC
TigerVNC
TurboVNC
2017/10/11
29
TurboVNC TurboVNC
TurboVNC TurboVNC
2017/10/11
30
UltraVNC
UltraVNC
UltraVNC
Ubuntu Mate 安裝與設定
2017/10/11
31
目的
• 如果你只要使⽤ Pi 桌面系統(建議使⽤ Pi3 以上)
–文書-LibreOffice
• 簡報
–上網瀏覽網頁
–影⾳
–學習程式語言(不做 IO 控制)
• Scratch (邏輯思考)
• Sonic Pi (⾳樂)
• Python
• 其他
樹莓派優點便宜省電體積小
不要期望他的性能會多好
如要學程式+IO控制
• 改⽤ Raspbian 支援較多
– Scratch +GPIO
– Python + GPIO
下載
• 樹莓派首頁
Ubuntu Mate 樹莓派下載頁
• Ubuntu Mate 樹莓派下載頁
2017/10/11
32
燒錄操作
• 下載
• 解壓縮-7Zip 或 rar
• 燒錄- 寫入記憶體
• 開機-sd card 插入上電開機
• 設定-語言、時區、網路
• 擴展作業系統-如後操作
• 更新軟體
擴展檔案系統
擴展檔案系統
• 原 sd image 為了配合 4G sd card 故剩餘空間不多
–更新安裝程式就會出現空間不足
– Ubuntu 無如 raspbian 的 raspi-config 程式
• 如使⽤ 8G 以上就可以以下方式擴展檔案系統
擴展檔案系統
• 使⽤終端機執行
• sudo fdisk /dev/mmcblk0
• 輸入使⽤者密碼之後
• 刪除第二個分割區
–輸入 d 之後再輸入 2
密碼
2017/10/11
33
擴展檔案系統
• 重建分割區
– 依次輸入
– n
– p
– 2
– Enter
– Enter
擴展檔案系統
• 寫入離開
– w
• 重開機
sudo reboot
重新開機後執行
• 重新開機後執行
• sudo resize2fs /dev/mmcblk0p2
驗證
df
2017/10/11
34
應⽤軟體中文化
LibreOffice 安裝中文界面
• 繁體中文
sudo apt-get install libreoffice-l10n-zh-tw
• 簡體中文
sudo apt-get install libreoffice-l10n-zh-cn
LibreOffice 安裝中文界面-完成 Firefox 中文界面
• sudo apt-get install firefox-locale-zh-hant
2017/10/11
35
Firefox 中文界面
中文輸入法
安裝中文輸入法
酷⾳輸入法
sudo apt-get install -y scim
sudo apt-get install -y scim-tables-zh
sudo apt-get install -y scim-chewing
拼⾳輸入法
sudo apt-get install -y scim
sudo apt-get install -y scim-tables-zh
sudo apt-get install -y scim-pinyin
測試
• 安裝後重啟
2017/10/11
36
聲⾳支援
編輯 config
• 如要支援 hdmi
• sudo nano /boot/config.txt
…
hdmi_drive=2
hdmi_force_hotplug=1
#Pretend all audio formats are supported
hdmi_force_edid_audio=1
…
• 重新開機
sudo reboot