I’ve made this mistake a few times now.
In my excitement to get a new copy of OEL installed, I manage to forget to select the version with the GUI. I reboot my VM, and am presented with a command-line login.
Of course I could just delete the VM and start over. Or I could follow the instructions available from several sites and blogs that explain a simple yum command to a public repo is all I need to add the missing graphical interface:
$ yum groupinstall "Server with GUI"
But more often than not, I am doing this in a company lab that is more locked down than Ft. Knox. Draconian network security mandates mean no public internet access, and it would be an act of Congress to get that changed.
I am not dismissive of the need for security, it is absolutely of upmost importance and too often is overlooked, but there is also a reason why most large IT companies can no longer innovate and must rely on M&A to acquire new ideas, and it isn’t a lack of creative engineers among their ranks.
So how do we install the missing GUI from the local install media?
First we need to mount the install media back to Linux. If we are using VMware, we need to use vCenter to edit the VM machine and mount the install media ISO file.
Once that is done, mount the ISO media image to the OS:
$ mkdir -p /media/iso $ mount /dev/sr0 /media/iso mount: /dev/sr0 is write-protected, mounting read-only
We should now be able to see the contents of the ISO file:
[root@localhost ~]# ls -al /media/iso total 1310 drwxr-xr-x. 9 root root 4096 Apr 12 2018 . drwxr-xr-x. 3 root root 17 Mar 30 13:42 .. drwxr-xr-x. 4 root root 2048 Apr 12 2018 addons -rw-r--r--. 1 root root 46 Apr 12 2018 .discinfo drwxr-xr-x. 3 root root 2048 Apr 12 2018 EFI -rw-r--r--. 1 root root 8643 Apr 12 2018 EULA -rw-r--r--. 1 root root 18390 Apr 12 2018 GPL drwxr-xr-x. 3 root root 2048 Apr 12 2018 images drwxr-xr-x. 2 root root 2048 Apr 12 2018 isolinux drwxr-xr-x. 2 root root 2048 Apr 12 2018 LiveOS drwxr-xr-x. 2 root root 831488 Apr 12 2018 Packages -rw-r--r--. 1 root root 105321 Apr 12 2018 RELEASE-NOTES-U5-en -rw-r--r--. 1 root root 349404 Apr 12 2018 RELEASE-NOTES-U5-en.html drwxr-xr-x. 2 root root 4096 Apr 12 2018 repodata -rw-r--r--. 1 root root 1011 Apr 12 2018 RPM-GPG-KEY -rw-r--r--. 1 root root 1011 Apr 12 2018 RPM-GPG-KEY-oracle -r--r--r--. 1 root root 3322 Apr 12 2018 TRANS.TBL -rw-r--r--. 1 root root 2202 Apr 12 2018 .treeinfo
Okay, but now we need yum to be able to use these files, and not try to access the public yum repository to which we don’t have access from inside the corporate fire walls.
First let’s disable the public yum repo file:
$ cd /etc/yum.repos.d $ mv public-yum-ol7.repo public-yum-ol7.repo.bak
Now we need to add a new repo file that points at the locally mounted ISO files:
[graham@localhost yum.repos.d]$ cat dvd.repo [dvd] name=Install DVD baseurl="file:///media/iso" gpgkey="file:///media/iso/RPM-GPG-KEY-oracle" gpgcheck=1 enabled=0
With that done, we can now add the missing GUI as follows:
$ yum groupinstall --enablerepo=dvd "Server with GUI"
$ systemctl set-default graphical.target Removed symlink /etc/systemd/system/default.target Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
Reboot the VM, and you should get a graphical login prompt.