Install 32-Bit CentOS on a Cloud Server


Warning: 32-Bit Linux operating systems are no longer supported by Rackspace. You will take your own responsibility and risks for downgrading your cloud server to 32-Bit Linux OS. Standard Rackspace Cloud Control Panel features such as "reset root password" may not work after the downgrade. Backing up your Cloud Server before proceeding is highly recommended.

We cannot offer technical support for this procedure.


Downgrading to 32-bit

The Rackspace Cloud infrastructure supports pygrub and uses it by default on Cloud Servers running on our XenServer 5.x backend. Theoretically, you can run any Linux distribution on your instance. In this article, we are going to demonstrate how to downgrade a CentOS 64-Bit Cloud Server to 32-Bit. As the time of writing 6.2 is the latest stable version available.

You will need to create a new CentOS 6.2 Cloud Server, which is only available in 64 bit as a Rackspace standard cloud image.

Checking the architecture

You can find out what architecture is running on your new cloud server is with this command:


uname -i

The output should be “x86_64”, which is 64-bit.  After the downgrade it will be “i386”, 32-bit.

Boot to rescue mode

We'll need to boot the Cloud Server to Rescue Mode which will shutdown your Cloud Server and boot into a CentOS 64-bit Live Linux operating system. You can put the server into rescue mode via the Cloud Control Panel.

Your original root partition will be on /dev/xvdb1. Let’s mount it on /mnt.

mount /dev/xvdb1 /mnt

Then backup a few configuration files specific to your Cloud Server to /root.

cp -a /mnt/etc/fstab \
/mnt/etc/resolv.conf \
/mnt/etc/sysconfig/network \
/mnt/etc/securetty \
/mnt/etc/sysconfig/iptables \
/mnt/etc/sysconfig/system-config-firewall \
/mnt/etc/sysconfig/network-scripts/ifcfg-eth[01] \
/mnt/etc/sysconfig/network-scripts/route-eth1 \
/mnt/boot/grub \
/root

When done, unmount /mnt and format the partition:

umount /mnt
mkfs -t ext3 /dev/xvdb1

Install via the Internet

Next we are going to install CentOS 6.2 32-bit straight from the Internet.  Before we start we need to prepare a temporary yum repository file and save it to /root. Fire up your favourite text editor to edit the CentOS repository list:

nano /root/CentOS-Base.repo

And paste this into the file:

[base32]
name=base32
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=i386&repo=os

[updates32]
name=update32
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=i386&repo=updates

It is now ready to install. We will mount the empty partition to /mnt and start the installation.

mount /dev/xvdb1 /mnt
yum install -c /root/CentOS-Base.repo --nogpgcheck --installroot=/mnt --releasever=6.2 --disablerepo=* --enablerepo=*32 -y @Core kernel grub openssh-server

Please note that you can change --releasever to another version (like "6.0") if you prefer.

After the installation we'll restore those configurations we backed up eariler.

mv -f /root/fstab /root/resolv.conf /root/securetty /mnt/etc/
mv /root/network /root/iptables /root/system-config-firewall /mnt/etc/sysconfig/
mv /root/ifcfg-eth[01] /root/route-eth1 /mnt/etc/sysconfig/network-scripts/
mv -f /root/grub/* /mnt/boot/grub/
touch /mnt/.autorelabel

Pygrub configuration

As we mentioned at the beginning, your Cloud Server uses pygrub. Use your preferred text editor to update its configuration file:

nano /mnt/boot/grub/grub.conf

We want the file to read like the following:

default=0
timeout=5
title CentOS (2.6.32-220.el6.i686)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-220.23.1.el6.i686 ro root=/dev/xvda1 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 nomodeset crashkernel=auto quiet rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_NO_LVM
        initrd /boot/initramfs-2.6.32-220.23.1.el6.i686.img

Please be aware that as the time of writing, kernel 2.6.32-220.23.1 is the latest. You should update the grub.conf file to the correct version you have installed. To find the version, run this command:

ls /mnt/boot/

There you will find 2 files.  One is vmlinuz-<version>.el6.i686, while the other is initramfs-<version>.el6.i686.img.  Update grub.conf accordingly.

Finish the install

Finally, change the system root to /mnt:

chroot /mnt

And initialize the root user password:

passwd

You'll be prompted to enter a password, then repeat it.  The password will be hidden as you type it for security purposes.

Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

We can now exit the “change root” mode and unmount /mnt.

exit
umount /mnt

Exit rescue mode

Job done, you can exit rescue mode through the control panel and login to your Cloud Server via the console or SSH. When you log in, run:


uname -i

You should see the output:

i386

That’s what we want to see.

The newly-installed Cloud Server is a barebone Linux installation, so you may want to secure it with firewall rules, strong passwords etc.



Was this content helpful?




© 2014 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER