Configuring CentOS 7
I use CentOS 7 at work. Until recently that usage was limited to LXC containers. At work we decided to convert two decommissioned rack servers into NAS and backup servers. The owner wanted to use CentOS 7 and have a desktop environment installed.
For me that means stronger familiarity with CentOS 7 beyond container usage. I am no stranger to CentOS 7, having had the operating system installed on my laptop. Yet I never used CentOS as a daily tool.
For security reasons I want to create a system to isolate and separate my work and personal computer environments. The system should be encrypted.
For convenience I do not want to dual boot or use a second login account.
I want to create a virtual machine (VM) for this purpose.
The company owner wants a similar VM on Windows office machines to access servers through a Linux based system.
To address these challenges I started testing CentOS 7 in a VM.
The VM would provide me an idea about configuring the unused rack servers. The VM would provide me clues to what extent I want to use CentOS 7 at home. After configuring the VM to my liking I would export the VM as an appliance. Anybody at work could import and use the appliance.
This VM would be used in a limited manner — for the web browser interface and SSH access in a terminal. Add some network tools. A fairly light footprint VM.
Most importantly, the VM can be encrypted.
I created a VM with 1 GB of RAM and an 8 GB dynamic disk.
I remembered my previous experience with installing CentOS 7 in a VM. I wondered whether anything had changed.
My first observation is the VM screen size does not fit a 1280x800 laptop screen. I have to use the horizontal and vertical scroll bars. I see the same when using the basic graphics mode option. In addition to the VirtualBox Guest Addition drivers not being installed, that means extra work to use the installer. Did anybody test the installer on a laptop? Or is all development these days done only on 40 inch monitors? Or is there a presumption that CentOS is used only on servers and never on laptops?
I moved my testing to my office desktop where I have a larger monitor.
The MATE desktop is not supported in the CentOS 7 installer. I do not want to use GNOME 3. I decided to perform a minimal install and then manually install MATE packages.
The default CentOS 7 installation uses LVM and XFS. While those options probably are sane for the rack servers, which have hardware RAID controllers, I saw no need for either in a basic desktop VM where I would be doing little more than using a terminal and a web browser. I changed both options to a standard disk partition and ext4.
The install moved timely but then took a long time with post-installation setup tasks.
I suspected the VM was not resolving DNS lookups. I have seen this before with VMs. After the installation completed I powered down the VM. In a terminal I ran the following:
vboxmanage modifyvm "CentOS 7" --natdnshostresolver1 on
My first post-install step was to install Midnight Commander (mc). Running
yum install mc resulted in a slew of Perl modules being installed. I had never seen this before when installing mc. I then remembered I had performed a minimal install.
Next was to disable the boot splash. I have no idea why developers think users want a boot splash on a server oriented operating system. I removed the
rhgb boot option. I noted that the
quiet option was already being used. I changed the boot wait time to 2 seconds.
I do not care for the new network interface naming conventions. I added
net.ifnames=0 to the boot options. I copied
/etc/sysconfig/network-scripts/eth0 and edited the file.
I updated the
grub.cfg file. I remembered that the Red Hat folks follow NIH principles. The command in Red Hat systems is
grub2-mkconfig rather than
grub-mkconfig. The irony of this twisted thinking is the final config file is name
grub.cfg rather than
grub2.cfg and is stored in
/boot/grub2. Unlike other folks who provide an
update-grub script wrapper that automatically copies the output to the sane default location of
/boot/grub, with CentOS the user needs to type the full raw command:
grub2-mkconfig -o /boot/grub2/grub.cfg
Consistency. Never expect anything in Linux based systems to be consistent from one distro to another. Not even with base tools.
I rebooted to verify the changes.
ifconfig command. I installed the
Yes, there is a pattern here. I refuse to play the geek game. I prefer well established tools and Linux conventions. I am interested in useful computers, not sitting on a fence post crowing about using the latest geek tools. You know — tools that were invented to solve problems that don't exist. Some self-justifying wonk somewhere waved a hand and declared
ifconfig is deprecated? Nonsense.
As I did not yet have a desktop environment or login manager installed, the system booted to the console. My next step was not having the screen cleared with the login prompt. Clearing the screen probably is some kind of security precaution. In addition to a boot splash to hide boot events, we need to clear the screen too. You know, to protect me from myself. After all, we do not want users knowing what is happening.
This requires manually creating
Next I discovered
mlocate is not installed in a minimal install.
yum install mlocate updatedb
Next was to enable the EPEL repository. That would be necessary to install the MATE desktop.
yum install epel-release
This was a good time to update the system.
The yum command reported 95 MB of updates in 53 packages. During the updates I noticed NetworkManager being updated. I saw no need for the package with a static or wired IP address. Or other cruft.
Next was installing some utilities:
Next was ensuring selinux was disabled in
Next was to enable text based logging in
Next was removing the
Hint: Num Lock on message. I use Num Lock with my office desktop but not with the laptop. In both cases I do not want or need the message because the keyboard is a pass-through function with a VM. I copied
/email@example.com. I edited the copied file:
ExecStart=-/sbin/agetty --nohints --noclear %I $TERM
I rebooted to verify all changes.
Next was to install the MATE packages:
yum groupinstall "MATE Desktop"
This is always a fearful moment because of dependencies. I had performed a minimal install. I expected a slew of MATE dependency packages. I had not expected the dependencies would include packages such as NetworkManager, dnsmasq, ivtv-firemware, iwl*-firmware, and tuned, all of which I had removed.
Oh yeah, the yum groupinstall request wanted to install abrt, brasero, rhythmbox, totem, and transmission.
Out of curiosity I proceeded with the package installs.
Okay, my mistake was performing a group install rather than individual MATE packages. My bad. The word bloat still fits.
Back to removing packages.
yum remove abrt brasero rhythmbox totem transmission NetworkManager ModemManager btrfs-progs dnsmasq ivtv-firemware iwl*-firmware tuned ppp pptp
And many more.
There were a slew of packages that I could not delete, such as parted, device-mapper, fortune-mod, avahi, or xfsprogs.
I can’t remove parted? Or xfsprogs on an ext4 system?
I decided to repeat the entire installation. This time I would not use a group install. Instead I would install MATE packages individually.
The minimal install is truly minimal. Despite installing MATE packages, trying to start X with the
startx command resulted in a
no screens found error. The reason is no X packages are installed. Running
yum groupinstall "X Window System" is needed. For some reason none of the MATE packages pulled in any X packages. So much for dependencies.
Again X would not start from the console using the
startx command. I remember having this same problem when I previously had CentOS 7 installed on my laptop.
I installed lightdm and rebooted.
Rebooting did not start in X. I had to run
systemctl set-default graphical.target.
Installing the VirtualBox Guest Additions (GA) requires additional packages:
kernel-devel. This is one reason I prefer Slackware — packages are not split into multiple packages.
Installing the GA drivers took a long time.
After rebooting I found myself again in an 800x600 desktop. I had to manually adjust the virtual machine display.
As I was still experimenting, I decided a more efficient way to get a CentOS 7 desktop running might be to use the Live CD, which installs the GNOME desktop. I would thereafter install the MATE packages.
The Live CD would not run correctly in the VM, even when choosing basic graphics mode. The disk booted fine. After drumming my fingers waiting for a postfix start job to terminate all I saw was a black screen. The disk works fine in a physical machine.
Postfix on a Live CD? Really? Classic WTF.
In another attempt I brewed myself a cup of hot tea. When I returned there was a dialog to select a language. When I finally completed the ensuing dialogs I was taken to a Getting Started app of some kind. Interesting that a user needs help with using a basic desktop. Perhaps if a traditional desktop was used no such app would be needed?
The screen size exceeded the width and height of my laptop display. I found the desktop slow. I noticed some Evolution apps running.
One more time. With the larger full install DVD.
Forty-five minutes later the system was still installing and had not progressed further.
Installing CentOS 7 in VirtualBox seems to be an exercise in futility.
I decided my best route is to proceed with the minimal install disk and repeat the steps shared above. I rearranged the steps to improve efficiency.
Thereafter, with nominal effort I had a decent VM with the MATE desktop. I spent time tweaking the VM with the goal of this VM becoming an appliance for other employees.
Onward to repeating the steps with one of the rack servers.