CentOS Configuration Vncserver

Source: Internet
Author: User

One. Installation

    1. Run the following command to install Vncserver as root user;

      Yum Install Tigervnc-server

    2. Also run the following command to install the vncviewer;

      Yum Install VNC

    3. Stop and disable the firewall;

      Systemctl Stop Firewalld.service

      Systemctl Disable Firewalld.service

Two. Configuration

    1. Vncviewer is basically not configured;

    2. Vncserver configuration, create a new profile to open windows 1th as an example (you can also open multiple windows at the same time, modify the number), as follows:

      Cp/lib/systemd/system/[email protected]/lib/systemd/system/[email Protected]:1.service

      Or add one more window:

      Cp/lib/systemd/system/[email protected]/lib/systemd/system/[email Protected]:2.service

    3. Edit/lib/systemd/system/[email Protected]:1.service, set user root related parameters, the final content is as follows:

[Unit]Description=Remote desktop service (VNC)After=syslog.target network.target[Service]Type=forking# Clean any existing files in /tmp/.X11-unix environmentExecStartPre=/bin/sh-c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘ExecStart=/sbin/runuser-l root -c "/usr/bin/vncserver %i"PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh-c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘
    • The above content is best set as the root user, or you may see the following error:

[email protected]:1.service - Remote desktop service (VNC)   Loaded: loaded (/usr/lib/systemd/system/vncserver@:1.service; enabled)   Active: failed (Result: exit-code) since Tue 2015-04-14 10:09:24 CST; 1min 36s ago  Process: 3258 ExecStart=/sbin/runuser-l sysadmin -c /usr/bin/vncserver%i (code=exited, status=1/FAILURE)  Process: 3254 ExecStartPre=/bin/sh-c /usr/bin/vncserver-kill%i > /dev/null2>&1 || : (code=exited, status=0/SUCCESS)Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Starting Remote desktop service (VNC)...Apr 14 10:09:24 F1A-VMHOST-SWPE runuser[3258]: Password:Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: [email protected]:1.service: control process exited, code=exited status=1Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Failed to start Remote desktop service (VNC).Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Unit [email protected]:1.service entered failed state.Warning: Unit filechanged on disk, ‘systemctl daemon-reload‘recommended.

Three. Application

    1. Update Systemctl to make it effective;

      Systemctl Daemon-reload

    2. Set the vncserver password;

      VNCPASSWD Root

      Follow the prompts to enter your password and confirm your password

    3. Start the 1th window that the service uses to enable VNC;

      Systemctl start [email protected]:1.service or vncserver:1

      Close Window # 1th:

      Systemctl Stop [email protected]:1.service or vncserver-kill:1

    4. set to boot automatically;

      Systemctl Enable [email protected]:1.service

      End.

CentOS Configuration Vncserver

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.