歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux下VNC安裝設置

Linux下VNC安裝設置

日期:2017/2/28 14:50:13   编辑:Linux教程
Oracle在Linux上的安裝需要用到圖形界面(靜默安裝除外),身體好的同志完全可以在機房裡面頂著做,身體素質一般的還是老老實實的遠程操作吧。方便起見我們就使用Linux自帶的vnc-server。

首先查看是否安裝了vnc-server服務:

[root@localhost ~]# rpm -qa vnc-server

vnc-server-4.0-8.1

如果沒有安裝則上傳安裝包安裝即可,安裝完成以後運行vncserver,如果用戶是第一次運行需要設置vnc密碼,否則不需要設置。

[root@localhost ~]$ vncserver

You will require a password to access your desktops.

Password:

Verify:

xauth: creating new authority file /root/.Xauthority

New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1

Creating default startup script /root/.vnc/xstartup

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/localhost.localdomain:1.log

上面的這段話表示啟動了一個圖形終端,編號為1。現在我們就可以通過vncviewer等工具遠程連接服務器了,在連接的時候需要提供圖形終端號。連接上以後會發現圖形界面相當的丑陋,因為默認的圖像終端使用的是xterm+twm,我們可以通過修改啟動腳本將gnome或kde作為默認的圖像終端。編輯用戶home目錄下的/.vnc/xstartup,將twm替換為gnome-session並重啟vncserver即可。

[root@localhost ~]# vi /root/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

gnome-session &



[root@localhost ~]# vncserver -kill :1

Killing Xvnc process ID 4117



[root@localhost ~]# vncserver

New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/localhost.localdomain:1.log
Copyright © Linux教程網 All Rights Reserved