Guide to Elastix on Slicehost!

Discussion in 'General' started by bruor, Sep 29, 2008.

  1. bruor

    Joined:
    Sep 29, 2008
    Messages:
    2
    Likes Received:
    0
    I have created this guide to help the community overcome the installation issues that exist with using CENTOS 5.2 as an installation base for elastix on slicehost. If you have a physical machine you could always install an earlier version of the OS, but on a VPS things are a little more complicated. I would also be grateful if someone could verify whether or not some of the steps below, like adding repos to get dependencies, resolve installation issues on 5.2 using the cent2elastix disc.

    On to the good stuff:

    PROCESS OVERVIEW:
    During this guide you will create a chroot environment on your slice and use rinse to install a very cut down base of centos 5.1. Once complete you will use the slice rescue mode to switch out the new install for the old one so that you boot from your centos installation. After some basic config editing to fix 64 bit issues with apache php modules, you will be ready to go!


    Bootstrapping
    This guide used Cent 5.1 repositories for the installation, and rinse v1.3 to complete the bootstrap process

    Part 1: get and install rinse form xen-tools.org
    edit /etc/rinse/rinse.conf and change the [centos-5] section to this:
    Code:
    mirror       = http://vault.centos.org/5.1/os/i386/CentOS/
    mirror.amd64 = http://vault.centos.org/5.1/os/x86_64/CentOS/
    
    this change will ensure that rinse uses the cent5.1 repos to create your new installation, skipping this step will result in rinse giving you the latest stable centos.

    I followed this guide to get rinse to install centos to another folder within my filesystem:
    http://forum.slicehost.com/comments.php?DiscussionID=690

    if you get python module errors when trying to run YUM within the chroot. copy them from /lib64/file.name to your /NEWcentos5/lib64/ directory. This will make things work until your Chroot environment can update itself. I only needed to move 3 libs and just kept running the rinse command and fixing each library as it complained. ***IMPORTANT be sure to kill the rinse process as soon as it starts to run properly, we need to force it to use CENT 5.1 packages within the chroot environment too!

    Edit the /NEWcentos5/etc/yum.repos.d/Centos-Base.repo file contents to this:
    Code:
    ###############################
    #
    # changes to this file force yum to use the 5.1 repos for packages. 
    #
    # CentOS-Base.repo
    #
    # This file uses a new mirrorlist system developed by Lance Davis for CentOS.
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the
    # remarked out baseurl= line instead.
    #
    #
    
    [base]
    name=CentOS-5 - Base
    #mirrorlist=http://mirrorlist.centos.org/?release=5.1&arch=x86_64&repo=os
    baseurl=http://vault.centos.org/5.1/os/x86_64/
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
    
    #released updates
    [updates]
    name=CentOS-5 - Updates
    #mirrorlist=http://mirrorlist.centos.org/?release=5.1&arch=x86_64&repo=os
    baseurl=http://vault.centos.org/5.1/os/x86_64/
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
    
    #packages used/produced in the build but not released
    [addons]
    name=CentOS-5 - Addons
    #mirrorlist=http://mirrorlist.centos.org/?release=5.1&arch=x86_64&repo=os
    baseurl=http://vault.centos.org/5.1/os/x86_64/
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
    
    #additional packages that may be useful
    [extras]
    name=CentOS-5 - Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=5.1&arch=x86_64&repo=os
    baseurl=http://vault.centos.org/5.1/os/x86_64/
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-5 - Plus
    #mirrorlist=http://mirrorlist.centos.org/?release=5.1&arch=x86_64&repo=os
    baseurl=http://vault.centos.org/5.1/os/x86_64/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
    #################################
    
    And run the rinse command one last time. You should see the rinse script run completely and see that it is grabbing packages for 5.1 and not 5.2.

    Step 2: Swap the install
    Now that we have successfully "rinsed" a new installation of cent we need to get our slice to boot it:
    make sure that the following exist under the /NEWcentos5 folder and that the contents match your existing files.
    /etc/hosts
    /etc/fstab
    /etc/sysconfig/network
    /lib/modules/* (just to be safe but probably not necessary)
    /etc/sysconfig/network-scripts/ifcfg-eth0

    -chroot to your installation
    Code:
    mount -t proc none /centos/proc
    chroot /centos /bin/bash
    
    -install ssh and enable root logon
    Code:
    yum install openssh-server
    *set the root pass
    passwd root 
    
    *modify /etc/ssh/sshd_config to allow root login. 
    PermitRootLogin Yes
    
    -put the slice in rescue mode and mount your slice to /root
    use web panel to put the slice into recovery. when it boots log in and run
    Code:
    mount /dev/sda1 /root
    
    -now we are going to move all the folders on our drive into a subfolder. (igrnore any warnings about copying a folder into itself)
    Code:
    mkdir /root/oldcent
    mv /root/* /root/oldcent/
    
    -now we move our chroot to the / folder on the drive
    Code:
    mv /root/oldcent/NEWcentos5/* /root/
    
    -shutdown the slice and exit rescue mode
    Code:
    halt
    
    *use web interface to exit rescue.

    -your slice should now boot into your new (OLDer) version of CentOS.
    **NOTE: I noticed that the web console still showed the system was on CentOS 5.2, but 'cat /etc/redhat-release' said:
    CentOS release 5 (Final)
    before these steps it used to say "CentOS release 5.2 (Final)"

    Step 3: Install elastix

    -download and mount cent2elastix iso
    Code:
    wget http://path.to/iso.from.mirror.iso
    mount -o loop isoname.iso /mnt/whatever
    
    -Create a DAG repo
    -For me the installation refused to complete and could not install a ton of perl dependencies, YUM sucks for telling you exactly why it can't fix its own problems. I found that adding a DAG repo for Perl-CPAN modules silences YUM's whining.
    in /etc/yum.repos.d/dag.repo:
    Code:
    [dag] 
    name=Dag RPM Repository for Red Hat Enterprise Linux 
    baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
    gpgcheck=1 
    enabled=1 
    gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
    
    -run the installation command from the ISO:
    Code:
    cd /mnt/whatever 
    ./install
    
    *if you get any dependency errors resolve them by running:
    "yum install depname" until the installation works. This is yet another inability of YUM to sort dependencies properly.

    -Once the installation has finished (cleanly or not) your system will reboot. you will need to watch your ssh session for any errors at the end of the installation process. the install script will complete and reboot the machine even if it cannot install dependencies properly. THIS NEEDS FIXING TEAMS!

    PHP issues:
    -once the system was installed, Apache was logging a ton of PHP errors in the error_log file. This was due to the face that the slice is 64bit. to get elastix to start properly i had to edit /etc/php/php.ini and change the extensions directory reference from '/usr/lib/php/modules' to '/usr/lib64/php/modules'
    After restarting apache I was able to log into the elastix interface.

    SSH Key based auth with PuTTY:
    http://linux-sxs.org/networking/openssh.putty.html

    This is optional but recommended if you want to be completely protected from brute force attacks on passwords. If you enable this and don't disable password auth, then you are just doing it for convenience. I would only recommend turning off password based auth if you have a slice or some other means of accessing the console of your system remotely to re-enable password-auth should you lose your public key.
     
  2. bruor

    Joined:
    Sep 29, 2008
    Messages:
    2
    Likes Received:
    0
    Just a note, i have tried repeatedly to get the formatting on this article to appear a bit more sane but am unable to get line breaks to show up in the non-code sections. If i view this with chrome it doesn't show any breaks in any section. View this with Firefox to make the code sections clean!
     

Share This Page