1. Install the vnc server in ubuntu.
$sudo apt-get install vnc4server
2. create a password for current account by below command.
$vncpasswd
3. Start the vnc4server, then the .vnc/xstartup file will be created.
$vncserver
4. Open the .vnc/xstartup file and edit it as the following.
$vi ~/.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 &
-
#x-terminal-emulator -geometry 80x24+10+10 -ls -title
-
"$VNCDESKTOP Desktop" &
-
x-window-manager &
Uncomment the lines that start with unset and exec. Comment out the lines that start with xsetroot, vncconfig, xterm and .
5. Change the permissions on the /etc/X11/xinit/xinitrc file to make it executable.
$sudo chmod 755 /etc/X11/xinit/xinitrc
6. Stop the vnc4server.
$vncserver -kill :1
Please pay attention to the number after the colon. When the vncserver started, a number will be allocated.
So when stop the vncserver must match with the allocated number.
7. Restart the vncserver as the following.
$vncserver -geometry 1280x800 -alwaysshared :1
You can set the resolution for your screen and allocate a number for account.
8. Connect the VNC server from remote computer.
vncviewer xxx.xxx.xxx.xxx:1.
阅读(1909) | 评论(0) | 转发(0) |