Initial Setup of a Linux CentOS5 / RHEL5 System

From CVL Wiki

Revision as of 16:15, 18 March 2009 by Jkh (Talk | contribs)

Jump to: navigation, search

Running Linux straight out of the box is a bit of a raw experience. I make a number of tweaks after the initial install. I'm going to document those tweaks here.


Never login as root!

During the install, there will be a place to create an account. Create an account there. Login with the account you created during the install.

Get sudo working for your account.

Once you are logged in, start a "Terminal". Type su, type the root password. This will be the first and last time you type "su". Now, edit /etc/sudoers. Find the line

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

and add you account:

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
jkh     ALL=(ALL) NOPASSWD:     ALL

I add the "NOPASSWD:" option, this allows you to run sudo with out typing your password. Many people would argue that this is a security problem. Just make sure that your password is strong.

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
jkh     ALL=(ALL) NOPASSWD:     ALL

Since the /etc/sudoers is not "write-able" by anyone, to save the file you must use ":w!" followed by ":q". Now exit "su" with "Ctrl-D".

Get things up-to-date

Apply all updates since the CD/DVD was burned.

sudo yum -y update

Add yum repositories

There are three yum repositories I add: epel (Extra Packages for Enterprise Linux), Dag Wieers' excellent rpmforge, and for Adobe's flash and pdf. Its a bit tricky to do this properly, the yum repos will step on each-others' feet. Largely I follow this.

  1. First install yum-priorities as suggested.
    sudo yum install yum-priorities
    • Edit /etc/yum/pluginconf.d/priorities.conf and verify that it is on.
    • Edit /etc/yum.repos.d/CentOS-Base.repo, add priority=1 for each section.
  2. Install epel. See this. Note that their instructions are not the best...
    • There should be a more automatic, cut-n-paste of this. But, something like:
      sudo rpm -Uvh
      Where x86_64 is your machine architecture. This may be x86_64 for 64 bit installs, or i386 for 32 bit installs. And the 5-2 release number may not be correct as the releases march along with time.
    • Edit /etc/yum.repos.d/epel.repo, add priority=3 to each section
  3. Install rpmforge. See this.
    sudo rpm -Uhv
    Again a more automatic way of doing this would be nice. Change the architecture (x86_64/i386) to match your system. And again, some version number will march along with time.
    • Edit /etc/yum.repos.d/rpmforge.repo, add priority=4 to each section.
  4. Install Adobe's repo. See this, pick "YUM for Linux".
    • Something like
      sudo rpm -Uvh
      Note: this is a 32 bit version only (i386). Eventually we will get 64 bit everything for the browser, but for now we are going to do a 32 browser on a 64 bit system. See below (How to make everything work in firefox).
    • Edit /etc/yum.repos.d/adobe-linux-i386.repo, add priority=5 to the one section.
  5. And one last update all to be sure.
    sudo yum -y update

Add bash-completion

Bash-completion make the "tab-completion" intelligent. Before installing bash-completion, the tab key will only complete file names, after it will complete intelligently lots of commands.
sudo yum -y install bash-completion
After install, try it out. Type:
yum <TAB><TAB>
You will see a list of sub-commands for yum, not file names! Use the tab key everywhere, you will be supprised what it will complete!

Add system commands the the path (/sbin, /usr/sbin, etc.) for everyone

By default the directories which have commands the are mostly used only by sys-admin types are not in the path. But, just so you don't have type type /sbin/ifconfig to see what your network is, I add /sbin to everyone's path.

Edit /etc/profile and look for this

# Path manipulation
if [ "$EUID" = "0" ]; then
       pathmunge /sbin
       pathmunge /usr/sbin
       pathmunge /usr/local/sbin
Make it look like this:
# Path manipulation
 # if [ "$EUID" = "0" ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
 # fi

===Make the beeping stop!===
Every time vi / bash / etc. sends a beep it anoies me greatly.  Stopping the beep is very obscure.
Edit /etc/inputrc and make this
 #set bell-style none
look like this:
 set bell-style none
Personal tools