Install and configure VNCServer in Ubuntu
Install VNCServer
Use ssh to log on to Ubuntu and run the following command:
# Sudo apt-get install vnc4server
Disable the Remote Desktop of the original Ubuntu Server
You can first use VNCViewer to connect to Ubuntu, and then remove the first check box under System> Preferences> Remote Desktop. At this time, your VNCViewer will be automatically disconnected.
Configure VNCServer
Log on to the ssh command line and run the following command. Do not add sudo
# Vncpasswd
This command sets the Remote Desktop password for the current user. The. vnc folder is generated in the current user's home directory. after entering the. vnc file, modify the xstartup file:
Vim. vnc/xstartup (Suppose you are in the user root directory at this time)
Comment out twm & (add a # At the beginning of the line), add a gnome-session at the end of the file, save and exit.
Start VNCServer
# Vncserver (-geometry 1440x900) (-alwaysshared) (-depth 16): 1
You can write this command as a shell script in the home directory of the current user.
The depth is between 2 and 32. The larger the value, the better the display, but more resource consumption.
Use VNCViewer to connect to this remote desktop
In VNCViewer, enter the ip address and the desktop number, that is, X. X. X: 1, to connect to the Remote Desktop. The password is the previously set password.
Note: To disable a remote desktop, run the following command:
# Vncserver-kill: 1
": 1" indicates the desktop number when the Remote Desktop is created, that is, port 5901.