Tweaking CentOS 7

I’ve been a happy CentOS user ever since version 6.3. CentOS and Debian are two linux flavours that I have been playing around with since past few weeks and found both to be amazingly stable and smooth.

Ever since CentOS 7 came out, I was itching to try it. I’m a regular reader of dedoimedo’s linux musings. That guy has been writing awesome articles after articles on Linux apart from other topics. His article on CentOS 6 made me try it out so I was waiting for his take on CentOS 7. His first article seemed that he had tried it a bit too early so I thought it’s better to wait and watch. His second article – CentOS 7 – The perfect desktop guide is what got me going.

There are quite a few useful repos mentioned in the guide. The real cherry on the cake though, is nux’s CentOS 7 Repo. It’s got a lot of useful stuff. Really useful stuff that matters.

He is the creator of Stella Linux which is simply the most amazing Linux Distro. It’s a remix of CentOS (That’s how nux prefers to call it). It’s awesome.

Ok. Let’s start tweaking CentOS 7. One note before we start. I had selected the “Development and Creative Workstation” option from the Software Selection Section so that it would automatically install a lot of packages during installation itself. You might need to install other packages if you have selected any other option.

First off, as given in the guide above, run the update command:

Note – You’ll have to run all the commands as root.

yum update

Reboot and check if all looks fine.

Install the epel, elrepo and the nux repository. I had the epel repo pre installed so shown below are steps to install the elrepo and nux repositories only.

 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
 rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
 rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

Run the yum update command once again.

Note – Please check for the latest packages before you run the commands. As pointed out by Ruud de Bruin, the Nux Repo link is updated. Thanks Ruud.

The very next thing I did was installed the latest kernel-ml from Nux’s repo. That’s because with the stock kernel I was having issues toggling screen brightness and after some googling around I had found that 3.16.2 fixes that and few other issues (while on Stella Linux 6.5). So off I went installing it.

 yum --enablerepo=elrepo-kernel install kernel-ml

That gave me kernel version 3.16.2. So I rebooted once again, selected the kernel version 3.16.2 and all fine and dandy after that. Brightness toggle works perfectly. System boots a little faster as well.

The fonts appeared fuzzy. Well, a good .fonts.conf file should solve that. I had one lying around since my last tryst with Debian. This is an exact copy of what I found on the Debian Forum. It had worked well on Stella Linux 6.5 (Which is a remix of CentOS 6.5). Here’s the content of that file.

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
     <match target="font">
      <edit mode="assign" name="hinting" >
       <bool>true</bool>
      </edit>
     </match>
     <match target="font" >
      <edit mode="assign" name="autohint" >
       <bool>true</bool>
      </edit>
     </match>
     <match target="font">
      <edit mode="assign" name="hintstyle" >
      <const>hintslight</const>
      </edit>
     </match>
     <match target="font">
      <edit mode="assign" name="rgba" >
       <const>rgb</const>
      </edit>
     </match>
     <match target="font">
      <edit mode="assign" name="antialias" >
       <bool>true</bool>
      </edit>
     </match>
     <match target="font">
       <edit mode="assign" name="lcdfilter">
       <const>lcddefault</const>
       </edit>
     </match>
    </fontconfig>

I copied this to my home folder. Remember, the name of the file has to be .fonts.conf. Notice the “.” at the beginning. It has to be in your home folder. So say, your home folder is at /home/yourname, then you’ll need to ensure that you copy the file in that location.

[pmu@localhost ~]$ pwd
/home/pmu
[pmu@localhost ~]$ ls -a | grep ".fonts.conf"
.fonts.conf
[pmu@localhost ~]$

Logged out and logged back in. The application and browser fonts were much better now. But for best effects, we’ll install infinality. It really makes a huge difference. And this is where nux’s repo comes in. He has done all the hard work already. We just need to install the packages like so:

 yum --enablerepo=nux-dextop install fontconfig-infinality
 yum --enablerepo=nux-dextop install cairo
 yum --enablerepo=nux-dextop install libXft
 yum --enablerepo=nux-dextop install freetype-infinality

Rebooted once again. And man, I could tell the difference. The fonts were amazingly clear. Way better even than on Windows.

Here’s some screen shots:

Section of a page.

Section of a page.

google search page screenshot

libreoffice

Download Window Screenshot. Check out the beautiful fonts.

Download Window Screenshot. Check out the beautiful fonts.

Adobe's full page

Adobe’s full page

Tweak Tool Screenshot that shows my chosen Fonts Settings.

Tweak Tool Screenshot that shows my chosen Fonts Settings.

That's how my vim looks in CentOS 7

Vim with a few tweaks.

The second last screenshot here shows the changes I have done to some default fonts. CentOS 7 looks way snappier to me this way. Like I said earlier, The fonts were amazingly clear. Way better even than on Windows. No kidding.Windows…heck, I needed to install the packages so that I could mount my USB Disks that are NTFS partitioned.

 yum install ntfs*

Okie….Did that, and was able to access my windows partitions without any problems.

Now we’ll install sensors package so that I’d know how’s the laptop temperature doing:

 yum install lm_sensors

And configure it as a root by running the following command and selecting the answers to the interactive questions.

sensors-detect

Though I like the default adwaita theme, the icons could be really better. Once again the nux repos come to the rescue.

yum --enablerepo=nux-dextop install faience-icon-theme

Select the theme in the Tweak Tool as shown below:

select_icon_theme

Now the icons look much much better.

icons

myhome

I left out the touchpad settings. Here’s how we go about it.

Hit the “Windows” key, and you’ll get a screen like this.

type_here

Now type the word “touchpad” (without quotes)

touchpad

Click on that option and then change the setting the way you want.

This is how my settings look:

mouse_settings

I have enabled the “Two Finger Scroll” and most importantly the “Tap to click” option.

That’s it (for now). We are done. All thanks to dedoimedo and nux, I got a snappy looking CentOS 7 running right now. Infact I wrote this blog on CentOS 7.

As mentioned earlier, I was a happy camper with CentOS 6.5 (Stella Linux actually). Then CentOS 7 came around and curiosity got better of me. I was able to install and tweak it to my liking as given in my Tweaking CentOS 7 post, yet one thing bothered me ~ It didn’t offer the dual boot option that CentOS 6.5 had.

Or so I thought.

A little googling, and I was able to dual boot CentOS 7 and Windows 7 !!

Here’s the points to note before you try this.

1) I am NOT using UEFI. My laptop (A Thinkpad T430) boots using the good old way of booting..the (now legacy) BIOS.

2) I had Windows 7 pre installed before installing CentOS 7. If you install CentOS 7 (Or any other Linux, or any other UNIX like OS for that matter) and then install Windows 7, then Windows 7 will overwrite the earlier entries. So you have to install Windows first.

3) I had freed up some space from the Windows Partition and installed CentOS 7 on that partition. There are a lot of guides on the net that would show you how to go about this. Follow them carefully. As always, back up your data, create a system image first and then proceed.

Now, before you run the commands given below, please go through the points given above.

Done? Good. Now let’s proceed.

I still don’t have a very clear understanding of Grub2, but what has given below has worked. So here we go.

Login as a root by typing su – (note the space between su and the space)

su -

Type in the password. Now you should be at the root prompt.

Now copy the grub.cfg file to another location as shown below ( in my case, I copied it to the root’s home. You can copy it to any place you want.)

cp /boot/grub2/grub.cfg orig.grub.cfg

Now we run the all important command.

grub2-mkconfig -o /boot/grub2/grub.cfg

That’s it. Really. Here’s the output in my case.

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.16.2-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-3.16.2-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.6.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.6.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-327fe33f3b364802871211321a2790b7
Found initrd image: /boot/initramfs-0-rescue-327fe33f3b364802871211321a2790b7.img
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
done
[root@localhost ~]#

I’ve highligted the Windows lines in a different color just so that they are clearly visible.

The red and bold highlight of the root prompt is due to a setting that I have in my .bashrc of root. We’ll talk about that just in a minute because we need to see if our fiddling has been successful or not. So go ahead and reboot. This time, the Grub Menu will show the entries for Windows. Boot into Windows and see if everything works fine (It should, but then, why not login and check).

Now back to the red root prompt.

Here’s the line that you’ll have to stick at the very end of your .bashrc file in root. Please do be careful.

export PS1="\[$(tput setaf 1)\]\[$(tput bold)\][\u@\h \W]\\$ \[$(tput sgr0)\]"

So after you are done, this is how your .bashrc will look

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi
export PS1="\[$(tput setaf 1)\]\[$(tput bold)\][\u@\h \W]\\$ \[$(tput sgr0)\]"

Note – I have highlighted the line so that it’s clearly visible.

Log out and re login as root. You should see a nice bold and red prompt now. 🙂

Here’s where I got it from. Thanks to Noah Petherbridge, I now have a nice root prompt – https://www.kirsle.net/wizards/ps1.html

Credits