<!> This article seems neglected, and must be characterized as is under construction --RussHerrold ; please address feedback to: GlennMatthys and ask him to update it

<!> A somewhat similar bootstrap technique for installing CentOS-6 is described in this forum post.

ManualInstall

Preparation

Booting the host OS

You can use any distribution that can use the rpm package manager. Even if the host distribution doesn't use rpm natively.

If you're using a CentOS installion CD, either CD or DVD 1, or a live CD, boot the CD with:

linux rescue 

or alternatively:

linux text 

to start in a "text mode" ("TUI") console. If you have already booted into the "graphical" ("GUI") install environment, once it progresses a bit, when the installation interview reaches the partitioning questions, you may type: ctrl-alt-F2 This will get a text console in which to work on partition details. Once you are satisfied with, and have saved the partitioning information in the TUI console, reboot the installation, and work forward from that partitioning by simply typing:

reboot 

in that TUI panel.

Additionally you may optionally choose to provide a vga= parameter in the initial boot time options, in order to have a larger framebuffer display window.

Disk setup

First, setup your disks to your liking. You can use whatever partitioning scheme you prefer here, RAID, LVM, etc... Remember your disk configuration because you'll need it to configure grub, menu.lst and fstab. Using RAID, LVM, or others will require more configuration than this guide covers. To keep the example simple, we use a single drive, and set up three partitions using fdisk.

An example:

# fdisk /dev/sda

/dev/sda1 and /dev/sda3 will be set to partition type: ext2; /dev/sda2 will be partition type: swap. Each will be formatted in turn to that tilesystem type:

# mkfs /dev/sda1
# mkfs /dev/sda3
# mkswap /dev/sda2

Optionally the two data containing partitions may be set to use the journalling of the ext3 extension to ext2, but this may be done later after the initial install with the tune2fs command.

Next, a location is set up in the existing filesystem, to build the new installation in, and the partitions hung at the relative slash and ./boot positions:

# mkdir /target
# mount /dev/sda3 /target
# mkdir /target/boot
# mount /dev/sda1 /target/boot

Setting up RPM

Depending on the host OS you're using, you may need to initialize the rpm db on the host OS

# rpm --initdb

??? QUERY: What is being said here? I do not understand why the host OS needs an RPM db. RussHerrold

Now mount the package source. Example shows for the CentOS installer CD, where the CD is in a drive appearing at /dev/hdc.

# mkdir /source
# mount /dev/hdc /source

Use the following command to install the packages:

# rpm --root /target -i (fully qualified path to one or more packages)

TIP: You can temporarily put this in your shell: # alias INSTALL='rpm --root /target -i '

Installing the base system

Use your shell's tab completion to complete the package filenames. The package versions were deliberately left out so these instructions apply to a wide range of versions.

Let's install some basics (remember, this examples assumed you have aliased: INSTALL = rpm --root /target -i)

# INSTALL setup basesystem filesystem

Install bash first, this is needed for post-install scripts

# INSTALL bash glibc glibc-common termcap libgcc tzdata mktemp libtermcap

Install some dependencies (this is mainly to keep the next command smaller)

# INSTALL grep pcre libstdc++ info ncurses zlib gawk sed ethtool

Install the bulk of the system

# INSTALL coreutils libselinux libacl libattr pam audit-libs cracklib-dicts cracklib libsepol mcstrans libcap chkconfig python db4 openssl readline bzip2-libs gdbm findutils krb5-libs initscripts util-linux popt udev MAKEDEV centos-release shadow-utils keyutils-libs iproute sysfsutils SysVinit net-tools module-init-tools e2fsprogs e2fsprogs-libs glib2 mingetty device-mapper sysklogd psmisc centos-release-notes procps libsysfs iputils

Install package manager

# INSTALL rpm beecrypt elfutils-libelf rpm-libs sqlite

Install YUM

# INSTALL yum python-elementtree rpm-python yum-metadata-parser python-sqlite expat libxml2 python-urlgrabber m2crypto python-iniparse

You may also want to install a favorite editor

# INSTALL nano

This provides the install root with some defaults, like color highlighting on ls

# INSTALL rootfiles

Configuring the new system

At this point, you have system which you can chroot in to, so we can start setting up the basics

Mount directories for chroot operation:

# mount --bind /dev /target/dev
# mount -t proc none /target/proc
# mount -t sysfs none /target/sys
# chroot /target

This constructs /etc/shadow

# pwconv

Configure a fstab

# nano -w /etc/fstab

Installing a kernel. As the source packages were not mounted inside the /target tree, it will be necessary to do this outside the chroot in the host OS system. With different choices in where the CD was mounted, this may not be necessary.

# exit
# INSTALL kernel mkinitrd cpio device-mapper-multipath dmraid gzip kpartx lvm2 nash tar less device-mapper-event

Install the bootloader, grub.

# INSTALL grub diffutils redhat-logos

Re-enter the chroot again to configure a bootloader for the new installation

# chroot /target

We start by configuring the bootloader. Open /boot/grub/menu.lst, and put the following there:

timeout 5
default 0

# (0) CentOS
title CentOS
root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 root=/dev/sda3 ro
initrd /initrd-2.6.18-92.el5.img

??? QUERY: the use of menu.lst is not a CentOS approach, as grub.conf is used instead of the Debian approach. This needs to be conformed to CentOS practice. RussHerrold

Replace the kernel versions noted in the example above with the one you've actually installed.

If this command gives an error, you can safely ignore this because it's not of importance.

??? QUERY: errors have meaning, and a catch-all as in the prior sentence, is clearly wrong. Please limit and correct this assertion. RussHerrold

What is important is that grub-install copied the right files to /boot/grub/ that we need for booting.

??? QUERY: again, the relevant directory is almost certainly: /boot/ in the example menu.lst given. These need to be tested and corrected. RussHerrold

# /sbin/grub-install /dev/sda

Manually install grub if the previous step failed. - means type it in the grub shell

# grub
#- root (hd0,0)
#- setup (hd0)

Optional packages

You may want to install the package: passwd, and optionally the customary shadow passwd utuilities so you can set passwords

# INSTALL passwd libuser openldap cyrus-sasl-lib

These are used to set the keyboard language (loadkeys)

# INSTALL kbd usermode

Post installation tips

Right now you should have a bootable system! Here are some tips to help you through your first boot

System configuration

Many of the system configurations happens in /etc/sysconfig See

/usr/share/doc/initscripts

for full documentation.

Configure your keyboard in /etc/sysconfig/keyboard using the KEYTABLE variable

Networking

Take a look at /etc/sysconfig/network-scripts/ See ifcfg-lo for an example.

rpmdb: unable to lock mutex: Invalid argument

If the host OS you used has a different version of db, rpm will complain with rpmdb: unable to lock mutex: Invalid argument. This rebuilds the RPM database, preserving exsiting content to the extent possible

# rpmdb --rebuilddb -vv

HowTos/ManualInstall (last edited 2012-10-10 20:03:08 by RussHerrold)