By default, CentOS 7 installed as the minimal server, and user intervention is required to change the installation type. VNC (Virtual Network Computing) Server allows the remote Desktop sharing using VNC viewer. In CentOS 7 & RHEL 7 package named “tigervnc-server” needs to be installed in order to set up the VNC server.
These are the steps to Install and Configure GNOME with VNC server on CentOS 7 / RHEL 7.
Configure the YUM repository on CentOS 7 / RHEL 7.
Run the following command to list available yum repository to install GNOME.
# yum group list
Make sure “GNOME Desktop” is available on this list.
Install Gnome GUI packages using the YUM command.
CentOS 7:
# yum groupinstall "GNOME Desktop"
RHEL 7:
# yum groupinstall "Server with GUI"
Install TigerVNC Packages
# yum install tigervnc-server xorg-x11-fonts-Type1
Create VNC user account
# adduser vncuser # passwd vncuser
Always use a strong password for the user account.
Setup VNC Server Configuration File
Copy the VNC config file “/lib/systemd/system/vncserver@.service” to the “/etc/systemd/system/vncserver@:<Port_Number>.service“.
Here we are using 3 which will VNC listen on “5903“. So while Connecting to the VNC server you can specify port number as <IP_Address_VNC_Server:3> or <IP_Address_VNC_Server:5903>
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:3.serv
Once you copy, modify the VNC server configuration file and update user account.
# vi /etc/systemd/system/vncserver@:3.serv
Replace the “<USER>” user with a user account. In my case “vncuser” user will able to control and manage its desktop session using remote VNC clients.
Set the VNC password for the User Account.
Switch to the user “vncuser” and run vncserver command to set the password as shown below
# su - vncuser [vncuser@centos7 ~] # vncserver You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n A view-only password is not used xauth: file /home/vncuser/.Xauthority does not exist New 'centos7-test1:1 (vncuser)' desktop is centos7-test1:1 Creating default startup script /home/vncuser/.vnc/xstartup Creating default config /home/vncuser/.vnc/config Starting applications specified in /home/vncuser/.vnc/xstartup Log file is /home/vncuser/.vnc/centos7-test1:1.log
Start and Enable the VNC Service
# systemctl daemon-reload # systemctl start vncserver@:3.service
# systemctl enable vncserver@:3.service Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:3.service to /etc/systemd/system/vncserver@:3.service.
Enable Firewall Rule
# firewall-cmd --permanent --zone=public --add-port=5903/tcp # firewall-cmd --reload
Connect Remote Desktop Session
Here we have installed VNCviewer and connected.
<ipaddress>:5903