Install vnc in linux

Source: Internet
Author: User
Environment: LinuxRedHatAs4 Step 1: check whether vncserver [root @ hxloracle] # rpm-qa | if the grepvncvnc-4.0-8.1vnc-server-4.0-8.1 is not installed, find the vnc-related software package installation in the linux installation media (the installation process is skipped here ). step 2: configure the environment: Linux Red Hat As 4 Step 1: Check whether the vnc server is installed
[Root @ hxl oracle] # rpm-qa | grep vnc
Vnc-4.0-8.1
Vnc-server-4.0-8.1
If you have not installed the software package, you can find the vnc-related software package installation in the linux installation media (the installation process is skipped here). Step 2: Configure
1. configure Linux host 1). [root @ hxl] # vncserver: 1 # start vnc server2). [root @ hxl] # vim ~ /. Vnc/xstartup: comment out twm in the xstartup file and add/usr/bin/startkde & (KDE desktop) or/usr/bin/gnome-session & (GNOME Desktop) startkde & # indicates that the remote client will log on to the Linux KDE desktop (the result is not very good)
Gnome-session & # indicates that the remote client will log on to the GNOME desktop. xstartup file of Linux. the default content is as follows #! /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 gray
Vncconfig-iconic &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
The content after twm & modification is as follows:
#! /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 gray
Vncconfig-iconic &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Gnome-session & 3). [root @ hxl] # vncserver-kill: 1 // vnc service desktop number 1. Note that spaces are required between kill and.
[Root @ gliethttp root] # vncserver: 1 // restart vnc service desktop number 1 4 ). [root @ hxl] # vncpasswd // Set the logon password Step 3: log on via vnc Method 1: log on via vnc windows client, enter the server address (e.g. 192.168.30.33: 1 ), prompt to enter the password to log on to linux. if the gray interface is displayed after logon, you need to configure the/etc/hosts file to match the IP address and hostname. [root @ hxl ~] # More/etc/hosts
# Do not remove the following line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost. localdomain localhost
: 1 localhost6.localdomain6 localhost6
After modifying 192.168.30.33 hxl.com hxl, restart the network [root @ hxl. vnc] # service network restart Method 2: use a Web browser to log on, enter http: // 192.168.30.33: 5801/in the address bar, and enter the password to log on to linux. 5. configure/etc/sysconfig/vncservers to define VNCSERVERS
As follows: VNCSERVERS = "1: root" defines that the root user uses the desktop number 1. note: run the vncserver command to start the VNC service. The Command format is "vncserver: desktop number." desktop number "is represented by" number, each user connects to one desktop. for example, vncserver: 1 start desktop number 1, vncserver: 2 Start desktop number 2.

Relationship between the port number used by the VNC service and the desktop number
The port number used by the VNC service is related to the desktop number. The VNC uses the TCP port starting from 5900. the corresponding relationship is as follows:
Desktop number is "1" ---- port number is 5901
Desktop number "2" ---- port number is 5902
Desktop number "3" ---- port number is 5903
......
The TCP port of the Java-based VNC client Web service starts from 5800 and is also related to the desktop number. the corresponding relationship is as follows:
Desktop number is "1" ---- port number is 5801
Desktop number "2" ---- port number is 5802
Desktop number "3" ---- port number is 5803
......
Based on the above introduction, if the firewall function is enabled in Linux, you need to manually enable the corresponding Port. for example, to enable the corresponding port with the desktop number "1", the command is as follows:
[Root @ testdb ~] # Iptables-I INPUT-p tcp -- dport 5901-j ACCEPT
[Root @ testdb ~] # Iptables-I INPUT-p tcp -- dport 5801-j ACCEPT

Note: 1. if the copy operation fails, run vncconfig to check the three options.
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.