歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 無顯示器情況下的遠程控制

Ubuntu 無顯示器情況下的遠程控制

日期:2017/2/28 16:03:49   编辑:Linux教程

一、安裝vnc4server

服務器安裝:sudo apt-get install vnc4server

安裝後執行vncserver會讓你輸入vnc客戶端登錄時輸入的帳號和密碼

安裝後vncserver 會在HOME/.vnc下生成xstartup文件

修改該文件,把默認VNC啟動的twm改成希望啟動的gnome

修改方法是把文件後面的三行文字全部注釋掉, 然後在最後面加上gnome-session & 我的文件內容是

#!/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 &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
gnome-session &

二、重新啟動後再進入

sudo reboot

vncserver 啟動服務

另添加的一塊不知道是不是有用,我也沒有去驗證,如果上面的沒有你可以添加或編譯該文件

sudo vi /etc/X11/xorg.conf
內容如下,建議直接copy
Section "Device" Identifier "VNC Device" Driver "vesa" EndSection   Section "Screen" Identifier "VNC Screen" Device "VNC Device" Monitor "VNC Monitor" SubSection "Display" Modes "1024x768" EndSubSection EndSection   Section "Monitor" Identifier "VNC Monitor" HorizSync 30-70 VertRefresh 50-75 EndSection
三、把vncserver添加到自啟動項中
Copyright © Linux教程網 All Rights Reserved