CentOS7 VNC Server-tigervnc configuration

Source: Internet
Author: User

Yesterday in my CentOS7 test machine installed a VNC server configuration, reference to a lot of information on the Internet, but there are some shortcomings, especially in the configuration of the root account remote VNC connection configuration file, there is little reference to remind Pidfile configuration to remove/home, caused me to configure the time has been error, tossing a day, and finally in a reference document error analysis to get inspired, finally completed the configuration, first of all my actual operations into documents for your reference, but also for their own later review. The text reads as follows:


1, if the first installation of TIGERVNC, you can skip the 2nd step;
2, if previously installed, you need to remove TIGERVNC by the following steps:
Uninstall the original installed server software: Yum Remove Tigervnc-server
Delete the configuration file under the/etc/systemd/system folder: [Email Protected]:1.service etc
Delete a remote VNC connected account in the home directory of the. VNC folder: Remove-rf ~\.vnc
View/tmp/. X11-unix directory, delete the x[1-9] file,Note X0 cannot delete;
Finally restart the OS
3, installation Tigervnc:yum install Tigervnc-server

--------------------------above is a matter of root user action-------------------------------------------
--------------------------The following are configured as root accounts and other accounts, respectively-----------------------------

"Root account: operation is performed under root account"
4. Create a configuration file under the/etc/systemd/system file
Cp/lib/systemd/system/[email protected]/etc/systemd/system/[email protected]:1. Service
It's important to note that the above1On behalf of the service port number, there are other values, where 1 represents the open service 5901 port, and so on

5, edit the configuration file: Vim/etc/systemd/system/[email Protected]:1.service, change the following two lines (red line), <USER> change to root, the pidfile= behind the/home is removed
[...]
[Service]
Type=forking
# Clean any existing files in/tmp/. X11-unix Environment
Execstartpre=/bin/sh-c '/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | : '

# execstart=/sbin/runuser-l <USER>-C "/usr/bin/vncserver%i"
# Pidfile=/home/<user>/.vnc/%h%i.pid
Execstart=/sbin/runuser-lRoot-C "/usr/bin/vncserver%i"
pidfile=/Root/.vnc/%h%i.pid
Execstop=/bin/sh-c '/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | :‘
6. Set the VNC remote connection password: vncpasswd
7. Add firewall rules
Firewall-cmd--permanent--zone=public--add-service vnc-server
Firewall-cmd--reload
If prompted FIREWALLD does not start, please run FIREWALLD Boot firewall, and then run the above two commands;
8. Set Start
Systemctl daemon-reload Restart daemon make the above configuration effective
Systemctl Enable [email protected]:1.service enable service to start automatically
Systemctl start [email protected]:1. Service startup Services


"Other accounts: take account name CS1 as an example"
4. Create the configuration file under the/etc/systemd/system file [operation under Root account]
Cp/lib/systemd/system/[email protected]/etc/systemd/system/[email protected]:2. Service
It's important to note that the above2On behalf of the service port number, there are other values, where 2 represents the open service 5902 port, and so on

5, edit the configuration file [root account operation]:vim/etc/systemd/system/[email Protected]:1.service, change the following two lines (red line), will <USER> change to CS1
[...]
[Service]
Type=forking
# Clean any existing files in/tmp/. X11-unix Environment
Execstartpre=/bin/sh-c '/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | : '

# execstart=/sbin/runuser-l <USER>-C "/usr/bin/vncserver%i"
# Pidfile=/home/<user>/.vnc/%h%i.pid
Execstart=/sbin/runuser-lCS1-C "/usr/bin/vncserver%i"
pidfile=/home/CS1/.vnc/%h%i.pid
Execstop=/bin/sh-c '/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | :‘
6, set the VNC remote connection password [CS1 account Operation]:VNCPASSWD
7. Add Firewall rule [operation under root account] (this step can be omitted if previously added)
Firewall-cmd--permanent--zone=public--add-service vnc-server
Firewall-cmd--reload
If prompted FIREWALLD does not start, please run FIREWALLD Boot firewall, and then run the above two commands;
8. Set start [operation under Root account]
Systemctl daemon-reload Restart daemon make the above configuration effective
Systemctl Enable [email protected]:2.service enable service to start automatically
Systemctl start [email protected]:2.service start-up service

Reference:http://www.centoscn.com/image-text/install/2016/0407/7008.html
          http://www.cnblogs.com/h2zZhou/p/5209948.html

This article is from the "Hanwei" blog, make sure to keep this source http://davidhan.blog.51cto.com/511334/1886761

CentOS7 VNC Server-tigervnc configuration

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.