VNC introduction and how to remotely connect to a remote Linux interface?

Source: Internet
Author: User
Tags download vnc viewer

VNC is suddenly needed today, but never used this gadget! Later by looking for information on this, here is my rough understanding and use of VNC.

The basic composition of the source of VNC is not introduced, I believe there is no better than the Baidu Encyclopedia introduced.

Http://baike.baidu.com/link?url=Z6-B80x_mQUjxotyvIFstCc-cce2IJXKSclfwbAPz0JUMuhIBqmfRg4u2ycN7jQ4rbLTcwMwfGF2bJML5cRnfK
But one thing to note:
    <span style= "White-space:pre" ></span> can also be remotely connected to UNIX, Linux for graphical operations and the popular XMANAGER,VNC compared to that--the two works differently, <span style= "White-space:pre" ></span> the former (VNC) is a remote connection to the operating system, all operations on the UNIX, Linux host server, <span style= " White-space:pre "></span><span style=" color: #ff0000; " > Even if the "local computer and Operation host network disconnects" during the operation, it does not affect the smooth operation; </span><span style= "White-space:pre" ></span> The latter (Xmanager) is a port that directs the host server's UI interface to the local computer for presentation, <span style= "White-space:pre" ></span><span style= "color: #ff0000; " > If the "Local computer and Operation host Network disconnect" occurs during the operation, the operation will fail! If the work performed in the operation is very important, <span style= "White-space:pre" ></span> cannot be interrupted, such as the Oracle RAC implementation, the result is catastrophic! </span><span style= "White-space:pre" ></span> More importantly, VNC is free, open source, xmanager you may be using to crack the registered version.

The Linux version can be obtained by:

[Email protected] sysconfig]# cat/etc/issuered Hat Enterprise Linux Server release 5.5 (tikanga) Kernel \ r on a \m
To see if VNC is installed:
[Email protected] sysconfig]# rpm-qa| grep vnc-servervnc-server-4.1.2-14.el5_3.1

Download VNC viewer:http://download.csdn.net/detail/u011218159/8340161 in window

There are two ways to configure on the server side:

1. Configure via interface: system--preference--Remote Desktop--Tick all options except (ask you for confiromation option)

2. Configure by command:

[Email protected] ~]# vncserver:1you would require a password to access your desktops. Password:Verify:New ' Localhost.localdomain:1 (root) ' Desktop is localhost.localdomain:1creating default startup script /root/.vnc/xstartupstarting applications specified In/root/.vnc/xstartuplog file Is/root/.vnc/localhost.localdomain : 1.log

Once configured, connect to me via the VNC viewer of the client. Here are some problems:

1. Connection denied: The reason for the firewall!

One workaround: Turn off the firewall

[Email protected] ~]#/etc/init.d/iptables stopflushing firewall rules:                                   [  OK  ]setting chains to policy Accept:filter                    [  OK  ]unloading iptables modules:                                [  OK  ][[email protected] ~]# Lsanaconda-ks.cfg  Desktop  install.log  install.log.syslog
Configure in the firewall configuration file:

Based on the above introduction, if Linux turned on the firewall function, you need to manually open the appropriate port to open the desktop number "1" the corresponding port as an example, the command is as follows [[email protected] ~]# iptables-i input-p TCP--dport 5901 -j Accept[[email protected] ~]# iptables-i input-p TCP--dport 5801-j ACCEPT

2. The connection interface is not the same in the above two ways, the solution:

 Configure VNC graphical desktop environment for KDE or gnom E Desktop environment If you are configured according to my method above, landing on the desktop after the effect is very simple, only one shell to use, this is why? How can I see a cute and beautiful KDE or GNOME desktop environment? The answer to the following is so ugly, because the VNC service defaults to the TWM graphical desktop environment, can be modified in the VNC configuration file Xstartup, first look at this configuration file [[email protected] ~]# <span style= "COLOR: #ff0000;" >vi/root/.vnc/xstartup</span>#!/bin/sh# uncomment the following and lines for normal desktop:# unset SESSION_MA nager# exec/etc/x11/xinit/xinitrc[-x/etc/vnc/xstartup] && exec/etc/vnc/xstartup[-R $HOME/. Xresources] && Xrdb $HOME/. Xresourcesxsetroot-solid greyvncconfig-iconic &xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &tw M & Change the last line of this xstartup file to "Startkde &" and then restart the Vncserver service to log in to the KDE desktop environment to modify the last line of the Xstartup file to "Gnome-session & ", and then restart the Vncserver service after you can log in to the GNOME desktop environment to restart the Vncserver service method: [[email protected] ~]# Vncserver-kill:1[[email  protected] ~]# vncserver:1 

So after that should be no problem, finally finished!!


The following is my reference, if I write above is not complete please see the following content:

1. Verify that VNC is installed by default, the Red Hat Enterprise Linux Installer installs the VNC service on the system. Verify that the VNC service is installed and view the installed VNC version [[email protected] ~]# rpm-q vnc-servervnc-server-4.1.2-9.el5[[email protected] ~] #若系统没有安装, you can find the RPM installation package vnc-server-4.1.2-9.el5.x86_64.rpm of the VNC service under the server directory of the operating system installation disk, the installation command is as follows rpm-ivh/mnt/server/ Vnc-server-4.1.2-9.el5.x86_64.rpm2. Start the VNC service using the Vncserver command to start the VNC service, the command format is "Vncserver: Desktop Number", where "desktop number" is expressed as "digital", Each user has a desktop that needs to occupy 1 desktop boot numbers of 1 for example under [[email protected] ~]# vncserver:1you will require a password to access your desktops. Password:Verify:xauth:creating new Authority file/root/. Xauthoritynew ' testdb:1 (root) ' Desktop is testdb:1creating default startup script. /root/.vnc/xstartupstarting applications specified In/root/.vnc/xstartuplog file is/root/.vnc/testdb:1. Log above command execution process, because is the first execution, need to enter a password, this password is encrypted saved in the user's home directory in the. VNC subdirectory (/ROOT/.VNC/PASSWD) At the same time, the Xstartup configuration file (/root/.vnc/xstartup) is automatically established for the user in the. VNC subdirectory of the user's home directory, and the configuration information in the file is read each time the VND service is started. There is also a "testdb:1.pid" file under the btw:/root/.vnc/directory that records the process number that corresponds to the acquired operating system after VNC is started, which is used to accurately locate the process number when the VNC service is stopped. 3.VNC ServiceRelationship between the port number used and the desktop number the VNC service uses the port number associated with the desktop number, and VNC uses the TCP port starting from 5900, the corresponding relationship is the following table number is "1"----the port number is 5901 the desktop number is "2"----The port number is 5902 the desktop number is "3"---- The port number is 5903 ... The Java-based VNC client Web service TCP port starts at 5800 and is also related to the desktop number, which corresponds to the following table "1"----the port number is 5801, the desktop number is "2"----The port number is 5802, "3"----The port number is 5803 ... Based on the above introduction, if Linux turned on the firewall function, you need to manually open the appropriate port to open the desktop number "1" the corresponding port as an example, the command is as follows [[email protected] ~]# iptables-i input-p TCP-- Dport 5901-j accept[[email protected] ~]# iptables-i input-p tcp--dport 5801-j ACCEPT4. Test VNC Service The first method is to use the VNC viewer Software Landing test, the operating procedure as follows start the VNC viewer software--Server input "144.194.192.183:1"-click "OK"-Password enter the login password-click "OK" Log in to X-window graphical desktop environment--Test success The second method is to use a Web browser (such as Firefox,ie,safari) to log in to the test, the operation process as follows the address bar input http://144.194.192.183:5801/- > appears VNC viewer for Java (This tool is a VNC client program written in Java) interface, while jumping out of the VNC Viewer dialog box, enter "144.194.192.183:1" at the server and click "OK"- Password Enter the login password-click "OK" to login to the X-window graphical desktop environment--Test success (note: VNC Viewer for Java requires JRE support, if the page cannot be displayed, indicating that no JRE is installed, can go to http:// java.sun.com/javase/downloads/index_jdk5.jsp Download the latest JRE for installation here) 5. Configuring the VNC graphical desktop environment for KDE or GNOME desktop environment if you are configured according to my method above, landing on the desktop after the effect is very simple, only one shell to use, this is why? How can I see a cute and beautiful KDE or GNOME desktop environment? The answer is so ugly, because the VNC service defaults to the TWM graphical desktop environment, can be modified in the VNC configuration file Xstartup, first look at this configuration file [[email protected] ~]# vi/root/. vnc/xstartup#!/bin/sh# uncomment the following and lines for normal desktop:# unset session_manager# exec/etc/x11/xinit/x initrc[-x/etc/vnc/xstartup] && exec/etc/vnc/xstartup[-R $HOME/. Xresources] && Xrdb $HOME/. Xresourcesxsetroot-solid greyvncconfig-iconic &xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &tw M & Change the last line of this xstartup file to "Startkde &" and then restart the Vncserver service to log in to the KDE desktop environment to modify the last line of the Xstartup file to "Gnome-session & ", and then restart the Vncserver service after you can log in to the GNOME desktop environment to restart the Vncserver service method: [[email protected] ~]# Vncserver-kill:1[[email  protected] ~]# vncserver:16. Configuring multiple desktops You can use the following methods to start the vncvncserver:1vncserver:2vncserver:3 of multiple desktops ... However, this method of manual startup will expire after the server restarts, so here's how to get the system to automatically manage VNC for multiple desktops by adding information that needs to be managed automatically to the/etc/sysconfig/vncservers configuration file. Desktop 1 is the root User Desktop 2 for OraclE-User For example is configured as follows: vncservers= "desktop number: User name used: The user name used" [[email protected] ~]# vi/etc/sysconfig/ vncserversvncservers= "1:root 2:oracle" vncserverargs[1]= "-geometry 1024x768" vncserverargs[2]= "-geometry 1024x768" 7. Modify the password for VNC access use the command vncpasswd to modify the VNC password for different users, it is important to note that if the VNC configured by different users needs to be modified separately to the respective user, for example, in my experiment, the root user and Oracle user need to be modified separately, The modification process is as follows: [[[email protected] ~]# vncpasswdpassword:verify:[[email protected] ~] #8. Start and stop the VNC service 1) Start the VNC service command [[ Email protected] ~]#/etc/init.d/vncserver startstarting VNC server:1:rootnew ' testdb:1 (root) ' Desktop is testdb:1 Starting applications specified In/root/.vnc/xstartuplog file Is/root/.vnc/testdb:1.log2:oraclenew ' testdb:2 (Oracle) ' Desktop is testdb:2starting applications specified in/home/oracle/.vnc/xstartuplog file Is/home/oracle/.vnc/testdb : 2.log [OK]2] Stop VNC Service command [[[email protected] ~]#/etc/init. D/vncserver stopshutting down VNC server:1:root 2:oracle [OK]3] Restart VNC Service command [[email protected] ~]#/etc/init.d/vncserver restartshutting down VNC server:1:root 2:oracle [ OK]starting VNC server:1:rootnew ' testdb:1 (root) ' Desktop is testdb:1starting applications specified in/root/.vnc/x Startuplog file Is/root/.vnc/testdb:1.log2:oraclenew ' testdb:2 (Oracle) ' Desktop is testdb:2starting applications                                                           Specified In/home/oracle/.vnc/xstartuplog file Is/home/oracle/.vnc/testdb:2.log [OK]4] set up the VNC service automatically load with system boot The first method: Use the "NTSYSV" command to start the graphical service configuration program, add an asterisk before the Vncserver service, click OK, and the configuration is complete. The second method: use "Chkconfig" in the command-line mode of operation, command using the following (predict Chkconfig detailed use method please self-help man a bit) [[email protected] ~]# chkconfig vncserver On[[email protected] ~]# chkconfig--list vncservervncserver 0:off 1:off 2:on 3:on 4:on 5:on 6: Off











VNC introduction and how to remotely connect to a remote Linux interface?

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.