1. 刚申请的CentOS VM,
vi /etc/sysconfig/network-scripts/ifcfg-ethx
change "ONBOOT" from no to yes
service network restart重启服务
then the VM can be accessed remotely.

2. firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

centos 7: systemctl status/start/stop/disable firewalld


3. vncserver

If the centos already has GUI, then you don't need to install GNOME Desktop
Don't execute -- yum groupinstall "GNOME Desktop"

(1) Installation
yuminstall tigervnc-server

(2). Adding VNC user
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vim /lib/systemd/system/vncserver@:1.service replace <USER> with your user

(3). Start VNC Service
su user
vncserver

(4). Now make the service enabled on after every reboot with root credentials:
su -
systemctl daemon-reload

systemctl enable vncserver@:1.service

reboot
systemctl start vncserver@:1.service
------------------------------------------------------------------------------------------

input vncserver --help to check the manual
vncserver
vncserver :1
vncserver -kill :2
vncserver -list

the file stored in path /tmp/.X11-unix for special id

***************How to install and configure VNC*****************************************
yum install tigervnc-server
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vi /etc/systemd/system/vncserver@:1.service replace <USER> with your username

firewall settings:
firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload

vncserver, then input the password

Now make the service enabled on after every reboot with root credentials:

su -
systemctl daemon-reload

systemctl enable vncserver@:1.service

reboot
systemctl start vncserver@:1.service

-----------------------------------------------------------------------------------------------------------------------

*****************************************************************************************
df -h
fdisk -l
fdisk /dev/sda
cat /etc/redhat-release