Home Exadata How to Install VNC on Exadata Linux servers

How to Install VNC on Exadata Linux servers

Oracle Exadata servers do not come with VNC server installed. Let’s look at how to install VNC on Exadata Linux servers. In this post, I will list the steps needed to get VNC working on Oracle Enterprise Linux 7 (OEL 7). There are many posts you can google to get the steps for OEL 6. Since the setup is different on OEL 7, I’m posting them here.

YUM

We will use YUM to install the required packages. Before we get started, we need to ensure few things are in place else the install will fail.

yum.conf

Ensure repo_gpgcheck is set to 0 in yum config file. Here’s how my file looks.

Note: repo_gpgcheck either 1 or 0 tells yum whether or not it should perform a GPG signature check on the repodata. Disabling repo_gpgcheck should only be done against repositories that you trust.

[root@exa1db01 ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
# Never update kernel and kernel-uek
installonlypkgs=kernel kernel-smp kernel-bigmem kernel-enterprise kernel-debug kernel-unsupported kernel-uek
exclude=up2date
localpkg_gpgcheck=1
repo_gpgcheck=0

yum.repo

Ensure you have a repo file pointing to public-yum.oracle.com. Also, ensure enabled is set to 1.

[root@exa1db01 ~]# cat /etc/yum.repos.d/public-yum-ol7.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7
gpgcheck=1
enabled=1

Install Packages using YUM

We will need the following packages and their dependencies.

  • tigervnc-server
  • xterm

Note, All x11 related packages will be installed when installing xterm. They are part of the dependencies. However, one important package xorg-x11-twm is no longer available with OEL 7 repo. This is the window manager package and without this package the GUI will not work properly. We will do a workaround to install this.

As root user, install the following. Accept y at the prompt and yum will install the package along with any dependencies needed.

yum install tigervnc-server
yum install xterm

Workaround to install xorg-x11-twm

The xorg-x11-twm package is not available with OEL 7 repository. As a workaround, we will temporarily disable OEL 7 repo and use OEL 6 repo. Set enabled to 0 in file /etc/yum.repos.d/public-yum-ol7.repo. Add or edit an existing file for public-yum-ol6.repo and set it to enabled as below.

[root@exa1db01 ~]# cat /etc/yum.repos.d/public-yum-ol6.repo
[ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
# disabled by redhat-upgrade-tool

Now, install xorg-x11-twm package using YUM.

yum list xorg-x11-twm
yum install xorg-x11-twm

After installing the above package, revert the repo change done above. Disable OL6 repo and enable OL7 repo.

Configure VNC server as service

Starting OEL 7 or RHEL 7, VNC is run as a service using systemd. Simply copy the available vncserver@.service file from /usr/lib/systemd/system directory to /etc/systemd/system directory.

cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service

Update the User, Group and PIDFile values to include oracle user. Here’s how my file looks.

[root@exa1db01 ~]# cat /etc/systemd/system/vncserver@.service
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace oracle with the actual user name and edit vncserver
#    parameters appropriately
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.


[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
WorkingDirectory=/home/oracle
User=oracle
Group=oinstall

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i
PIDFile=/home/oracle/.vnc/%H%i.pid
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

Geometry – xterm

As oracle user, edit the Xclients file to set the geometry for the default window size. Edit it to your preference. I have it set to below.

[oracle@exa1db01 ~]# vi /etc/X11/xinit/Xclients
...
...
    if [ -x /usr/bin/xterm ] ; then
        /usr/bin/xterm -geometry 100x30+10+10 &
    fi
...

Set VNC Password

As oracle user, set the VNC password.

exa1db01 |  | /home/oracle
> vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used

Start VNC server as a service

Simply run below commands to start and verify vncserver service is up. Note the port number 1 in the enable command. This is your vnc port.

[root@exa1db01 ~]# systemctl daemon-reload
[root@exa1db01 ~]# systemctl enable vncserver@:1.service
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:1.service to /etc/systemd/system/vncserver@.service.

[root@exa1db01 ~]# systemctl enable vncserver@:1.service
[root@exa1db01 ~]# systemctl start vncserver@:1.service
[root@exa1db01 ~]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-04-04 05:23:12 GMT; 2s ago
  Process: 292297 ExecStart=/usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
  Process: 292291 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
 Main PID: 292305 (Xvnc)
   CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
           ├─292305 /usr/bin/Xvnc :1 -auth /home/oracle/.Xauthority -desktop exa1db01.localdomain.com:1 (oracle) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/oracl...
           ├─292808 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
           ├─292813 /usr/bin/xterm -geometry 80x50-50+150
           └─292815 bash

Apr 04 05:23:09 exa1db01.localdomain.com systemd[1]: Starting Remote desktop service (VNC)...
Apr 04 05:23:09 exa1db01.localdomain.com vncserver[292297]: xauth:  file /home/oracle/.Xauthority does not exist
Apr 04 05:23:12 exa1db01.localdomain.com vncserver[292297]: New 'exa1db01.localdomain.com:1 (oracle)' desktop is exa1db01.localdomain.com:1
Apr 04 05:23:12 exa1db01.localdomain.com vncserver[292297]: Creating default startup script /home/oracle/.vnc/xstartup
Apr 04 05:23:12 exa1db01.localdomain.com vncserver[292297]: Creating default config /home/oracle/.vnc/config
Apr 04 05:23:12 exa1db01.localdomain.com vncserver[292297]: Starting applications specified in /home/oracle/.vnc/xstartup
Apr 04 05:23:12 exa1db01.localdomain.com vncserver[292297]: Log file is /home/oracle/.vnc/exa1db01.localdomain.com:1.log
Apr 04 05:23:12 exa1db01.localdomain.com systemd[1]: Started Remote desktop service (VNC).

Start a new VNC session from a VNC client. Use the port number from your enable command above. You should get your vnc session if you followed the steps above.

An example vnc session

How to start a new VNC session?

We used the vncserver command to start a vnc session until RHEL/OEL 6. Since VNC runs as a systemd service on RHEL/OEL 7, we use the below commands to start a new vnc session. Simply substitute the port number in the below command to enable and start a new VNC session. These commands require root user privileges on Linux.

systemctl enable vncserver@:2.service
systemctl start vncserver@:2.service

I hope it helps! If you have any questions or suggestions, leave a comment.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest posts

Steps to remove OEM Agent

Recently I migrated all targets (Cluster, Databases, Instances, ASM, etc) and their jobs to a 13c OEM...

DBCA fails with ORA-27125 on 19c

Issue I recently encountered an issue where DBCA failed with ORA-27125 when creating a...

How to rename a PDB in 19c

Let's look at how to rename a PDB in 19c. The steps are the same as 12c....

How to change the ethernet switch password on Exadata

Let's look at how to log in and change the ethernet switch (adm) password on an Exadata...

You might also likeRELATED
Recommended to you