Installing VNC server on CentOS 7

Source: Internet
Author: User

VNC is a good remote tool, regardless of the Windows platform or Linux platform, due to the recent knowledge of CentOS, so it is ready to build a VNC server on CentOS 7 to enable me from the client machine through the VNC Viewer remote connection operation.

If you do not have a desktop environment installed (X Windows), you can install it using the following command, which takes a few minutes to install the packages.

[email protected] ~]# yum check-update[[email protected] ~]# yum groupinstall "X Windows System" [[email protected] ~]# Yu M install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts[[email Protected] ~]# Unlink/etc/systemd/system/default.target[[email protected] ~]# ln-sf/lib/systemd/system/ Graphical.target/etc/systemd/system/default.target[[email protected] ~]# reboot

After rebooting, you can go to the CentOS 7 desktop environment.

Step 1 Install the VNC package by entering the following command

[email protected] ~]# Yum install tigervnc-server-y

Step 2 Create a file in the/etc/systemd/system/directory [email protected]:1.service, and copy the instance configuration file/lib/systemd/system/[email protected] to which

[Email protected] ~]# cp/lib/systemd/system/[email protected]/etc/systemd/system/[email Protected]:1.service

Step 3 Open and edit the/etc/systemd/system/[email protected]:1.service file and replace the user entry with your own username

[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.pid

Note that as root, I am using the root account to log in, so <user> change to root

Step 4 Restart Systemd

[Email protected] system]# Systemctl daemon-reload

Step 5 Create a VNC password for the user

[Email protected] system]# VNCPASSWD

Here I create a password of 123456

Step 6 Enable and start the service

[Email protected] system]# systemctl enable [email protected]:1.serviceln-s '/etc/systemd/system/[email protected]:1. Service '/etc/systemd/system/multi-user.target.wants/[email protected]:1.service ' [[email protected] system]# Systemctl Start Vn[email Protected]:1.service

Step 7 allows the VNC service to pass through the firewall

[Email protected] ~]# firewall-cmd--permanent--add-service vnc-server[[email protected] ~]# systemctl Restart firewall D.service

Now I can remotely view the CentOS 7 graphical interface by using the VNC Viewer client running on WIN10

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/40/wKioL1X42YizNjAnAADImh1gEiQ473.jpg "title=" 1.PNG " alt= "Wkiol1x42yiznjanaadimh1geiq473.jpg"/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/44/wKiom1X419bTRQceAAdW9NG-iVo438.jpg "title=" 2.PNG " alt= "Wkiom1x419btrqceaadw9ng-ivo438.jpg"/> can see the CentOS 7 desktop environment

If you need to stop the VNC service, enter the following instructions.

[Email protected] ~]# systemctl stop [email protected]:1.service

Disable VNC service from System boot (permanent)

[Email protected] ~]# systemctl Disable [email protected]:1.service

Stop the Firewall service

[Email protected] ~]# Systemctl stop Firewall.service

Had a nice day!

Installing VNC server on CentOS 7

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.