Miscellaneous Red Hat / CentOS stuff

redhat

Introduction

This page is nothing but a list for some stuff about Red Hat (or CentOS) configuration and other stuff i might forget…

 

 

 

 

1) Language / Locale settings

Please note that this page is a “quick commands guide“, you may want to check the “About the locale” page for a more comprehensive guide on locale settings under a Linux box.

  • Languages are set in /etc/sysconfig/i18n file (see this page for a list of available codes). This file set the language used by system only, to change a keyboard setting you may use the xorg.conffile.
    • e.g to change a system language from french to US english :
      sed -i.bak 's/fr_FR.UTF-8/en_US.UTF-8/' /etc/sysconfig/i18n
    • e.g to change a keyboard language to US english

      • for a command line session (must be done as root)
        loadkeys us
      • for an X session (using an X server)
        setxkbmap -layout us
      • or  a simpler
        setxkbmap us

       

     

2) Disable / remove the RHEL 6 Red Hat Network stuff : rhn etc

I had to figure out how to remove this service because it gave me proxy authentication issue. We do have a valid RHEL license but i did not have access to it at this time, so….

I did not try to be smart here, i just wanted to get rid of the whole stuff, here is how i didi this :

yum remove rhn-client-tools.noarch subscription-manager-gui.x86_64 yum-rhn-plugin

I also disabled trhe init script using :

chkconfig rhsmcertd off

 

 

3) Safely clean / remove old kernel version (+ kernel-devel)

This is a common task, and when i searched the web for the cleanest and safest solution i found just a bunch of them, from the worst (60 characters long command line using some “pipes”, grep sed and more!) to the best : this is the one i am showing here, please check this one out, or “how not to reinvent the wheel“…

package-cleanup --oldkernel

This will safely clean every kernel other than the current one, you may use the --count <COUNT> option to keep the desired number of older kernel on your system (the default value to <COUNT> is 2).

The other interesting option is --keepdevel, which allow you to …. keep the devel packages (e.g kernel-devel-X.yy.zz), you knew it i am sure.

See the example below in case you are sure about this quite dangerous command.

package-cleanup --oldkernel --count 4 --keepdevel

The above command would remove all old kernels but the 4 newest and would also keep ALL the kernel-devel packages.

Leave a Reply

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

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.