Let's just say what VNC is. (Virtual Network Computing) VNC allows Linux systems to access Linux desktops like Remote Desktop access in Windows. This document configures the machine to operate in a CentOS 7 HP server Environment of the Xingning Network Information Center.
First try the server with VNC.
[Email protected] ~]# rpm-q tigervnc tigervnc-server
If not installed, it will appear directly.
Package tigervnc are not installedpackage Tigervnc-server are not installed
If you do not have the X-windows desktop installed, install Xwindows first
[email protected] ~]# yum check-update[[email protected] ~]# yum groupinstall "X Window System" [[email protected] ~]# Yum 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
The first step is to install the VNC packages:
[email protected] ~]# Yum install tigervnc-server-y
The second step, modify the configuration information, create a folder under/etc/systemd/system/[email Protected]:1.service example config file from/lib/systemd/system/[email Protected] copy into the inside
[Email protected] ~]# cp/lib/systemd/system/[email protected]/etc/systemd/system/[email Protected]:1.service
Then open the configuration file/etc/systemd/system/[email Protected]:1.service Replace the default user name
Find this line
Execstart=/sbin/runuser-l <USER>-C "/usr/bin/vncserver%i" pidfile=/home/<user>/.vnc/%h%i.pid
Here I log in directly with the root user, so I replaced
Execstart=/sbin/runuser-l root-c "/usr/bin/vncserver%i" pidfile=/root/.vnc/%h%i.pid
If it's another user, such as linoxide, replace the following
Execstart=/sbin/runuser-l linoxide-c "/usr/bin/vncserver%i" pidfile=/home/linoxide/.vnc/%h%i.pid
Step three, Reload Systemd
[Email protected] ~]# Systemctl daemon-reload
Fourth step, set the password for VNC
[Email protected] ~]# VNCPASSWD
Fifth step, because CentOS 7 on my side is using iptable firewall, so
Vim/etc/sysconfig/iptables
In the right place add
-A input-m state--state new-m tcp-p TCP--dport 5900:5903-j ACCEPT
Restart Iptable
Service Iptables Restart
If you are using the CentOS 7 default firewall, you may need to
[Email protected] ~]# firewall-cmd--permanent--add-service vnc-server[[email protected] ~]# systemctl Restart firewall D.service
Sixth step, set the default startup and enable VNC
[Email protected] ~]# systemctl enable [email protected]:1.service[[email protected] ~]# systemctl start [email protected ]:1.service
So basically the CentOS end is set up, the Windows side to go to the next VNC Viewer software. Connect it and try it a little rough, but up there.
Centos 7 Installation VNC step