VNC Server Viewer Config (Mac — Linux)

Rakesh Jain
2 min readJun 18, 2020

--

Install vnc server software on the Linux Box which we want to access from our Mac Client -

[root@CentOS7 ~]# yum install tigervnc-server -y
Installing : tigervnc-server-1.8.0–19.el7.x86_64 1/1
Verifying : tigervnc-server-1.8.0–19.el7.x86_64 1/1
Installed:
tigervnc-server.x86_64 0:1.8.0–19.el7
Complete!

Set vnc password which we will use while accessing this system from VNC Viewer -

[root@CentOS7 ~]# vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
[root@CentOS7 ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

Add following lines to service file — (user name can be changed to any as per your requirement, here I am using root)

[root@CentOS7 ~]# vim /etc/systemd/system/vncserver@\:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
ExecStart=/sbin/runuser -l root -c “/usr/bin/vncserver %i -geometry 1280x1024”
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
[Install]
WantedBy=multi-user.target

Reload the daemon , start vnc service, enable firewall ports -

[root@CentOS7 ~]# systemctl daemon-reload
[root@CentOS7 ~]# systemctl start vncserver@:1
[root@CentOS7 ~]# systemctl status vncserver@:1
[root@CentOS7 ~]# systemctl enable vncserver@:1
[root@CentOS7 ~]# ss -tulpn| grep vnc
tcp LISTEN 0 5 *:5901 *:* users:((“Xvnc”,pid=5403,fd=9))
tcp LISTEN 0 128 *:6001 *:* users:((“Xvnc”,pid=5403,fd=6))
tcp LISTEN 0 5 [::]:5901 [::]:* users:((“Xvnc”,pid=5403,fd=10))
tcp LISTEN 0 128 [::]:6001 [::]:* users:((“Xvnc”,pid=5403,fd=5))

On Mac Client -

Install vncviewer from here

https://www.realvnc.com/en/connect/download/viewer/

Open it and enter the server address with port number and enter the password to access the system -

And thats it!

Hope you like the tutorial. Please let me know your feedback in the response section.

Happy Learning!!

--

--

Rakesh Jain
Rakesh Jain

Written by Rakesh Jain

DevOps Professional | Technical writer

No responses yet