Install PIAF from USB Flash Drive

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Dec 24, 2010: Uploaded new config files (the process should be more robust on a wider range of machines).

Pbx in a Flash on a Flash - the quick method.

Note: I have significantly changed the procedure from the original. The Centos DVD is no longer required and you use the *.cfg files in the attached archive. A USB drive with free space of 655 MB or greater can be used.

After a lot of reading and testing I was able to get PIAF to install from a bootable USB flash drive. Read all the procedures before you start. The article is long but the process is not complex.

This list below is a summary of the procedures so you get an overall picture of what you will be doing:
  • Edit PIAF ISO to add a folder named Centos or use PIAF 1.7.5.5.5 ISO.
  • Make the flash drive linux bootable using UNetbootin
  • Copy the modified pbxiaf iso (or IAF 1.7.5.5.5 ISO) to flash drive CentOS folder.
  • Copy the downloaded syslinux and kickstart config files to the root (/) folder of the flash drive
Booting from a flash drive offers a lot of advantages. Among them:
  1. Upgrade existing Centos Install
  2. Advanced users can easily modify the installation by adding packages are other changes
  3. New PIAF releases only need the iso on the flash replaced (no need to burn new CDs)
  4. Easy testing of new deployments by changing the flash drive contents
  5. Generally make changes to installations very easily by editing a portable flash drive
  6. Install on any machine with a flash drive (no need for the box to have a cd drive). Easy install on the Acer Aspire Revo and others with no cd drive


Prerequisites
  1. 1 GB of Larger USB flash Drive. This procedure needs about 655 MB or greater free. A smaller drive can be used with some customizations (e.g., for a network only install, the drive needs only about 200 kb free)
  2. PIAF 1.7.5.5.5 install ISO
  3. UNetbootin from http://unetbootin.sourceforge.net/ Note that UNetbootin works on Windows and Linux (Ubuntu Debian Fedora Suse Arch Gentoo etc).
Read the complete instructions before attempting this procedure. If used improperly this procedure can result in data loss or erasing of an incorrect drive. You have been warned. The usual caveats apply: You are not required to use this procedure and so if you lose any data for whatever reason or by whatever means you are solely responsible for such loss. However if done properly this procedure is very safe.

Instructions
  1. If you have not done so yet, Download the experimental PIAF 1.7.5.5.5 install ISO from SourceForge.
  2. If the flash drive is formated as FAT with only one partition, it does does not need to be formated or erased. Additional files can be added to it later. However you should backup any files you need. An initially empty flash drive is easier to manage. If it is not already formated FAT 32, format the flash drive as FAT 32. It needs a sufficiently large primary partition (about 1 Gb or greater for a complete self contained install)
  3. Insert the flash drive. In Linux it will need to be mounted. In Windows make absolutely sure you know the drive letter windows has assigned to the flash drive.
  4. Run UNetbootin. Select the Diskimage button. Browse to 1.7.5.5.5 pbxinaflash iso and select. Make sure you choose correct Drive letter/Device for flash drive. Then click OK to create the live usb drive. You do not need to reboot when finished.
  5. UNetbootin will create a bootable USB drive with the piaf iso copied to the USB drive. You can delete some files and folders as they will not be required.
  6. Browse to the folder. In linux you can also do this from a terminal and use the proper commands or a X windows file manager.
  7. On the flash drive, delete the following folders/directories:
    Code:
    docs, images, pbx, repodata, source
  8. On the flash drive: If it does not already exist; Create a folder/directory named CentOS (remember exact case is important). It should already exist since it is in the pbiaf iso.
  9. Copy the 1.7.5.5.5 piaf iso to the CentOS folder on the flash drive.
  10. Extract the files in the ks.zip archive attached to this post to the root (/) of the USB flash drive
  11. That's it, the flash drive is done.
The *.cfg files in the root of the flash drive were changed: syslinux.cfg and ks*.cfg (ks.cfg, ksauto.cfg, kslvm.cfg, ksmin.cfg, ksnet.cfg, ksraid.cfg). To get this working, at a minimum the syslinux.cfg and one of the ks*.cfg need to be edited/changed. For an automated install we will point to the ks.cfg file at http://www.pbxinaflash.net/ksdir/ks.cfg or http://www.pbxinaflash.com/ksdir/ks.cfg.

The Linux bootloader uses the instructions in syslinux.cfg and the selected ks*.cfg file to control the bootup and install process. ks.cfg files are called Kickstart files and are used to automate the install process. On X windows Linux you can install and use the graphical Kickstart Configurator package. This makes editing a kickstart (ks*.cfg) file much easier.

To linux the flash drive is like another hard drive. Linux mounts your hard drives as block devices and assigns the drive a device name of the form sda or hda (hda for ide drives, sda for SATA drives and our flash drive). Each partition on each drive is assigned a partition number (from 1 to 4 for primary partitions and from 5 up for extended partitions).

The flash drive device will be sdX (where X is a letter like a, b, c). The partitions are addressed as sdX1, sdX2 (sdb1, sdb2 etc). The mostly likely device name will be sdb (but you must make absolutely sure you know the device name), though code in the files will try and usually detect it correctly. The flash drive needs to have a primary partition formatted as fat32. Thus the most likely device name for the first partition on the flash drive will be sdb1 (this is the name on a stock Acer Aspire Revo).

If the flash drive is not not sdb, the install will pause and ask you to select the drive with the install files. The flash drive will be one of the sdx drives (sda or sdc etc)


The Kickstart files

The default pbx in a flash install erases all hard drives. Recall that Centos treats the flash drive as a hard drive so we need to edit our ks*.cfg files to tell it not to erase or partition our flash drive.

I added code to the downloaded kickstart config files to address the following issues:
  • Prevent partition formating of the flash drive during boot.
  • Have the GRUB bootloader installed on the master boot record of the correct drive and not our flash drive
  • Tell the CentOS anaconda boot script the device name of our drives and the folder that contains the install ISO images.
  • Let the install find all packages to be installed
We will use the ks.cfg files at the piaf website as shown above. The downloaded syslinux.cfg files point to the ks*.cfg files at pbxinaflash.net

That is it. Insert the flash drive and boot the computer to install pbx in a flash. First, either enter the bios and change the boot order to USB drive first or interrupt the boot process by pressing the appropriate key (F12 on the Acer Revo) then selecting boot from USB drive.

Let me know if you discover any inaccuracies or issues and I will correct or revise.

There are other advanced and cool ways to change the kickstart files but I will leave those for comments and for advanced users.

Note: The procedure should be considered experimental. Please let me know any issues that you discover so that they can be fixed.

Thanks
 

Attachments

  • ks-1.30.zip
    14 KB · Views: 70

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
What would the customizations be for a 4GB flash drive? I really want to test it, but all I have one me right now (other than an almost-full 32GB) is a 4GB.
--Edit:
  1. Run UNetbootin. Select the Diskimage button. Browse to the pbxinaflash iso and select. Make sure you choose the correct Drive letter or device for the flash drive. After you have made the correct selections, click OK to create the live usb drive. You do not need to reboot when finished. Do we use the changed (With CentOS) iso here or the original non-modified one?
  2. On the flash drive: Create a folder/directory named CentOS (remember exact case is important) Did we not already do this?
  3. Copy the pbxinaflash iso to the CentOS folder on the flash drive. Again, the modded or original?
Thanks
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Pbiaf Flash drive install via Network

What would the customizations be for a 4GB flash drive? I really want to test it, but all I have one me right now (other than an almost-full 32GB) is a 4GB.

Thanks

If net install is selected during boot (ksnet), you can skip copying of the Centos DVD to the flash drive. Be aware that this will slow install unless you have a very fast internet connection. Centos will download its install files from the mirrors. The format (skip username/password for anonymous login)is:

ftp://<username>:<password>@<server>/<dir>

You could also host the modified pbiaf & centos iso on a local ftp or http share (or NFS). For example, if you have pbxiaf already installed it has a web server enabled.

Copy the 2 ISOs to the appropriate directory.
Edit the ksnet.cfg file and add or change one of these set of lines as appropriate.


Code:
# Use network installation via centos mirrors
url --url=ftp://mirrors.kernel.org/centos/5.5/os/i386
Code:
# Use network installation via local ftp share
#xxx.xxx.xxx.xxx is the ip address of the local server
url --url=ftp://xxx.xxx.xxx.xxx/centos

Code:
# Use network installation via local http share
#xxx.xxx.xxx.xxx is the ip address of the local server
url --url=http://xxx.xxx.xxx.xxx/centos

Edit the syslinux.cfg:
In the ksnet block remove
Code:
method=hd:sdb1:/CentOS

With this setup the flash drive only needs about 200kb of space.

Optionally, and I have not tried this, you could figure out which (if any) of the Centos cd's piaf does not need and remove them.

Be sure to select ksnet as the option from the menu during bootup.

Note that there are several ways to create the flash drive but I tried to choose the simplest and safest way for most users. Examples: advanced users can use sylinux, cp the vmlinuz & initrd.img and cat or dd the mbr.bin. Then make the directories and copy the files. Windows users can use syslinux, copybs and copy. If you wish to use this method I figure you are an advanced enough user to figure out the steps and exact format of the commands to implement the procedure to setup the flash drive.
 

Attachments

  • ks.zip
    2 KB · Views: 7

atsak

Guru
Joined
Sep 7, 2009
Messages
2,385
Reaction score
439
Thanks for this. I'm going to put one together in the next couple weeks.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Thanks for all the work on this, bmore. Perhaps you could sketch out what the ISO should look like if we put all of this on one DVD that was ready to go. The objective here would be to have a DVD that was as near ready for a USB install as we could make it so there are minimal steps in pushing it over to a flash drive. And you'll need to put it down where the goats can get it for some of us... like me. :cool: Thanks again.
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
DVD for USB flash drive creation

Perhaps you could sketch out what the ISO should look like if we put all of this on one DVD that was ready to go. The objective here would be to have a DVD that was as near ready for a USB install as we could make it so there are minimal steps in pushing it over to a flash drive. And you'll need to put it down where the goats can get it for some of us... like me. :cool: Thanks again.

This helped to learn a lot about Linux since I am pretty new at it, so I enjoyed the process. Old pro in the win environment though :wink5:

Creating a DVD is fairly simple. The key thing is that you only need to make one change to to the current piaf iso; create a CentOS directory (can be empty) in the root (that is it). When Centos sees /CentOS & /images in the iso it reads it like another install source.

By default it expects the install source ISO's (cd/dvd iso) to be located in /CentOS on the main install cd/dvd.

Steps to create a flash drive friendly dvd:

  1. In root (/): create the following directories:
    Code:
     /CentOS /images /isolinux
  2. In /CentOS: Place the Centos release (now 5.5) DVD. You can optionally use the CDs instead.
  3. In /Centos: Place the same piaf install iso with the one modification (the empty CentOS directory)
  4. The isolinux folder is a duplicate of the one on the PIAF iso
  5. The files in root (/) are the same as in root of the piaf folder
  6. Use the same process that is used for the piaf iso to create this new iso and make it bootable

That's it. This DVD will boot and install piaf as normal with the Centos install files locally on the DVD. Do note that we do not have to place the Centos iso (or the even the piaf iso) on the local flash drive or DVD. In the ks*.cfg kickstart config file, we can use the directive: url =. This is used to direct Centos to look for the install files on any ftp, http or nfs share (locally or on the internet)

To create the bootable install flash drive: Use UNetbootin, select Diskimage, point to the DVD, choose the correct drive for the usb flash and click OK.

The only additional steps are possible editing of the ks*.cfg files for automated installs. A generic one can be used designed for interactice installs. This is a little more complex than the generic ones used on the CD/DVD.

This is because early in the install process Centos needs to know where to locate the ks*.cfg files and some directives in those files need to know the device name for the flash drive. With a cdrom install, cdrom: is all that is needed on any computer as Centos reads this as the first cd drive.

I am in the process of writing a script that will automate the flash drive detection in the ks.cfg kickstart file but it was driving me crazy until I found it was an anaconda bug that snake bit me :banghead: It should hopefully be ready later today but who knows with scripting or programming and this will be my first ever Linux script :smile5:
 

MyKroFt

Guru
Joined
Oct 31, 2008
Messages
659
Reaction score
3
if you really want to make this usb installer user/machine friendly - most of the time the usb device will be /dev/sdb or /dev/hdb depending on your HD device (single drive).

My suggestion would be two sets to ks* files - on set designed for sdb and the 2nd set for hdb

maybe append -IDE -SATA to the menu choices.
Then this setup would work with either STAT or IDE (SINGLE DRIVE) in the machine with just one USB stick

just my 2 cents on setting up my usb stick

Myk
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Experimental PIAF-1.7.5.5.5

I've uploaded an experimental (UNTESTED) PIAF-1.7.5.5.5 32-bit ISO with the missing CentOS folder already in place. It is available on SourceForge now. This will at least save everyone the step of having to figure out how to edit and resave the existing 1.7.5.5.4 ISO. Nothing else has changed! Did I mention it's UNTESTED.
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Mykroft, thanks for the suggestion. However I just finished a script that detects the USB drive and automates the process. Well about 99 % :smile5: My only assumption in the script is that your usb drive is of type sd.

I default the boot menu to using sdb. This is correct for the aspire revo I tested it with. The boot menu can be edited by pressing TAB. If it squawks about a missing file, a reboot and change of the one or 2 'sdb1' to sda1, sdac etc or the much less likely hda1, hdb1 etc would get a hit.

Most newer single drive PCs will work with the default.
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Ward,

I will upload my ksauto.cfg later. This works flawlessly on my new Acer Aspire Revo. It stops only once to ask which version to install (Purple etc).

The following will make the process easier:
  1. The pbiaf iso with the CentOS folder (done).
  2. The ks*.cfg kickstart files in the piaf iso need a few changes
  3. Addition of the pre script to the %pre section
  4. Addition of the %include statement
  5. Copy the isolinux.cfg file to syslinux.cfg. UNetbootin uses these files as a template. The one UNetbootin placed in the root (/) can simply be renamed.
  6. On each 'Append' line Change the location of the ks*.cfg files to ks=hd:sdb1:/ks.cfg
  7. By the way, do you know you can host the ks*.cfg files? The location would then just be your webserver address. The relevant append lines become similar to: (NOTE: Both of these actually work now!)
    ks=http://www.pbxinaflash.net/ksdir/ks.cfg or ks=http://www.pbxinaflash.com/ksdir/ks.cfg
  8. The most important part of the process is locating the kickstart file. If necessary, Centos will prompt with a drive list for where to install. If the ks*.cfg file is not found the install halts. They can be on the CD, just don't point to them with ks=.
  9. If both method= or harddrive= are omitted Centos will prompt for the install location of ISOs with a drives list.
On my Aspire Revo R1600 the fully automated install takes 1 hr 16 min from start to the pbx login prompt.

To borrow from the A-Team... I love it when a plan comes together. Long time geeks love these challenges. :wink5:
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Wow, I just discovered creating the USB install can be totally scripted and automated.

You will need the following open source programs.
  1. Unetbootin
  2. Centos
  3. Pbiaf
  4. Maybe 7zip

Ward can create a 7zip executable packaged with UNetbootin and PBIAF iso. When executed it justs ask to select your USB drive, click OK and done.

OR

UNetbootin has a command interface that can automatically create the flash drive from the pbiaf iso (in Linux or windows). See UNetbootin Command Line Options

A script guru can write a script to:
wget the 2 ISOs
Run UNetbootin command line to extract piaf to USB drive (can prompt for Windows drive letter or linux device name)
Copy the Centos ISO to USB drive
Delete unnecessary files from USB drive
Rename /syslinux.cfg
If necessary copy different syslinux.cfg to USB drive

Anyone wants to do this just let me know if you need any help.

Not much work for a scripting :wink5: guru

Wow, run the script and piaf install flash drive.
 

MyKroFt

Guru
Joined
Oct 31, 2008
Messages
659
Reaction score
3
Mykroft, thanks for the suggestion. However I just finished a script that detects the USB drive and automates the process. Well about 99 % :smile5: My only assumption in the script is that your usb drive is of type sd.

As far as I know ALL USB drives (floppy, HD, Thumb etc) are SDx. So if your primary HD is HDa, the thumb drive would come up as SDa otherwise if HD is SDa, thumb is going to be SDb.

I default the boot menu to using sdb. This is correct for the aspire revo I tested it with. The boot menu can be edited by pressing TAB. If it squawks about a missing file, a reboot and change of the one or 2 'sdb1' to sda1, sdac etc or the much less likely hda1, hdb1 etc would get a hit.

Most newer single drive PCs will work with the default.

they will only work with default if HD is a SATA or SCSI drive, if IDE - the default will not work.

out of the 6 boxes I maintain, only 1 would work with default (home box - its SATA drive), the rest are using IDE drives because they are cheap :(

Myk
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
BMore,
Can you answer these questions for me?
  1. Run UNetbootin. Select the Diskimage button. Browse to the pbxinaflash iso and select. Make sure you choose the correct Drive letter or device for the flash drive. After you have made the correct selections, click OK to create the live usb drive. You do not need to reboot when finished. Do we use the changed (With CentOS folder) iso here or the original non-modified one?
  2. On the flash drive: Create a folder/directory named CentOS (remember exact case is important) Did we not already do this?
  3. Copy the pbxinaflash iso to the CentOS folder on the flash drive. Again, the modded or original?
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
they will only work with default if HD is a SATA or SCSI drive, if IDE - the default will not work.

out of the 6 boxes I maintain, only 1 would work with default (home box - its SATA drive), the rest are using IDE drives because they are cheap :(

Myk

I believe my script will detect the Device name of the USB flash drive during install. This is critical since it prevents the USB drive from being partitioned and formated early in the install and the bootloader might get loaded to the USB drive causing boot failure on reboot.

The 2nd need to detect the flash drive device name is inconvenient but not critical. This may prevent the install from continuing and it would fail very early in the process with a message unable to locate file. However the user can press TAB on the boot menu to edit the line and change the 2 sdb1 to sdba1 then sdbc1 etc and press enter to try again. It would not need but a couple such attempts.

The fail proof way is to have the ks*.cfg files on a ftp or http server.

The only other way I have found so far to overcome this would be to install the GRub bootloader to the flash drive. This has advantages for advanced users (You could have several live usb utilities or installs on one drive.
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
BMore,
Can you answer these questions for me?
  1. Run UNetbootin. Select the Diskimage button. Browse to the pbxinaflash iso and select. Make sure you choose the correct Drive letter or device for the flash drive. After you have made the correct selections, click OK to create the live usb drive. You do not need to reboot when finished. Do we use the changed (With CentOS folder) iso here or the original non-modified one?
  2. On the flash drive: Create a folder/directory named CentOS (remember exact case is important) Did we not already do this?
  3. Copy the pbxinaflash iso to the CentOS folder on the flash drive. Again, the modded or original?

I changed the early draft to reflect your questions. The modded iso is used. Ward has created a new piaf iso with the folder already created. See his message earlier in thread.
If the Centos folder exists, it should... that's fine use it.
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
I uploaded a sample ks.cfg file that should completely automate the install. See 2nd message in thread.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,220
Both Work Now!

ks=http://www.pbxinaflash.net/ksdir/ks.cfg or ks=http://www.pbxinaflash.com/ksdir/ks.cfg

I'll let you adjust the tutorial accordingly. :wink5:
 

bmore

Guru
Joined
Feb 12, 2009
Messages
118
Reaction score
1
Fabulous!!! Runs like a dream. Grabs file, no need to figure drives at that stage. The command interpreter is not loaded yet

Thanks Ward.
 

Members online

Forum statistics

Threads
25,811
Messages
167,759
Members
19,240
Latest member
nikko
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top