Linux environment VNC deployment process Detailed

Source: Internet
Author: User

VNC Server machine address: 10.165.38.68

VNC client machine Address: Native (Windows machine)

VNC Client Package: Vnc_82537_82537.rar (360 cloud Disk: Https://yunpan.cn/cSMqyfyY2xTIa extract code 5521)

Install the VNC server on the Linux machine, and then connect to the service side via the VNC client tool on the local Windows machine, so that the Linux machine can operate in a GUI manner, and the servers that connect to the remote Linux machine display the effect

Here is a detailed explanation of the specific steps:

One: Verify that the VNC service is installed

Rpm-qa|grep Tigervnc

The discovery shows that VNC has been installed, indicating that the VNC service has been installed

If the display is not installed, such as:

There are two types of installation options available:

    • RPM Package Installation

      This method is best used on the basis of a system installation package, such as the redhat-linux.5.5.for.x86-server-5.5 system. ISO package, open after two packages in the server directory


Just upload the Vnc-server package, and then run the command.

RPM-IVH vnc-server-4.1.2-14.el5.3.1.i386.rpm

To install the VNC service, this method can avoid the VNC version and system inconsistencies, because it is from the system to find the VNC files, but the ISO file is difficult to obtain, generally find this

RPM files are to be found through Baidu, looking for the system version of the VNC RPM package to install. Otherwise, due to version inconsistencies, a number of subsequent problems can result.

    • Yum Command installation (recommended method)

This method is relatively straightforward and can be used directly with the Yum command:

Yum-y Install Tigervnc-server

It will automatically download the dependent package for you, if your yum command is not available, it is recommended to use the following command:

echo nameserver 8.8.8.8 >>/etc/resolv.conf

You can then use the Yum command.

Second: Start the VNC service

Use the Vncserver command to start the VNC service, the command format is "Vncserver: Desktop Number", where "desktop number" as a "number" means, each user needs to occupy 1 desktop

A desktop example with a startup number of 1 is as follows:

Command for Vncserver:1 (note that there are spaces between vncserver and:)

During the execution of the above command, because it is the first time to execute, you need to enter a password, this password is encrypted in the user's home directory in the. VNC subdirectory (/ROOT/.VNC/PASSWD), and the user's home directory in the. VNC subdirectory automatically establishes the Xstartup profile ( /root/.vnc/xstartup), the configuration information from the file is read every time the VND service is started. It is also important to note that the password set here is the password that we will enter when we connect with the Vncserver client tool.

There is also a "hostname: 1.pid" file under the btw:/root/.vnc/directory, which records the process number corresponding to the operating system after VNC is started, which is used to accurately locate the process number when the VNC service is stopped.

In this way, the VNC server starts successfully, this is the vncserver:1 command executed with the root user, then the user who connects with Vncserver client after startup is the root user.

If installed with the root user, start with the AIUAP user (other user): The user vncserver the client connection to the server is the AIUAP user

Third: The 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, and VNC uses the TCP port starting with 5900, the corresponding relationship is as follows
The desktop number is "1"----port number is 5901
The desktop number is "2"----port number is 5902
The desktop number is "3"----port number is 5903
......
The Java-based VNC client Web service TCP port starts at 5800 and is related to the desktop number, which corresponds to the following
The desktop number is "1"----port number is 5801
The desktop number is "2"----port number is 5802
The desktop number is "3"----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 ACCEPT

Quad: Configure 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?
It's so ugly because the VNC service uses the TWM graphical desktop environment by default and can be modified in the VNC configuration file Xstartup, first look at this configuration file:

[Email protected] ~]# Vi/root/.vnc/xstartup

You can see the last behavior: Twm &

Change the last line of this xstartup file to "Startkde &", and then restart the Vncserver service to log in to the KDE desktop environment

Change the last line of this xstartup file to "Gnome-session &" and then restart the Vncserver service to log in to the GNOME desktop environment,

If a black screen is found after connecting to VNC, the reason is that the GNOME Desktop environment is not installed, using

Yum-y groupinstall "GNOME Desktop Environment"

You can install the GNOME Desktop environment, after the installation is complete, you can restart the VNC service that executes vncserver-kill:1, and in the execution vncserver:1, again into the discovery screen.

If you find that executing the command error is as follows:

Perform the following command installation:

Yum Clean All

Yum groupinstall "X window System" "Desktop"

Yum-y Install gnome*?

You can install the GNOME Desktop environment, after the installation is complete, you can restart the VNC service that executes vncserver-kill:1, and in the execution vncserver:1, again into the discovery screen.

Five: Configure multiple desktops

You can start VNC for multiple desktops using the following methods:

Vncserver:1
Vncserver:2
Vncserver:3

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. The following is the example of a desktop 1 root user Desktop 2 for an Oracle User:
Format: vncservers= "desktop number: User name to use Desktop number: User name used"

Execute the vi/etc/sysconfig/vncservers command, add the configuration: Depending on your own user configuration, here I configured root and AIUAP user

vncservers= "1:root 2:aiuap"
vncserverargs[1]= "-geometry 1024x768"
vncserverargs[2]= "-geometry 1024x768"

VI: VNC service Management

A: Modify the VNC access password

Using 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, if I execute the vncpasswd command with the root user, only the root user's VNC password will be modified. Other users are unaffected:

B: Start the VNC service

Based on the fifth step, the user's corresponding desktop number has been configured in the configuration file, and the service vncserver Start command is executed to start all the user-corresponding VNC services.

C: Stop the VNC service

Also based on the Fifth Foundation, execute the Service vncserver Stop command to shut down the VNC service for all users in the configuration file

Seven: Client connection install start-up VNC server

Download the article at the beginning of the Vnc_82537_82537.rar package to your own local machine, double-click Vncviewer.exe Launcher

The server enters the address of the machine where the VNC service is installed, followed by the same number as the vncserver:1 followed by the Vncserver startup (if the fifth step and vncservers= "1:root 2:AIUAP" are configured in the same desktop number), If I write 1 then the root user connects to 10.165.38.68, and if 2 is the AIUAP user connection to the 10.165.38.68 server

Click OK, will let you enter the password, where the password and the second step in the start Vncserver input password consistent

Click OK, you can go to the beginning of the article that the interface, you can see the upper right corner of the user to enter the server name with 1 into the root, with 2 into the AIUAP

So far Linux installed on the VNC server and from the client to connect to the VNC server all the knowledge point is finished, the self-feeling content is very thin, this is my usual work will install this and then online also refer to a lot of people write, summed up their own installation test many times are very useful set.

Linux environment VNC deployment process Detailed

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.