先前介紹過 Solaris 安裝 VNC 遠端安裝 Oracle,有讀者反映 Linux 下遇到問題。近日實測在 Linux (部分發行版預裝) 成功部署,記錄完整步驟供參考。
# 下載
wget https://www.realvnc.com/dist/vnc-4.0-x86_linux.tar.gz
# 解壓
tar -xvf vnc-4.0-x86_linux.tar.gz
cd vnc-4.0-x86_linux
# 安裝至 /usr/local/bin
./vncinstall /usr/local/bin
# 輸出:Copying Xvnc, vncviewer, vncpasswd, vncconfig, vncserver, x0vncserver to /usr/local/bin
# 複製 Java 類別檔 (瀏覽器存取用)
mkdir -p /usr/local/vnc/classes
cp Java/* /usr/local/vnc/classes
vncserver
# 首次執行需設定密碼
You will require a password to access your desktops.
Password: ********
Verify: ********
New 'hostname:1 (root)' desktop is hostname:1
Creating default startup script /root/.vnc/xstartup
Log file is /root/.vnc/hostname:1.log
預設監聽埠:
# 開放防火牆 (以 iptables 為例)
iptables -A INPUT -p tcp --dport 5801 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
service iptables save
# 驗證監聽
netstat -an | grep -E '5801|5901|6001'
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
https://:5801 ,輸入 VNC 密碼進入桌面。:1 (對應 5901 埠)。runInstaller 進行 Oracle 圖形化安裝。xorg-x11-fonts-*)。/tmp 空間、DISPLAY 變數、xhost + 權限。VNC 4.0 安裝簡單、效能足夠,是 Linux 無圖形主機遠端安裝 Oracle 的最佳選擇。配合 SSH 通道轉發 (Port Forwarding) 更可增強安全性。