Virtual Machines


Virtual Machines

Documentation > Products > Virtual Machines > Centos Installation Configuration vncserver

vncserver Installation and Configuration in Centos

Only installation of VNC is discussed in hereby, and you need to install it separately for the graphical interface.

VNC Server Installation in CentOS 6.5


Install vncserver with the following commands:

yum -y install tigervnc-server


  1. Configure as self running after startup. Use the following command to start the service automatically:

chkconfig --level 345 vncserver on

  1. Configure the client connection password. Enter the following command and set the VNC password:


  1. Configure to use GNOME desktop. Execute the command vi /root/.vnc/xstartup to modify the file, and after deleting the twm & at the file name end, add the following: gnome-session &:

  1. Configure the listener port and environment parameters, modify /etc/sysconfig/vncservers file, and modify the two lines of configuration comments below as the following:


vncserverargs[1]="-geometry 1200x800"

  1. Restart the service to enable the configuration:

service vncserver restart

Allow root to Access the Graphical Interface and Generate New machine-id

Execute the following command:

sed -i 's/.!= root./#&/' /etc/pam.d/gdm

dbus-uuidgen >/var/lib/dbus/mechine-id

Close selinux and NetworkManager Services

  1. Check the selinux service and close it, and execute

vi /etc/selinux/config

Confirm that the value of the SELINUX field is disabled, and if not, change it to be disabled.

  1. Close the NetworkManager service, and execute

chkconfig --level 235 NetworkManager off

Test Login Successfully

CentOS7 Installs VNC Server


Install vncserver with the following commands:

yum -y install tigervnc-server


  1. vi edits the configuration file and finds the following line, and execute the command:

vi /lib/systemd/system/vncserver@.service

Change Type into simple. If the username is root, then change into root.

  1. Change /lib/systemd/system/vncserver@.service into /lib/systemd/system/vncserver@:1.service, and execute the command:

mv /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service

  1. Restart systemd and execute the command:

systemctl daemon-reload

  1. Set VNC password. To set a user's password, you must have permission to switch to the user via sudo. If the current user already has root, here I use root to execute "direct vncpasswd".

  1. Set the boot:

systemctl enable vncserver@:1.service

Reboot service:

systemctl start vncserver@:1.service

Test Login

Client connects. After completing the above configuration, install VNC Viewer on the client, and then input the IP address of the server plus VNC port number (5901 by default) for VNC connecting:

If your problem still can not solved, please submit open ticket to us.

Update Time:2019-08-28 21:38:31