Check all articles
Configuration of VNC Server in CentOS 7
Sometimes we need to monitor a server in graphic interface or just remotely access to the visual functions of the server, for this we are going to configure VNC Server in CentOS.
If you need a server with CentOS 7 to do your own lab and test ... check the article Installation of CentOS 7.
Note: When we are working in the production environment we must always consider having our operating system updated, except for some administrative policy that prevents us from doing that.
Install the software
Install the package for the VNC server with root user.
#yum -y install tigervnc-server
User creation for VNC
After completing the installation of the package, add the user for VNC protocol authentication. The users that we are going to create will have an identification by ordinal number when we configure it starting with 1 ... then 2 ... then 3 ... and so on in the configuration.
The OS user juanleon already exists on my server. So, for creating the VNC user ... copy the file.
#cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Edit the file, replace the 2 entries of <USER> by juanleon (in my case).
Set user's password
Authenticate with the user of the operating system, in my case juanleon and generate a password for VNC with the command:
After type the password and verify, the system asks you if the password is view-only, answer with the letter n
Configure boot at startup
Configure the vncserver service with root user:
#systemctl enable vncserver@:1
Start VNC service
To init the service:
#systemctl start vncserver@:1
Add rules in the firewall
The VNC protocol listens on port 5900, in our user creation we had an order for each user ... in my case it would be 1: juanleon... then the port that corresponds to me is 5901. We add the rule to enable the port in the firewall.
#firewall-cmd --add-port=5901/tcp –-permanent
Now we can connect with a VNC client. If we want to connect from another CentOS server we use the utility "/Aplications/Utilities/Remote Desktop". Remember the port is 5901. For any other operating system you can use the software Real VNC Connect.