https://www.realvnc.com/en/connect/download/viewer/
選擇Windows ——Standalone EXE x64
在服務器上安裝服務端
保證已安裝windows桌面:
yum groupinstall "GNOME Desktop Environment"
或者最小化安裝:yum install xterm
安裝vnc-server
上傳並安裝 tigervnc-server-1.8.0-13.el7.x86_64.rpm
[root@centos7-6 ~]# rpm -ivh tigervnc-server-1.8.0-13.el7.x86_64.rpm
開啟vnc
[root@centos7-6 ~]# vncserver You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n #此處問是否設置一個只讀密碼? 選擇n;若選y的話,進入圖形化后是僅查看模式,不能操作 A view-only password is not used New 'centos7-6:1 (root)' desktop is centos7-6:1 #此處的 1 VNC 服務的序號 Creating default startup script /root/.vnc/xstartup Creating default config /root/.vnc/config Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/centos7-6:1.log [root@centos7-6 ~]#
雙擊剛才下載的VNC-Viewer
輸入ip和序號,vnc訪問:10.10.10.10:1 那么訪問的真正端口是5900+1=5901
也可以直接輸入ip和端口號,如:10.10.10.10:5901
接下來就可以遠程圖形化登錄到服務器了
通過VNC不同端口登錄到服務器,各窗口是相互隔離,互不影響的。
如下:
[root@centos7-6 ~]# vncserver New 'centos7-6:2 (root)' desktop is centos7-6:2 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/centos7-6:2.log [root@centos7-6 ~]#
vncserver -list 查看當前用戶開了多少個vncserver
[root@centos7-6 ~]# vncserver -list TigerVNC server sessions: X DISPLAY # PROCESS ID :1 89580 :2 99820 [root@centos7-6 ~]#
kill掉編號為1的vnc虛擬桌面,當前正在遠程的連接也會中斷
[root@centos7-6 ~]# vncserver -kill :1 Killing Xvnc process ID 89580
[root@centos7-6 ~]# vncserver -list TigerVNC server sessions: X DISPLAY # PROCESS ID :2 99820