VNC Server configuration in Redhat 6.0

Source: Internet
Author: User

VNC Server configuration method in Redhat 6.0 about how to configure VNC Server in Linux, there are many tutorials or articles on the internet, however, the application cannot completely solve our problem in our environment, so here I will configure the VNC Server method in Redhat 6.0 and summarize the solutions to possible problems here, for your reference. 1. Check whether the system has installed vnc-server [root @ localhost ~]. # Rpm-qa | if grep vnc returns a value similar to vnc-server, note that vnc-server has been installed. 2. You can find the installation method on the vnc-server network by entering [root @ localhost ~]. # When yum install tigervnc-server is executed in our environment, the system prompts No package tigervnc-server available. therefore, you can only execute [root @ localhost ~] first. # Yum search vnc find available packages in the returned results, and then execute the corresponding package. [Root @ localhost ~] # Yum install vnc-server 3. Enter [root @ localhost ~] in the configuration file of vnc-server # Vi/etc/sysconfig/vncservers: # The VNCSERVERS variable is a list of display: user pairs. # Uncomment the lines below to start a VNC server on display: 2 # 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 # <URL: http://www.uk.research.att.com/archive/vnc/sshvnc.html>. # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # Use "-nohttpd" to prevent web-based VNC clients connecting. # Use "-localhost" to prevent remote VNC clients connecting using t when # doing so through a secure tunnel. see the "-via" option in the # 'man vncviewer 'manual page. # VNCSERVERS = "2: myusername" # VNCSERVERARGS [2] = "-geometry 800x600-nolisten tcp-nohttpd-localhost" follow the instructions below to know how to configure it. Add VNCSERVERS = "1: root" at the end of the file to complete the configuration of the root user. The VNCSERVERARGS parameter line can be left empty. Note: 1) VNCSERVERS = supports multiple users, separated by spaces. For example, VNCSERVERS = "1: myusername 15: otheruser" ---> here, 1 and 15 are the port numbers used for connection. 2) the data in [] After VNCSERVERARGS must be consistent with the user value after VNCSERVERS. Basic VNCSERVERARGS parameters include-geometry desktop size. The default value is 1024x768-nohttpd, which does not listen to HTTP port-nolisten tcp does not listen to port X-localhost, which only allows access from the local machine-AlwaysShared by default, at the same time, you can only have one vncviewer connection (also related to client configuration). Once 2nd connections are connected, 1st connections are disconnected. this parameter allows you to connect to multiple vncviewer-SecurityTypes at the same time. You do not need to use the default value of VncAuth for password authentication. 4. Set the VNC connection password after configuring the configuration file in the previous step, we need to use vncpasswd to set the authentication password for the vnc connection. [Root @ localhost ~] # VncpasswdPassword: Verify: note that the vncpass here can only be run under the vnc user. For example, if you want to configure a vnc authentication password with the username of oracle, you need to switch to the oracle user before running the vncpasswd command. [Root @ localhost ~] # Su-oracle [oracle @ localhost ~] $ VncpasswdPassword: Verify: 5. Start vncserver. The installation and configuration of the VNC Server are described. The following describes the general management methods for this service. [Root @ localhost ~] # Service vncserver startStarting VNC server: 1: rootNew 'localhost. localdomain: 1 (root) 'desktop is localhost. localdomain: 1 Starting applications specified in/root /. vnc/xstartupLog file is/root /. vnc/localhost. localdomain: 1.log [OK] the command to disable this service is [root @ localhost ~] # Service vncserver stop you can also run the following command to view the running status of vncserver [root @ localhost ~] # Service vncserver status here, set vncserver to start by default at startup. [Root @ localhost ~] # Chkconfig vncserver on 6. Although the above process has been completed and the vncserver service has been started, it still cannot be connected. The possible reason is that the request is blocked by the firewall. This section describes how to configure the firewall. When the vnc service is running, you can use netstat-antpl to check that three ports are listening. 5901 5801 6001 default, vnc service listens to three TCP ports RFB (Remote FrameBuffer) protocol default port: 5900 + display number HTTP protocol default port: 5800 + display number X protocol default port: the display number used by the vncserver of the 6000 + display number starts from 1 by default. You can also specify the port number. Because we need to establish a remote connection, we only need the RFB Protocol. The following describes how to configure a firewall. [Root @ localhost ~] # The content of the vi/etc/sysconfig/iptables file is # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. * filter: input accept [0: 0]: forward accept [0: 0]: output accept [0: 0]-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT-A INPUT-p icmp-j ACCEPT-A INPUT-I lo-j ACCEPT-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT-A INPUT-j REJECT -- Reject-with icmp-host-prohibited-a forward-j REJECT -- reject-with icmp-host-prohibitedCOMMIT according to the configuration in the/etc/sysconfig/vncservers file, we need to open the port number of 5901, just add A line-a input-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT under-a input-m state -- state NEW-m tcp-p tcp -- dport 5901-j ACCEPT enables port 5901. When using VNC-Viewer for connection, 192.168.10.131: 1 -- here: 1 is the port number, which is 5900 + 1, the value 1 is specified in/etc/sysconfig/vncservers. The value is less than 100. If the value is not 100, it can be expressed directly by 192.168.10.131: 1, if the value specified in vncservers is greater than 100 and contains 100, the complete port value is used during connection. For example, if 100 is specified in vncservers, the connection should be like this: 192.168.10.131: 6000vnc uses the port 5900 by default, this should be changeable, but the source code must be changed. 7. If you configure the VNC graphic desktop environment as KDE or GNOME desktop environment, you may encounter this situation. All vnc configurations are complete and run properly, however, the screen displayed after logon with VNC-Viewer is gray (black) and cannot be operated. Why. (Unfortunately, you need to read the following content and configure it. If you do not meet your requirements, don't be gloated. You can understand the principles and be prepared .) In the original VNC xstartup program, the default value is to start twm instead of GNOME or KDE. Therefore, you need to make a small modification to the xstart file, [root @ localhost ~] # The content of the vi. vnc/xstartup file is :#! /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 /. xresourcesxsetroot-solid greyvncconfig-iconic & xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop" & twm & I commented out the last two lines when setting add gnome-session and restart vncserver [root @ localhost ~]. # Service vncserver restart log on to VNC-Viewer again, and the cute Redhat desktop appears, successfully solving the gray screen problem.

Related Article

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.