Virtual Network Computing tool VNC User Guide

Source: Internet
Author: User
Article title: Virtual Network Computing tool VNC User Guide. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   Introduction
VNC (Virtual Network Computing) is essentially a remote display system. The administrator can not only view the desktop environment on the local machine where the program runs, in addition, you can view the running status of remote machines anywhere on the Internet, and it has cross-platform features.
  
This article will discuss how to set up a VNC-Based X Windows system desktop for Linux. by reading this article, you will be able to log on to the X-Window desktop through a display manager. More importantly, users can securely access the same desktop from any network location through the workstation console.
  
Typically, a graphical workstation system runs a display manager. The display manager discussed in this article refers to applications such as XDM, MCM (GNOME Display Manager) or KDM (KDE Display Manager. A Display Manager provides a graphical logon interface. When a user logs on to the system, the administrator is displayed to start the appropriate window manager (such as fvwm2, GNOME, or KDE ). You can run any application in the window manager. When the user logs out, the application is closed, and the window manager exits. the window manager appears again and waits for the user to log on again. If the same user logs on again, a new window manager is started and all applications must be restarted. This is the work process of the traditional X-Window system desktop. We call such a desktop session an X desktop. When a user uses the workstation's keyboard and monitor to use the workstation, it is called a user's logon through the console, which is to distinguish it from network logon.
    
   Figure 1. a Display Manager
In Virtual Network Computing, we learned how to configure VNC to access a desktop through any machine on the network. Here, "persistence" means that when a user is not connected to the desktop, the desktop does not terminate, but waits for the connection request. When a user uses a VNC client to connect to the VNC server, each window remains in the last exit state, and each opened file remains in the status. The features of the control window manager and the VNC server of the application ensure the continuity of the desktop status.
  
Therefore, any computer on the network can run a VNC client (such as vncviewer) to connect to the workstation to display the desktop. We can even run the VNC client on the workstation that runs the VNC server. We call this desktop session a VNC desktop. we call the workstation that runs the VNC server (and its window manager) a VNC workstation.
  
There is a problem with the VNC desktop. If you want to log on to the VNC workstation through the console, the workstation is also running on the VNC desktop. You may log on to the workstation through other machines on the network. at this time, you often want to continue to connect to the VNC desktop over the network. At the same time, when you log on to the console through a display manager, you want to see the same desktop as when you log on through the VNC connection. However, if you log on to the workstation through the display manager, it will start a new window manager. Basically, you start a new X desktop, which has nothing to do with the VNC desktop that is already running on the workstation.
  
If you want to connect to the VNC desktop on a Unix system, you must run a VNC client, such as vncviewer. This is silly because an application window (vncviewer) based on X is itself a desktop (VNC desktop) on another machine ). It is very troublesome to maintain multi-level redirection like this. in addition to obfuscation, it is also inefficient because the system needs to run two window managers, although only one.
    
This article will discuss how to configure an X server, display manager, and a VNC server so that you can directly log on to the VNC desktop without starting a window manager, and keep all files and applications in the status when you leave until the next logon.
  
   Prerequisites
The situation discussed here can be applied to any Linux release. However, you need an X server that can run, a display manager, and a VNC. We can use the following command to test the prerequisites:
  
Rpm-q XFree86 vnc XFree86-xdm kdebase TPD
You only need to ensure that the XFree86-xdm kdebase or gmt1. The storage location of all configuration files discussed here is based on redhat7.1. Of course, you can configure any Linux system to use the transparent VNC desktop, but the configuration files discussed in this article may be in different locations.
Whether you like to use any display manager, it should be started at system startup. Generally, the following content is configured in the/etc/inittab file:
  
X: 5: respawn:/etc/X11/preofdm-nodaemon
Preofdm is generally a symbolic connection that points to the display manager you want to use. X and your favorite display manager must be started and run.
  
   Configure the VNC server
The VNC server must also be running. you must also configure the VNC server to run your preferred window manager. You can edit the file $ HOME/. vnc/xstartup to start the window manager you like. Use startkde & to start KDE, and use gnome-session & to start GNOME and fvwm2 & to start FVWM2. At the same time, make sure to start vncpasswd in $ HOME/. vnc/passwd to create the password file.
  
RedHat7.1 provides some simple methods to start VNC at system startup. Use linuxconf to set the vncserver startup script (/etc/init. d/vncserver) to enable vncserver when the system starts automatically. However, the default startup script is not flexible enough. Therefore, edit/etc/init. d/vncserver and modify:
  
"Su-$ {display # *:}-c" cd & [-f. vnc/passwd]
& Vncserver :$ {display % :*}""
Is:
  
"Su-$ {display # *:}-c" cd & [-f. vnc/passwd]
& Vncserver $ {ARGS }:: {display % :*}""
Then edit/etc/sysconfig/vncservers:
# The VNCSERVERS variable is a list
# Display: user pairs.
#
# Uncomment the line below to start a VNC server on
# Display: 1 as my 'myusername' (adjust this to your
# Own). You will also need to set a VNC password;
# Run 'Man vncpasswd' to see how to do that.
#
# Do not run this service if your local area network
# Is untrusted! For a secure way of using VNC, see
#.
  
VNCSERVERS = "1: jdi.pdf"
ARGS = "-geometry 1024x768-alwaysshared"
Modify "1024x768" in ARGS to adapt to the actual X desktop parameter configuration. You can add any other VNC server parameter configuration here. Modify jdiers in VNCSERVERS to the user you want to run the VNC desktop. 1 in VNCSERVERS indicates that VNC runs on desktop 1. if you want to add another desktop, you can modify the configuration as follows:
VNCSERVERS = "1: jdi1_2: phred 3: sysadmin"
On the RedHat system, run the following command to start VNC:
/Etc/init. d/vncserver start
Now you can use any VNC client to use the VNC desktop.
  
   Configure the Display Manager
In my Red Hat 7.1 system, I created a file named $ HOME/. xsession. This file is used to set the window manager to run when the display manager is used. When you log on to the console, the manager checks the configuration file. If the file exists, the manager will run the program set in the file. The display manager considers that the package contains the command to start the window manager program that the user wants. Instead of running a window manager such as GNOME or KDE, we will run the VNC client. Edit $ HOME/. xsession as follows:
  
Exec vncviewer-passwd $ HOME/. vnc/passwd
-Fullscreen localhost: 1
If you are using another linux release, the description may be the same for you. A quick detection method is to add the following command to the file:
Exec fvwm2
When you log on to the display manager, if fbwm2 is successfully started, it indicates that you have succeeded. If it is not started successfully, you need to check the system documentation.
  
   Login
Log on to the logon window of the display manager. You will see your favorite desktop.
  
When you log on to the server through the display manager, it will be replaced by the window manager that you choose to run on the VNC server. If you have other computers on the network, try using a client to connect to the server. Then you may see two desktops. When you use a computer to move a window, you can see that the window on another computer is also moving.
  
After logging on to the display server, if the screen blinks and the logon interface is displayed again, an error occurs. First, make sure that the VNC server is running and the. xsession file configuration is correct.
  
It should be noted that you should not use any login features of the exit window manager in the settings. This will terminate the VNC desktop, which may not be the expected result. In this case, Ctrl-Alt-Backspace is used to remove the X server and the console returns to the screen. If you log on again, you will enter the environment you just left, so you can use the console for other users without losing your desktop status.
  
   System principle
When the server starts, it runs the VNC server for each user defined in the/etc/sysconfig/vncservers file. When VNC is started, it reads the. vnc/xstartup file in the user's home directory and uses it to run the window manager you want. The VNC server then waits for the connection request.
  
   : Entire process
The display manager is also started when the system is started and provides a graphical logon interface.
  
For users who have not configured the VNC server and have not correctly set the. xsession file in the main directory, they will obtain the common X desktop when logging on to the display manager. Users with appropriate configurations will get a VNC desktop and be able to access the VNC desktop anywhere on the network.
  
   Disadvantages and other options
The settings discussed here have many advantages. for me, the main advantage is to access my desktop from any computer on the network. The main drawback of using VNC as the default desktop is that the graphic performance of GUI is unstable. For example, playing a movie on a VNC desktop has a poor effect. Most games with fast graph conversion do not run well on VNC. Similarly, when the vnc server is running, it is used as the X server of all applications you run, and it cannot obtain any graphics acceleration features, even if the X server of the local machine has tried graphics acceleration. (You can log out, log in to the system as another user, play a movie or play a game, and then log out. Then, enter the system as the original user,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.