Adding a Graphical Desktop to RedHat Enterprise Linux [RHEL]

So, by mistake, I installed some of the servers at work without a graphical desktop. Now, the easy thing would have been to re-install from the DVD (and this is generally what I did), but for one of them, I’d see if I could actually install and configure the necessary parts to get a graphical login without a full re-install.

Packages

Coming from Debian, I’m familiar with the concept of “meta packages” and “tasks”. Meta packages are packages which don’t actually provide anything useful in and of themselves, but depend on a series of packages which do. For example, you might have an “xfce-desktop” package which depends on the XFCE window manager, the panel, maybe the filemanager, too; the bare minimum.

“Tasks”, on the other hand are primarily focused on being selected from the installer. So “task-desktop” would depend on gnome plus a whole bevy of useful desktop tools (web browser, cd burner, movie player), “task-mail-server” would probably depend on an SMTP server, but perhaps also an IMAP server and an anti-spam solution, too.

Now, being aware of these, I wanted to see if there was a similar analogue in the RedHat world. It turns out that tasks are called groups in RedHat and can be found by invoking yum grouplist at a prompt. Here you get things like “Graphical Desktop”, “Web Server”, “English (UK) Support” etc. To install them, the best method seems to be to use the quotes (because the space is part of the group name. So:

yum groupinstall "Desktop Platform" "Desktop" "General Purpose Desktop" "X Window System"

Now, if you’re not connected to the internet (as I wasn’t), then that won’t work because you’ve got nowhere to install from. If you’ve still got your original install CD handy, then you’re in luck, though. You need to mount the disc (making it available to the Operating System) and then configure yum to look on the disc.

mount /dev/dvd /mnt
echo "[DVD]"                >  /etc/yum.repos.d/DVD.repo
echo "baseurl=file:///mnt/" >> /etc/yum.repos.d/DVD.repo
echo "enabled=1"            >> /etc/yum.repos.d/DVD.repo
rpm --import /mnt/RPM-GPG-KEY*

Now, the next time you call “yum” it should scan the DVD and be able to install packages from there. Expect a couple of hundred packages, which should only take a few minutes.

Configuration

So, now that you’ve installed your packages, you might try rebooting your machine and find you’re still at a text login. It appears to me that just installing the packages doesn’t actually configure them for use (entirely; you can do startx and get a desktop, but that start-at-boot magic’s not there).

On Debian, there are two places that the login manager (gdm) would be configured. Firstly, you’d check that /etc/init.d/gdm exists and has a symlink in /etc/rc2.d/ (installing the package should do this) and then you’d check /etc/X11/default-display-manager to ensure that gdm is the default (you can install multiple display managers, but only one of them can be in use at a time.

On RedHat, this stumped me for a while because /etc/init.d/gdm hadn’t been installed. The lightbulb moment came when I found that RedHat uses Upstart (instead of the traditional SysV or the new-kid-on-the-block SystemD) to manage services. OK, so I needed to read up on how Upstart does things. This is where open-source is wonderful; I found that /etc/init/prefdm.conf (“preferred display manager”) was responsible for starting the display manager. Opening that in a text editor showed that it called out to /etc/X11/prefdm. That, in turn, read the file /etc/sysconfig/desktop to see which display manager to start. This last file didn’t exist. It seems that this is one of the key tasks that the installer does if you select a graphical desktop, which just installing the group doesn’t do.

So, to fix this we can do:

echo PREFERRED=gnome >> /etc/sysconfig/desktop

To bring up the graphical desktop now, either do telinit 5 to restart the runlevel without rebooting, or just reboot the machine.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *