Install, configure, and use the VNC service on Linux

Source: Internet
Author: User
Article Title: install, configure, and use the VNC service on Linux. 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.

As a DBA, dbca and netca images must be used to create databases and listeners when creating an Oracle database (if you use a script to create a database ), if you are in good health, it is estimated that you can complete the database creation process in the trembling Data room. Because I am sensitive to the cold, do not want to exercise in this way, therefore, we are more willing to taste the aroma of coffee in a comfortable room and spend a relatively boring process of database installation and configuration. So and graphical operation tools are essential, VNC is the most popular graphic operating software in Linux. I have completed this detailed article with the purpose of summarization, sharing and reminder. I hope you will like it.

  1. Check whether the VNC is installed.

By default, the Red Hat Enterprise Linux installer installs the VNC service on the system.

Check whether the VNC service has been installed and check the installed VNC version.

[Root @ testdb ~] # Rpm-q vnc-server

Vnc-server-4.1.2-9.el5

[Root @ testdb ~] #

If the system is not installed, you can find the RPM installation package vnc-server-4.1.2-9.el5.x86_64.rpm for 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.rpm

  2. Start the VNC service

Run the vncserver command to start the VNC service. The command format is "vncserver: desktop Number". The "desktop number" is represented by a number. Each user needs to occupy one desktop.

An example of starting a desktop with ID 1 is as follows:

[Root @ testdb ~] # Vncserver: 1

You will require a password to access your tops.

Password:

Verify:

Xauth: creating new authority file/root/. Xauthority

New 'testdb: 1 (root) 'desktop is testdb: 1

Creating default startup script./root/. vnc/xstartup

Starting applications specified in/root/. vnc/xstartup

Log file is/root/. vnc/testdb: 1.log

During the preceding command execution, a password is required for the first execution. The password is encrypted and stored in the user's home directory. vnc subdirectory (/root /. in vnc/passwd. in the vnc subdirectory, The xstartup configuration file (/root /. vnc/xstartup), the configuration information in this file is read every time the VND service is started.

BTW:/root /. there is also a "testdb: 1. pid file, which records the process number corresponding to the operating system the day after the VNC is started, used to accurately locate the process number when the VNC service is stopped.

  3. 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

  4. Test the VNC service

The first method is to log on to the test using the VNC Viewer software. The procedure is as follows:

Start the VNC Viewer software --> enter "144.194.192.183" on the Server: 1 "--> click" OK "--> enter the Login Password --> click" OK "to log on to the X-Window Graphic desktop environment --> the test is successful.

The second method is to use a Web browser (such as Firefox, IE, Safari) to log on to the test. The procedure is as follows:

Enter http: // 144.194.192.183: 5801/--> in the address bar, the VNC viewer for Java (this tool is a VNC client program written in Java) interface is displayed, and The VNC viewer dialog box is displayed, on the Server, enter "144.194.192.183: 1" and click "OK" --> Password, enter the login Password --> click "OK" to log on to the X-Window Graphic desktop environment --> the test is successful.

(Note: VNC viewer for Java requires JRE support. If the page cannot be displayed, it indicates that JRE is not installed. You can download the latest jrefor installation at http://java.sun.com/javase/downloads/index_jdk5.jsp)

  5. Configure the VNC graphic desktop environment as KDE or GNOME Desktop Environment

If you configured it according to my above method, it would be very simple to log on to the desktop and only one Shell is available. Why? How can we see the cute and beautiful KDE or GNOME desktop environment? The answer is as follows:

The reason for this is that the VNC service uses the twm graphical desktop environment by default. You can modify it in the VNC configuration file xstartup. Let's take a look at this configuration file.

[Root @ testdb ~] # Cat/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 gray

Vncconfig-iconic &

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

Twm &

Change the last line of the xstartup file to "startkde &", restart the vncserver service, and then log on to the KDE Desktop Environment.

Change the last line of the xstartup file to "gnome-session &", restart the vncserver service, and then log on to the GNOME desktop environment.

To restart the vncserver service, follow these steps:

[Root @ testdb ~] # Vncserver-kill: 1

[Root @ testdb ~] # Vncserver: 1

[1] [2] Next page

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.