How to install Gnome desktop (GUI) on CentOS 6, 7 and setup remote VNC and xRDP connection?

This tutorial explains how to install Gnome desktop environment (GUI) on CentOS 6, 7 systems and setup remote VNC and xRDP connection.

  1. Setup Gnome desktop environment (GUI).
  2. Setup VNC connection.
  3. Setup xRDP connection.
  4. Important notes.

1. Setup Gnome desktop environment (GUI).

1.1. Install Gnome GUI.

Command: yum groupinstall "GNOME Desktop" -y

1.2. Enable Gnome GUI on system start.

Command: ln -sf /lib/systemd/system/ /etc/systemd/system/

2. Setup VNC connection.

2.1. Install the tigervnc server and X11 fonts.

Command: yum install tigervnc-server xorg-x11-fonts-Type1 -y

2.2. Copy the VNC server configuration file from /etc/systemd/system/ to configure the service.

Command: cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:5.service

By default the VNC server listens on 5900, but you can setup a different port.  However, we can run the service on a sub-port of the default port 5900, which we did by adding the :5 in vncserver@:5.service. Now you will be able to connect to the VNC server by specifying ipaddress:sub-port, for example: or

2.3. Edit the copied file.

Command: nano /etc/systemd/system/vncserver@:5.service


# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
ExecStart=/usr/sbin/runuser -l <USER> -c “/usr/bin/vncserver %i”
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

2.4. Replace <USER> with your real user (for example root).

2.5. Start the VNC server.

Command: vncserver

Note: You will be requested to set the VNC server password: You will require a password to access your desktops after starting vncserver. Enter and verify the password for the desktops.

2.6. Reload the systemctl daemon as root.

Command: systemctl daemon-reload

2.7. Start the VNC service as root.

Command: systemctl start vncserver@:5.service

2.8. Enable VNC service on system startup as root.

Command: systemctl enable vncserver@:5.service

2.9. Now you can connect to the server via the VNC remote connection by specifying ipaddress:sub-port (for example: or via a VNC remote connection client.

Note: We recommend rebooting your server at this point before connecting remotely for the first time.

3. Setup xrdp connection.

3.1. Install xrdp (VNC server is required for xrdp to run normally).

Command: yum install xrdp -y

3.2. Start the xrdp service (xrdp will listen on port 3389 by default).

Command: systemctl start xrdp.service

3.3. Enable xrdp on system boot.

Command: systemctl enable xrdp.service

3.4. Now you can connect to your server simply using your Windows Remote Desktop Connection.

4. Important notes.

4.1. Open the ports in your firewall to your remote VNC (5905) and xRDP (3389) connection services.


firewall-cmd --zone=public --add-port=5905/udp --permanent

firewall-cmd --zone=public --add-port=5905/tcp--permanent

firewall-cmd --zone=public --add-port=3389/udp --permanent

firewall-cmd --zone=public --add-port=3389/tcp--permanent

firewall-cmd --reload

4.2. NetworkManager may cause problems as it will try to take over the management of your default network interface so you can disable it (or properly configure it).

Command: systemctl disable NetworkManager.service



You are now able to remotely connect to your server graphical desktop using a VNC client or the default Windows Remote Desktop Connection client.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.