Overview
This is a simple procedure to install a VNC server on OEL 8 servers.
References
- Oracle Linux: Install the VNC Remote Access Server
- Install and Configure VNC Server on Oracle Linux 8
Procedure
This is a version of the procedure described in " Oracle Linux: Install the VNC Remote Access Server " for my own use. Thia procedure has adjusted for the video tutorial in " Install and Configure VNC Server on Oracle Linux 8 ".
Install Packages on Server for Graphical Mode
Run the following command to ensure that the right packages have been installed for the GUI environment:
sudo dnf groupinstall "Server with GUI" -y
If the correct packages for a GUI environment have been installed already, the output should be similar to the following:
[sudo] password for douglas: Oracle Linux 8 BaseOS Latest (x86_64) 9.5 kB/s | 2.7 kB 00:00 Oracle Linux 8 Application Stream (x86_64) 20 kB/s | 2.9 kB 00:00 Latest Unbreakable Enterprise Kernel Release 6 17 kB/s | 2.5 kB 00:00 no group 'dns-server' from environment 'graphical-server-environment' No match for group package "hpijs" Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing Environment Groups: Server with GUI Installing Groups: base-x Container Management Core Fonts GNOME Guest Desktop Agents Hardware Monitoring Utilities Hardware Support Headless Management Internet Browser Multimedia Common NetworkManager submodules Printing Client Server product core Standard Transaction Summary ================================================================================ Complete!
Ensure Server is in Graphical Mode
Run the following command to ensure that the server boots into graphical mode:
sudo systemctl set-default graphical
The expected output is:
[sudo] password for douglas: Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
Reboot the Server
Run the following command to boot the server do that it is now in graphical mode:
sudo reboot
Install the VNC Packages
Run the following command to install the VNC server packages:
sudo dnf install -y tigervnc-server tigervnc-server-module
The output should be similar to the following:
[sudo] password for douglas: Oracle Linux 8 BaseOS Latest (x86_64) 16 kB/s | 2.7 kB 00:00 Oracle Linux 8 Application Stream (x86_64) 22 kB/s | 2.9 kB 00:00 Latest Unbreakable Enterprise Kernel Release 6 18 kB/s | 2.5 kB 00:00 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: tigervnc-server x86_64 1.9.0-12.el8_1 ol8_appstream 255 k tigervnc-server-module x86_64 1.9.0-12.el8_1 ol8_appstream 254 k Transaction Summary ================================================================================ Install 2 Packages Total download size: 509 k Installed size: 2.6 M Downloading Packages: (1/2): tigervnc-server-module-1.9.0-12.el8_1.x8 355 kB/s | 254 kB 00:00 (2/2): tigervnc-server-1.9.0-12.el8_1.x86_64.rp 343 kB/s | 255 kB 00:00 -------------------------------------------------------------------------------- Total 676 kB/s | 509 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : tigervnc-server-module-1.9.0-12.el8_1.x86_64 1/2 Installing : tigervnc-server-1.9.0-12.el8_1.x86_64 2/2 Running scriptlet: tigervnc-server-1.9.0-12.el8_1.x86_64 2/2 Verifying : tigervnc-server-1.9.0-12.el8_1.x86_64 1/2 Verifying : tigervnc-server-module-1.9.0-12.el8_1.x86_64 2/2 Installed: tigervnc-server-1.9.0-12.el8_1.x86_64 tigervnc-server-module-1.9.0-12.el8_1.x86_64 Complete!
Set the VNC Password for the Current User
Run the following command to set the VNC password for the user running the command:
vncpasswd
The output should be similar to the following:
Password: Verify: Would you like to enter a view-only password (y/n)? n A view-only password is not used
Create the VNC Server Configuration File
Run the following commands to create the VNC server configuration file, /etc/systemd/system/vncserver@.service :
sudo bash cat >/etc/systemd/system/vncserver@.service <<DONE [Unit] Description=Remote Desktop VNC Service After=syslog.target network.target [Service] Type=simple ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/usr/bin/vncserver_wrapper douglas %i -geometry 1280x1024 ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i >/dev/null 2>&1 || :' [Install] WantedBy=multi-user.target DONE
Set up the VNC service
Reload Systemd as follows:
sudo systemctl daemon-reload
Enable and start the VNC server by using X Server display 1:
sudo systemctl enable --now vncserver@:1.service
If the command works, the following output should be seen:
Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:1.service → /etc/systemd/system/vncserver@.service.
However if the command fails, the following output may be seen:
Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:1.service → /etc/systemd/system/vncserver@.service. Job for vncserver@:1.service failed because the control process exited with error code. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details.
In this case,
systemctl status vncserver@:1.service
showed:
● vncserver@:1.service - Remote Desktop VNC Service Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2020-04-08 06:40:29 EDT; 1min 15s ago Process: 6874 ExecStart=/usr/bin/vncserver -autokill :1 (code=exited, status=1/FAILURE) Process: 6869 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS) Apr 08 06:40:29 airds.yaocm.id.au systemd[1]: Starting Remote Desktop VNC Service... Apr 08 06:40:29 airds.yaocm.id.au vncserver[6874]: You will require a password to access your desktops. Apr 08 06:40:29 airds.yaocm.id.au vncserver[6874]: getpassword error: Inappropriate ioctl for device Apr 08 06:40:29 airds.yaocm.id.au vncserver[6874]: Password: Apr 08 06:40:29 airds.yaocm.id.au systemd[1]: vncserver@:1.service: Control process exited, code=exited status=1 Apr 08 06:40:29 airds.yaocm.id.au systemd[1]: vncserver@:1.service: Failed with result 'exit-code'. Apr 08 06:40:29 airds.yaocm.id.au systemd[1]: Failed to start Remote Desktop VNC Service.
This error was caused by the
vncpasswd
command not being run on that server.
The remedy was:
vncpasswd sudo systemctl start vncserver@:1.service
Configure Firewall Rules
NOTE : The video tutorial, " Install and Configure VNC Server on Oracle Linux 8 ", recommends against opening the firewall to VNC traffic because it is unencrypted, and to use SSH tunneling instead.
Enable the firewall port for the VNC service and reload the default firewall service as follows:
sudo firewall-cmd --zone=public --add-service=vnc-server --permanent sudo firewall-cmd --reload
Both of these commands should return:
success