Automatically install and run VNC Server on a Linux instance

Source: Internet
Author: User
Tags aliyun

Original URL: https://help.aliyun.com/knowledge_detail/41181.html?spm=5176.8208715.110.11.4c184ae8mlC7Yy

You can use the script provided in this article to automatically install and run VNC server on a Linux instance for remote graphical management of the Linux server. Currently, the script is only available for CentOS instances and will install the GNOME desktop environment in the CentOS instance.

VNC Server Scripts

Applicable Image: Currently only available for CentOS mirroring.

How to use: Execute the command as root bash install_vnc_server.sh .

: http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/41181/cn_zh/1504062842088/install_vnc_server.sh .

Instructions for use

This section takes the CentOS 7.4 64-bit operating system as an example of how to install and run VNC Server automatically in a Linux instance, allowing you to remotely connect to a Linux instance from a Windows system via the VNC viewer.

Pre-conditions

Your instance is in a running state. If the instance does not start, start the instance first.

You have already downloaded and installed the VNC Viewer in your Windows system.

Operation Steps

To do this, follow these steps:

  1. Connect to a Linux instance remotely.

  2. Run the command download script install_vnc_server.sh.

    1. wget http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/41181/cn_zh/1504062842088/install_vnc_server.sh
  3. Run the script as root and install VNC Server.

    1. bash install_vnc_server.sh

    Installation takes a long time. When the following information appears on the screen, the VNC server installation is complete. You need to record the random password displayed.

    Description : If the script executes an error, you can try several times.

  4. Run the following command to view the ports that the XVNC service is using in the returned results.

      1. netstat -tulnp

    In this example, the information for the XVNC process in the returned results is shown below.

    1. Active Internet connections (only servers)
    2. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    3. tcp 0 0 0.0. 0.0:5901 0.0. 0.0:* LISTEN 1975/xvnc
    4. tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 1975/Xvnc

    Indicates that the port that VNC server is using is TCP 5901 and 6001, where:

      • TCP 5901: Allows VNC clients to connect to VNC Server via the RFB protocol. Select this port when connecting to the instance using the VNC viewer.
      • TCP 6001: Allow Windows X to connect to VNC Server.
  5. In the security group where the instance is located, add a security group rule to release the ports required by the XNVC service.

    In this example, you need to add 2 security group rules to release TCP 5901 and TCP 6001 ports respectively. The specific rules are shown in the table below.

    Network Type Network card Type Rule Direction Authorization Policy protocol Type Port Range Authorization Type Authorization Object Priority Level
    Vpc No Configuration required into the direction Allow Custom TCP Set to 5901/5901 and 6001/6001, respectively Address segment Access 0.0.0.0/0 1
    Classic Network Public network
  6. If your instance has a firewall enabled, you need to add a rule release port. To do so, the firewall software installed in your instance will prevail.

    In this example, take iptables as an example, you can add rules to release TCP 5901 and port 6001 by executing the following command in turn:

    1. [[email protected] ~]# iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
    2. [[email protected] ~]# iptables -A INPUT -p tcp --dport 6001 -j ACCEPT
    3. [[email protected] ~]# service iptables save
  7. Follow these steps to connect a Linux instance to a local Windows system via the VNC viewer:

    1. Launch the VNC Viewer in your local Windows system.
    2. In the toolbar, select File > New Connection.
    3. In the Properties dialog box, click OKafter configuring the following information:
      • VNC Server: Input Linux 实例的公网 IP 地址:5901 .
      • Name: Enter a connection name according to your needs to facilitate later management.
    4. In the VNC Viewer main window, right-click the icon for the new connection and select Connectfrom the pop-up menu.
    5. In the Authentication dialog box that pops up, enter the random password that appears after the VNC server installation is complete and click OK.

      Note :
      The password used here is not the login password for the instance.

At this point, you have successfully logged into the Linux instance.

FAQs The first time you log in to a CentOS 6 instance, I am prompted to log in as root Super User (as shown), what should I do?

This is a normal hint. You can do this by following these steps:

    1. Tick Don't show me this again.
    2. Close The dialog box by clicking Close.

Automatically install and run VNC Server on a Linux instance

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.