Install & configure VNC server on Oracle Cloud Infrastructure

0

Access your Oracle Cloud compute instance using a VNC desktop client.

VNC – Virtual Network Computing for remote desktop sharing.

Connect to your compute instance using SSH. (running on Oracle Linux )

  1. Install server desktop UI (as root)
# yum groupinstall "server with gui" 

or
 # yum groupinstall "GNOME Desktop" 

2. install Tigervnc package

# yum install tigervnc-server

3. Create service configuration file.

# cp /lib/systemd/system/vncserver@.service \
/etc/systemd/system/vncserver@\:display.service

4. Where display is the unique display number of the VNC desktop starting from 1. Use a backslash character (\) to escape the colon (:) character ie.

/etc/systemd/system/vncserver@\:1.service

5. Edit the configuration file in /etc/ folder

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

Replace the <USER> with the instance user ie. my user account is opc

ExecStart=/sbin/runuser -l opc -c "/usr/bin/vncserver %i"
PIDFile=/home/opc/.vnc/%H%i.pid

6. Start the VNC desktop

# systemctl daemon-reload
# systemctl start vncserver@:1.service
# systemctl enable vncserver@:1.service  

7. Expose the ports used in VNC

The default port for VNC is 5900. Thus if you display number 1, then your port is 5901. So;

# firewall-cmd --zone=public --add-port=5901/tcp --permanent
 # firewall-cmd --reload 

8 . Exit the root user and Set vnc password on the user level

# su - <vncuser>
$ vncpasswd
Password: <password>
Verify: <password>

“Would you like to enter a view only password? “-> n

9. Start the vnc server

$vncserver

Alternatively access the VNC server through this;

ssh -i <your private key> -L 5901:localhost:5901 opc@<compute public IP>

10. Enter the url to your vnc viewer to connect ie. “<public ip>:5901”

Other cmds:

  • $vncserver -list (List all VNC sessions running)
  • $vncserver -kill :<display ID> (Stop a session)
  • $systemctl | grep vnc (check the vnc processes running)
  • $ps – ef | grep vnc (check vnc processes running)
  • $kill <processID> (Kill a process)

References:

0 0 vote
Article Rating

I am a Cloud Solutions Engineer working with a leading cloud solutions company. I have more than 5 years’ experience in the Tech ecosystem. I began my career as a software developer. I am a tech enthusiast, an autodidact whose interests includes Data Management, Cloud Native Development, Mobile and Bots Development, Integration, Low Code Development, AI, Analytics just to say the least.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments