Centos 7 VNC Installation Steps
VNC allows the Linux system to access the Linux desktop like remote desktop access in Windows. This configuration machine runs in a Centos 7 HP Server in xingning Network Information Center.
First, try installing VNC on the server.
[root@wic ~]# rpm -q tigervnc tigervnc-server
If it is not installed, it will appear directly
package tigervnc is not installedpackage tigervnc-server is not installed
If the X-Windows desktop is not installed, install Xwindows first.
[root@wic ~]# yum check-update[root@wic ~]# yum groupinstall "X Window System"[root@wic ~]# yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts[root@wic ~]# unlink /etc/systemd/system/default.target[root@wic ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target[root@wic ~]# reboot
Step 1: Install VNC packages:
[root@wic ~]# yum install tigervnc-server -y
Step 2: modify the configuration information and create a vncserver folder under/etc/systemd/system/@: 1. service extracts the example config file from/lib/systemd/system/vncserver @. copy service to it
[root@wic ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Open the configuration file/etc/systemd/system/vncserver @: 1. Replace the Default User name with the service.
Find this line
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"PIDFile=/home/<USER>/.vnc/%H%i.pid
Here I log on directly with the root user, So I replaced it
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"PIDFile=/root/.vnc/%H%i.pid
For other users, replace john with the following:
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"PIDFile=/home/<USER>/.vnc/%H%i.pid
Step 3: Reload systemd
[root@wic ~]# systemctl daemon-reload
Step 4: set a password for VNC
[root@wic ~]# vncpasswd
Step 5: Because Centos 7 on my side uses iptable firewall
vim /etc/sysconfig/iptables
Add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT
Restart iptable
service iptables restart
If you use the Centos 7 default firewall, you may need
[root@wic ~]# firewall-cmd --permanent --add-service vnc-server[root@wic ~]# systemctl restart firewalld.service
Step 6: Enable and enable VNC by default
[root@wic ~]# systemctl enable vncserver@:1.service[root@wic ~]# systemctl start vncserver@:1.service
In this way, the Centos end is basically set up, and the Windows end will go to the next VNC Viewer software. Try connecting. It looks a little simple but it goes up.