遠端連線 Linux 主機是我們的日常,過去多半用 CRT、PuTTY 這類工具連字符終端,很少想過去連圖形桌面——畢竟書上、課程裡都說 Linux 的桌面可有可無。但我認為只要能把工作用最高效率做完,字符介面也好、圖形介面也罷,都值得用。Windows 有遠端桌面,Linux 也有,這篇就用 VNC 來實現。
[root@localhost ~]# yum install tigervnc-server tigervnc [root@localhost ~]# /etc/init.d/vncserver start
[root@localhost ~]# vncserver :3 # 啟動在 5903 You will require a password to access your desktops. Password: Verify: New 'localhost.localdomain:3 (root)' desktop is localhost.localdomain:3 Log file is /root/.vnc/localhost.localdomain:3.log [root@localhost ~]# netstat -utpln | grep X tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 3181/Xvnc tcp 0 0 0.0.0.0:5903 0.0.0.0:* LISTEN 3401/Xvnc tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 3181/Xvnc tcp 0 0 0.0.0.0:6003 0.0.0.0:* LISTEN 3401/Xvnc
[root@localhost ~]# iptables -F [root@localhost ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination [root@localhost ~]# setenforce 0
正式環境請改為只放行 590x 埠,而不是清空規則。
下一步:
一路使用預設值即可;安裝完成後會跳出授權對話框,取消掉就行。
連線成功: