To access any remote desktop servers we can use VNC. By installing and configuring VNC we can access graphical interface of any VPS servers are cloud servers. In this setup, we are going to use tiger VNC to configure the VNC server in Red Hat Enterprise server.
This guide focus on Red Hat 6 version and their variants Operating Systems. If you are looking to setup VNC server on RHEL 7/8 kindly find below.
Port Required for VNC Viewer
5900 , 5901 , 5902
Enable the required ports, we are working with only one user, However we are defining firewall rules for three users
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT
Save the firewall rules.
# sudo iptables-save > /etc/sysconfig/iptables # sudo service iptables save
Install VNC Server
To install the tigerVNC we need to have a valid yum repository, To perform a installation run
# yum install tigervnc* -y
After installing the package start to configure the VNC.
Configure Tiger VNC
To make our required changed use anyone of editor to edit the VNC config.
# vim /etc/sysconfig/vncserver
Remove the # in last two lines of the configuration file, Or make a copy of those two lines and make your required changes.
The Current setting will be as below after making the changes.
#VNCSERVERARGS="-geometry 800x600 -nolisten tcp -localhost"
Save and quit the file using wq!, Switch to the user sysadmin using
Create a VNC password
Creating Password for User
Switch back to the specific user account by running su – sysadmin Then create a vnc password for the user. Make-sure to confirm the password by entering two times.
Newpass : **********
verifypasswd : **********
Restarting/Commit the changes
Restart the VNC service to make the configuration changes effective.
# /etc/init.d/vncserver restart
Enable the service Persistently
Set the VNC server to start while the system boots up.
# chkconfig vncserver on
Then Connect to the user sysadmin using vncviewer command
# vncviewer -via firstname.lastname@example.org localhost:2
That’s it we can view the user sysadmin’s desktop using VNC.
To access anyone of Linux users Desktop environment we can use vnc viewer by installing tiger VNC. Subscribe to our newsletter and stay tuned for upcoming articles.