Install GUI desktop environtment CENTOS paling ringan di VPS

Friday, March 24, 2017

Install GUI desktop environtment CENTOS paling ringan di VPS

  • Remote GUI administration makes work easy & convenient.
  • Clipboard sharing between host CentOS server & VNC-client machine.
  • GUI tools can be installed on the host CentOS server to make the administration more powerful
  • Host CentOS server can be administered through any OS having the VNC-client installed.
  • More reliable over ssh graphics.
  • More reliable over RDP connections.


I am logged in my system with root, & now I will be installing the VNC-server.
# yum groupinstall "GNOME Desktop"
Further install 

# yum install tigervnc-server

Adding VNC user

In my case I am using user=srijan it will differ in your case. You can use any username for the same.

# sudo useradd -c "User Deje Configured for VNC Access" dejevnc
In CentOS 7.0 there is change in the vncserver configuration file. Before ContOS 7.0 it was  /etc/sysconfig/vncservers and now it have changed in /lib/systemd/system/vncserver@.service. Next I will use the original file and create the configuration file as shown:

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Now we will edit the file as follows:

# vi /etc/systemd/system/vncserver@:1.service

Replace the string <USER> with appropriate vncuser’s username.  In my case I will be using the user srijan just created above:
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#ExecStart=/sbin/runuser -l  -c "/usr/bin/vncserver %i"
ExecStart=/sbin/runuser -l dejevnc -c "/usr/bin/vncserver %i -geometry 1280x1024"
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
If you wish to add more users you would create a new vncserver@:#.service file and change the <USER> string to the new users.
Firewall settings:
* yum install firewalld
* systemctl start firewalld
* systemctl status firewalld -l
firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload

Now switch to the vncuser just created above and start the vnc service as:
su - dejevnc
[dejevnc@server1 ~]$ vncserver

You will require a password to access your desktops.

xauth:  file /home/dejevnc/.Xauthority does not exist

New ' (dejevnc)' desktop is

Creating default startup script /home/dejevnc/.vnc/xstartup
Starting applications specified in /home/dejevnc/.vnc/xstartup
Log file is /home/dejevnc/.vnc/

[dejevnc@server1 ~]$

Now make the service enabled on after every reboot with root credentials:
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service