Windows 7 accesses Ubuntu desktop environment through VNCViewer

  
1. Client access tool under windows
For VNC, there are many client access tools, such as RealVNC, VNCViewer, etc. I prefer VNCViewer, which is relatively compact and lightweight. The use is also very simple, as shown below:

The following: 1 is the assigned desktop number, you can assign different desktop number access to different clients, if it is the default port, you can enter it if Setting the port number also requires port number access after the IP.
2. Ubuntu server configuration
1) First install vncserver service
sudo apt-get install vnc4server
2) After successful installation, open vnc service
If you want to access the root user's desktop The environment uses sudo vncserver. If you access the current normal user environment, you can directly use vncserver. The first time you start, you will need to set a password for use when the client accesses it. You can use vncpasswd to modify it later.

After starting vnc successfully, a .vnc directory will be generated in the main directory.
3) Modify the original xstartup file for graphical access
If you do not modify the xstartup file and access it under the client, the following interface will appear:

that is, only one terminal window has no graphics. Interface, this is obviously not what we want, so how to graphical access? This requires modifying the vnc configuration file xstartup.
The default xstartup file looks like this:
#!/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 &
We need to The last line "x-window-manager &" is changed to our own Ubuntu graphical interface service, then what is it? This depends on what desktop environment you Ubuntu is, Ubuntu has gnome, KDE, Unity and other desktops surroundings.
If it is a gnome desktop, change to gnome-session &;
If it is a KDE desktop, change to startkde &;
If it is a Unity desktop, first go to /usr/share/gnome-session/sessions /Look at the name of the desktop session, if it is ubuntu-2d, then change the last line to:
export STARTUP="/usr/bin/gnome-session --session=ubuntu-2d"$STARTUP
Now Ubuntu is a unity desktop, like this:

After the modification is completed, if you have enabled the vncserver service, you need to use vncserver -kill :1 (here is the default No. 1 desktop, modify it according to your own situation. ) to kill the running desktop service, and then restart the service: vncserver: 1 generate a new session, the client reconnect, a graphical interface will appear.

Note: If you have not used it successfully, your Ubuntu may not have the corresponding desktop environment installed. If it is a gnome desktop environment, you can install it as follows:
(1)Install the basis of x-windows
sudo apt-get install x-window-system-core (usually installed)
(2)Install login manager
sudo apt-get install gdm (also kdm/xdm)
(3) Install Ubuntu desktop
sudo apt-get install ubuntu-desktop

Copyright © Windows knowledge All Rights Reserved