link Custom CentOS 6 on Linode← Back

This guide is based on a Linode 1024 (1GB RAM, 30GB HDD) running CentOS 6.2 as at 25/06/2012. I have my /tmp and /home partitions stored in separate images as well so you may need to substitute where necessary.

  1. Create a new VM in KVM
    - I used 1 CPU, 1GB RAM, 1.5GB HDD and set the OS to Red Hat Enterprise Linux 6
  2. Install CentOS 6.2 minimal
    - Set your hostname
    - Enable eth0 automatically at startup using DHCP
    - Set root password
    - Create custom partition layout
    - Delete any existing partitions (e.g. LVM)
    - Create a standard partition:
    	- Mount point: /
    	- File system type: ext4
    	- Size: 10240
    	- Fixed size: <Tick>
    	- Force to be a primary partition: <Tick>
    - Accept the warning about not having a swap partition
    - Accept any other defaults
    - Reboot when installation completes
    vi /etc/sysconfig/selinux
    	- Set SELINUX=disabled
    yum update -y
  3. Reboot
  4. Create a new partition in your Linode bigger than your local VM
  5. Boot your local VM from Finnix ISO
  6. Boot your Linode from "Rescue" menu, setting drives to the following:
    /dev/xvda to your new root image
    /dev/xvdb to Swap
    /dev/xvdc to Temp
    /dev/xvdd to Home
  7. On your Linode console set root password
    passwd root
    - Set it to whatever you like
    service ssh start
  8. On your local VM console run
    dd if=/dev/vda1 | ssh root@<your-linode-IP> "dd of=/dev/xvda"
    - Enter the root password you just set on your Linode
    - It will take a while to transfer your image because it's going to transfer 1.5GB
    - Shutdown your local VM once transfer has completed
  9. On your Linode console, mount your root partition
    mount /dev/xvda /media/xvda
  10. Edit /media/xvda/etc/fstab, comment out existing root (/) partition and update paths
    # UUID ....
    /dev/xvda / ext4 noatime,errors=remount-ro 0 1
    /dev/xvdb swap swap defaults 0 0
    /dev/xvdc /tmp ext4 noatime,nosuid,nodev,noexec,errors=remount-ro 0 0
    /dev/xvdd /home ext4 noatime,nosuid,nodev,errors=remount-ro 0 0
  11. Edit /media/xvda/etc/init/start-ttys.conf
    env ACTIVE_CONSOLES=/dev/hvc0
    env X_TTY=/dev/hvc0
    #env ACTIVE_CONSOLES=/dev/tty[1-6]
    #env X_TTY=/dev/tty1
  12. Create devices in /media/xvda/dev
    chroot /media/xvda /bin/bash
    MAKEDEV /dev
  13. Delete persistent network device rules
    rm /etc/udev/rules.d/70-persistent-net.rules
    rm /etc/udev/rules.d/70-persistent-cd.rules
  14. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and comment out:
    # HWADDR=
    # UUID=
  15. Edit /boot/grub/menu.lst
    - Comment out/delete any "title" stanzas
    - Create a new stanza:
    	title CentOS-Linode
    	root (hd0)
    	kernel /boot/vmlinuz-2.6.32-220.23.1.el6.x86_64 ro root=/dev/xvda xencons=hvc0 console=tty1 console=hvc0
    	initrd /boot/initramfs-2.6.32-220.23.1.el6.x86_64.img
  16. Create a new Linode profile in the Linode Manager
    Label: Your Linode name
    Kernel: pv-grub-x86_64
    /dev/xvda Your root partition
    /dev/xvdb Your swap partition
    /dev/xvdc Your temp partition
    /dev/xvdd Your home partition
    Xenify Distro: No
    Disable updatedb: Yes
    modules.dep Helper: Yes
    Automount devtmpfs: No
  17. Boot your Linode using the PV-GRUB config and check that eth0 is up:
    ifconfig eth0
    # Should show your Linode IP on the second line after "inet addr:"
  18. Resize the root filesystem to whatever size you configured in the Linode Manager
    resize2fs /dev/xvda
  19. Reboot and then your Linode is ready for further customisation


There are no comments

Post a comment