**Objective:** Write a *perl* script to remotely repartition a server running _RedHat Enterprise Linux 4_(or _Centos4.2_) and install _Debian 2.6_ on it. There is no physical access to the server. The only access to the server is through SSH. The script must operate automatically without any user interaction.
Write a perl script to remotely repartition a server running RedHat Enterprise Linux 4(or Centos4.2) and install Debian 2.6 on it. There is no physical access to the server. The only access to the server is through SSH. The script must operate automatically without any user interaction.
The server has high-speed internet access. So, the script may download whatever it needs to (wget, etc...)
The perl script that you will write will operate as follows:
**1)** The perl script will be transfered to the boot partition(/boot on hda1) of the server by scp and given full root priveleges.
**2)** The perl script will be executed remotely using ssh.
**3)** The /boot partition from which the perl script is running is 90MB (max). The script will erase and repartition all of the other partitions. The hard-disks are IDE. No SCSI disks are used.
**4)** OPTIONAL(You may or may not need to do this): The script will install a small bootable linux OS in the /boot partition and will remove GRUB. LILO will be installed in its place. You may use debootstrap (<[url removed, login to view]~blade/install/debootstrap/>) for this purpose. Or, you may use something like Tom's Root Boot (<[url removed, login to view]>). Damn Small Linux is also an option (<[url removed, login to view]>).
**5)** The script will copy the /etc/hosts, /etc/[url removed, login to view], hostname, and network settings (gateway, netmap, network, inet address) from the RedHat OS(or Centos4.2). These network settings will be restored when the Debian OS is installed. You may use 'route -n' and 'ifconfig' to determine these settings. Please do _not_ use '/etc/sysconfig/network' to determine the network settings.
**6)** The script will unmount all of the other partitions (except for the boot partition). Please use '*mount*', '*/etc/fstab*', '*/mount/proc*', or '*/boot/grub/[url removed, login to view]*' to determine which device is the 90MB /boot partition. Instead of /dev/hda1, the boot partition may be on /dev/hda3, for example.
**7)** The script will repartition the disk space so that there is one 4GB swap partition. The rest of the disk space will become one LVM2 partition. If there is more than one hard-disk, the script will operate on only the first hard-disk (the one with the boot partition on it). The script should assume that there will be only 1 (one) hard-disk on the server.
**7)** The script will reboot the machine (optional -- if you need to do this, that's fine).
**8)** The script will now install Debian 2.6 using debootstrap into the LVM2 partition (which the script just created).
**9)** The script will install SSH so that remote users can login to the server.
**__Output Of Program__:**
When the script finishes running , there should be:
***** Only 1 (one) OS running on the server.
***** There should be (1) 4GB swap partition, (1) boot partition (unmodified), and the rest of the disk space should be one LVM2 partition (where Debian 2.6 is installed).
***** The server should be using LILO instead of GRUB.
***** SSH should be running on the server.
***** The original network settings (gateway, eth0, etc...) should be restored.
***** I should be able to SSH into the server.
***** Most Importantly: When the server is rebooted, Debian 2.6 should come up and SSH should start running.
The script may reboot the server if it needs to.
**1)** When you are ready to submit your perl script, I will provide you with SSH root access to a Centos4.2 x86 server. You will scp your perl script to the server and demonstrate that it can automatically:
***** Repartition the server to have a 4GB swap partition. Your script will not modify the 90MB /boot partition. Your script will repartition the remainder of the hard-disk space into a seperate LVM2 partition, where Debian will be installed.
***** Install a complete 2.6 Debian OS. Your perl script will also replace GRUB with LILO.
**__Terms And Conditions___:**
***** You will deliver complete source code of all work done.
***** Deliverables must be in ready-to-run condition.
***** All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
**How To Test Your Perl Script:**
This is only a reccomendation:
* Download and install VMware Server (it's free): <[url removed, login to view]>
* Download the Centos4.2 Server-only ISO image: <[url removed, login to view]>
* Create a new VM in VMware and mount the Centos ISO image to the virtual CD-ROM drive in your new VM.
* Boot your new VM and allow it to enter the Centos installation program.
* Install the Centos4.2 OS in your new VM with the following settings:
-Packages: Minimum Server Install (~680MB)
-Partitions: Allow Centos to configure partitions automatically. Resize the boot partition to 90MB.
* Configure the network settings for Centos so that you can ssh into the VM.
* Allow Centos to finish installing.
* Unmount the virtual CDROM, reboot the VM, and login to the fresh Centos installation.
* Use VMWare to take a snapshot of the OS.
* SCP your perl script to Centos and launch the script using SSH. Test if your script can (1) repartition Centos (all partitions except for the 90MB boot partition), and (2) install Debian 2.6.
* If your script fails, revert to the VMware snapshot and try again.
The perl script must run on an x86 server running either RedHat Enterprise Linux 4 or Centos4.2 i386. The server will have at least 1GB of RAM and 80GB of hard disk space. The /boot partition (hda1) will be 90MB (max). The script will be copied over to the server using scp. The script will be executed remotely using ssh. There is no physical access to the server. All of the hard-disks are IDE (hda's). No SCSI disks are used. The server has high-speed internet access.