Yes, Red Hat Enterprise Linux has a minimal window manager called 'motif' !!!
Tags: linux, sysadmin, rhel, ubuntu
Published: 2020-06-04 09:09:16

I believe its the job of every Linux admin to keep the servers as lean as possible.

Installing a Desktop environment is a "BIG NO!" on your production Linux servers, due to many reasons. The biggest advantage is that you do not need to update 1000s of packages and get into unnecessary issues. Also less packages means minimal attack surface and less vulnerabilites.

How much you try there will be ONE enterprise application "admin" that needs a GUI and you must have to configure it. Without GUI the work will not go on. To make it challenging, X11 forwarding over ssh and VNC are not options here, plus the Linux distro is RHEL. As best practice, you do not install upstream packages in RHEL.

The following guide will help you to achieve a lean production server but with a just enough window manager to start the ONE enterprise application in GUI mode and do not need any additional packages that is not in the official repos of RHEL.

Your super hero is motif window manager (mwm), that comes default with RHEL.

Lets start.

Install motif along with the packages to start the Xorg server and Xterm. You are not installing the group X Window System, as it installs many additional packages. Remeber the key word is a lean system.

~~~
# yum install motif xterm xorg-x11-server-Xorg 
# yum install xorg-x11-xauth xorg-x11-fonts-* 
# yum install xorg-x11-utils xorg-x11-xinit xorg-x11-drivers
~~~

I split the yum commands just for the look for the article. You can execute them as one command with `-y` option.

Copy the default configuration file used by mwm to home directory of the user. Here my user is test.

~~~
# cp /etc/X11/mwm/system.mwmrc /home/test/.mwmrc
~~~

The following configuration will auto raise the windows. I found it useful when working with a super minimal desktop.

~~~
# cat << EOF > /home/test/.Xdefaults 
Mwm*keyboardFocusPolicy: pointer
Mwm*focusAutoRaise: true
EOF
~~~

The following is our initiation script.

`xsetroot` will help you customize the Xorg, and exec mwm will start the desktop.

One problem I faced was the default black background which was not optimal and did not clearly showed the boundaries of the desktop. I changed it to light blue using `xsetroot`.

~~~
cat << EOF > /home/test/.xinitrc 
xsetroot -solid lightblue
exec mwm
EOF
~~~

Change the ownership of the files to user test.

~~~
# chown test.test /home/test/{.Xdefaults,.xinitrc,.mwmrc}
~~~

Now login as user test and execute the command `xinit`

~~~
$ xinit
~~~

If you follow all steps correctly you will see a following screen.
Note that you need to right click to see the start menu of motif.

![Motif Welcome Screen](https://dev-to-uploads.s3.amazonaws.com/i/pat9jdieea4xre23douu.png)

Click on New Window, to open `xterm`. Now start your program. Here I started firefox.

![motif window manager](https://dev-to-uploads.s3.amazonaws.com/i/2iifqcna9vngtblysmjd.png)

I hope this article will help you to create a minimal environment. With this setup I was able to bring down the installed packages from almost 1300 to 425 rpms.

Have you faced a similar challenge with GUI in your environment?

Ref:
https://motif.ics.com/motif
https://linux.die.net/man/1/mwm
https://linux.die.net/man/1/xsetroot