Installing CentOS from livecd

Posted by litosteel on Dec 31, 2010 12:27 PM EST
litosteel; By litosteel
Mail this story
Print this story

Many times i download live cd distros to preview and install them, but sometimes the livecd does not have an installer, even the official site says that this cd cannot be installed, thats the case with CentOS 5.5 livecd. Well i did install it, with "some assembly required" but i did it, this are my notes to make this process "easy" to you.

First things first

First things first, you need to be "used to the bash", we need some line commands before enjoy a hard disk installation of CentOS 5.5. and first of all please download CentOS 5.5 livecd and burn it (or if you prefer test this in a VirtualBox or another Virtual environment, i did first in VBox)

Partition your disk Once you are in the CentOS live desktop you need to format your hard disk, you can use first another small livecd with Parted or some partition manager software. You can use too fdisk, which come with CentOS livecd... All the next commands must be done as root user, just open a terminal and "su" with no password and then type

/sbin/fdisk /dev/yourdev

Some help is shown when you press m (yourdev may be hda, sda, etc, depends on your hard disk type) n New partition, you need to set a number for this (primary partition)

please create two of them, the first will be your root partition and the second will be swapping space you can change a partition with the command "t" after creation and set type 83 for a linux swap type partition.

Now that you have your partitions you need to format them

/sbin/mkfs -t etx3 /dev/yourdevX

Where X is the number for the root partition (maybe 1, but if you use a previous partitioned disk select the number you assigned to your new partition)

WARNING: please backup first if you have partitions with sensible data...

NOTE: in the next steps we assume an IDE disk with partition 1 to be root and partition 2 to be swap space take this in account when you type all the next commands

Mounting your partition

Mount your partition in a new directory...

mkdir /centos mount /dev/hda1 /centos

check it was mounted df /dev/hda1 xxxx xxxx /centos

Copying CentOS files to your partition

change to the partition cd /centos

now just copy all the root partition of the livecd cp -rdav .. .

note that is a copy of the parent (..) to this (.) directory with recursive copying

If you use an existent partition and you have an starting installation with grub or another boot manager you can simply start your computer, enter your distro an configure it to boot CentOS (chek ahead "Configuring grub")

Installing grub.

If you made a fresh installation your disk have no boot manager, we need to install one, do this... still in the live cd environment and as root we're going to chroot to the CentOS installed partition

chroot /centos /bin/env -i TERM="$term" /bin/bash --login

You are now inside your hard disk installed environment, type next...

/sbin/grub-install /dev/hda

next use the grub program to setup your startup disk

grub

you will be prompted by ... grub >

type next commands

root (hd0,0) (if you disk is the first disk in your computer setup and partition is the first) setup (hd0) (again if your disk is the first) exit

we have finished with grub installation now.

Creating an initrd image

As this CentOS installation doesnt know how we configure our computer we need to setup an initrd image, type next still in the chrooted environment

/sbin/mkinitrd /boot/initrd-2.26.28-1.EL.img

this will create an initrd image suitable for your CentOS installation

Configuring grub still in the chrooted environment you need to setup the grub start menu (grub.conf)

cd /boot/grub nano /grub.conf

and type next commands

title CentOS 5.5. kernel /boot/linux-2.26.28-1-EL root=/dev/yourdev selinux=disabled initrd /boot/initrd-2.26.28-1.EL.img

and press <CTRL> O to save the file and press <CTRL> X to exit nano

Now you are ready to boot at first time your new shinning CentOS livecd Hard Disk installation

After boot you need to setup another user, as the default still be centos. You must change the root password cause root in CentOS livecd has no password by default, failing to do this may expose your Box to security risks.

If you note, we configured our kernel to boot without selinux activated. After all the previous configurations done, you can activate selinux.

I hope you can enjoy installing CentOS from only one cd and with many of the common an daily used packages ready to use. You can add all the CentOS repositories software or simple use CentOS as a secure an stable Desktop. Bye bye

  Nav
» Read more about: Story Type: Tutorial

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.