The process of installing the VNC service under Linux

Source: Internet
Author: User
Tags execution log requires web services iptables port number linux

1. First check if VNC software is installed

[Root@ocm1 ~]# Rpm-qa|grep VNC

vnc-server-4.1.2-14.el5_3.1

2. Start VNC Service

Use the Vncserver command to start, format: Server:1, this is the city: 1 is the desktop number, each connection requires a desktop number.

[Root@ocm1 ~]# Vncserver:1

You'll require a password to access your desktops.

Password:

Password must is at least 6 characters-try again

Password:---Need to enter a password

Verify:

Xauth:creating new Authority file/root/. Xauthority

New ' ocm1.bys.com:1 (root) ' Desktop is ocm1.bys.com:1

Creating default startup Script/root/.vnc/xstartup

Starting applications specified In/root/.vnc/xstartup

Log file Is/root/.vnc/ocm1.bys.com:1.log

During the execution of the above command, because it is the first execution, a password is required to be encrypted and stored in the. VNC subdirectory (/ROOT/.VNC/PASSWD) in the user's home directory, and the Xstartup configuration file is automatically established for users in the. VNC subdirectory under the user's home directory ( /root/.vnc/xstartup), the configuration information in the file is read every time the VND service is started.

The/root/.vnc/directory also has a "testdb:1.pid" file that records the process number that corresponds to the acquired operating system after the start of VNC, and the exact location of the process number when the VNC service is stopped.

The relationship between the port number used by the 3.VNC service and the desktop number

The port number used by the VNC service is related to the desktop number, and VNC uses the TCP port starting at 5900, which corresponds to the following

Desktop number is "1"----port number is 5901

Desktop number is "2"----port number is 5902

Desktop number is "3"----port number is 5903

......

The Java-based VNC client Web Services TCP port starts at 5800 and is also related to the desktop number, which corresponds to the following

Desktop number is "1"----port number is 5801

Desktop number is "2"----port number is 5802

Desktop number is "3"----port number is 5803

......

Based on the above introduction, if the Linux firewall features, you need to manually open the appropriate port, to open the desktop number of "1" the corresponding port for example, the following command

[Root@testdb ~]# iptables-i input-p tcp--dport 5901-j ACCEPT

[Root@testdb ~]# iptables-i input-p tcp--dport 5801-j ACCEPT

4. Test VNC service is normal

The first approach is to use the VNC Viewer software to log on to the test, the following procedure

Start the VNC viewer software--> Server input "192.168.57.215:1"--> click "OK"--> password Enter login password--> Click "OK" landing to X-window graphics desktop environment--& Gt Test successful

The VNC service defaults to the TWM Graphics desktop environment--similar to the shell--you can enter oclock in the open window to see if the clock icon is available.

The second approach is to use a Web browser (such as Firefox,ie,safari) to log in to the test, the following procedure

The Address bar input http://192.168.57.215:5801/--> appears VNC viewer for Java (This tool is the VNC client program written in Java) interface, and also out of the Vnc Viewer dialog box, enter the server 144.194.192.183:1 "click" OK "--> password Enter login password--> Click" OK "landing to X-window graphics desktop environment--> test success

(Note: VNC Viewer for Java requires JRE support, and if the page cannot be displayed, it means that the JRE is not installed, and you can download the latest JRE to the http://java.sun.com/javase/downloads/index_jdk5.jsp for installation)

########### #此时使用VNC Viewer to see the shell interface, but not KDE or GNOME desktop environment

5. Configure VNC Graphics desktop environment for KDE or GNOME desktop environment-I am here configured for GNOME

How can I tell if Linux is installed with GNOME/KDE? --I'm gnome here.

[ROOT@OCM1 ~]# Ps-ef|grep Gnome---or ps-ef|grep KDE

Oracle 2541 2513 0 10:53? 00:00:00/usr/bin/gnome-session

Because the VNC service uses the TWM Graphics desktop environment By default, it can be modified in the VNC configuration file Xstartup. --The last line in/root/.vnc/xstartup: Twm & Replace with: Startkde & or Gnome-session &

My file is modified as follows:

[Root@ocm1 ~]# Vi/root/.vnc/xstartup

#!/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 &

Xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &

#twm &

Gnome-session &

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.