VoIPowering Your Office with Asterisk: Running AstLinux From the LiveCD
AstLinux is so compact you can easily run it from a CDor even a USB flash drive.
Last week we took a look at some of the many interesting possibilities for users of AstLinux. Today we'll make a LiveCD, use it to boot an ordinary PC, and start learning how to make a nice lean, yet fully functional iPBX out of it.
AstLinux's configuration files and Web interface are well organized. In fact, if I had a blue ribbon I would give it to AstLinux author Kristian Kielhofner, because the Web interface is so orderly and easy to navigate; so is the file system. Originally AstLinux was based on Gentoo; then Kielhofner completely rewrote it from scratch. The effort showsit's a good clean build with nary a wasted bit.
Getting the correct installation image
AstLinux has several different images for different hardware architectures. For a plain old PC create a CD from AstLinux-0.4.4.iso. This includes both the generic i586 PC image, geni586.img, and an image for the Soekris 4801, net4801.img.gz. You'll want a reasonably modern PC, but bleeding-edge is not necesssary. AstLinux supports most PC hardware, but not every last little thing. My test system is a homebrew AMD Duron 800 with a FC AZ11 motherboard, onboard Ethernet and sound, an antique 3Dfx Voodoo 3 video card, 256 megabytes of RAM, a CD/DVD writer, and 10-gigabyte hard drive. By PC standards that's outmoded, but for AstLinux it's a ranch the size of Idaho.
Boot up your test PC with the AstLinux LiveCD. At the boot prompt enter the livecd command. If all goes well and it recognizes your hardware, you'll end up at this command prompt:
If you were paying attention when the disk booted, you know that the login is root and astlinux. Asterisk is ready to rock, so log into the Asterisk console in the usual manner:
pbx ~ # asterisk -rvvv
Connected to Asterisk 184.108.40.206 currently running on pbx (pid = 1316)
Verbosity is at least 3
AstLinux does not support sound (yetalthough this will change soon) so you cannot do testing on the console. However, it is very easy to make a quick configuration tweak and start using it. Point a Web browser on a neighboring PC to AstLinux's IP address, like this: https://192.168.1.215. (Find the IP address by running ifconfig eth0 on the server.) You'll get a warning about "The server certificate failed the authenticity test". Accept it and keep going. The login is admin, astlinux. You'll see something like Figure 1.
This is the General -> Status page. Under Asterisk -> Config you can browse
and edit all files that the Web admin has permissions for. A lot of system files
are off limits to the Web admin, but all Asterisk configuration files are available.
On the General -> Setup page change the filesystem to read/write, then open
sip.conf and add a user for testing. Copy this exactly, though you may
use anything you want for the username and secret:
Click the "submit changes" button at the bottom of the page, then configure a softphone on a neighboring PC to use AstLinux and this new user. Dial 1000, and you'll get the familiar Asterisk demo.
There's not much point in going nuts at this point and configuring everything, because AstLinux is running entirely in RAM, so everything is lost at reboot. There is an ingenious way to run AstLinux from the LiveCD and preserve all data and configuration files on a USB key. Suppose you have a nice little USB Flash drive. (Though "little" hardly applies anymore since they're up to 16 gigabytes.) Plug it into your AstLinux PC. You'll see a bunch of output appear on the screen like this:
usb 2-1: new full speed USB device using ohci_hcd and address 3
usb 2-1: configuration #1 chosen from 1 choice
sd 0:0:0:0: Attached scsi removable disk sda
Press the return key to make your command prompt reappear, then type the following command:
pbx ~ # genkd
You may also specify a device, like genkd /dev/sdb3. Now you'll see
an amusing blend of scary error messages and questions, like "Is this okay?" Type
yes and keep going. When it's finished you'll be prompted to reboot. Obey. Now
your USB key has all manner of configuration files copied to it, and will store
voicemail. AstLinux will first look for files on the USB key, then if it does
not find one it will fall back to the defaults.
To use your new USB key, boot AstLinux with no options. Or you may specify the device like this:
Using your own correct /dev name, naturally. Now your system files are nicely separated from your data files. This lets system files remain in read-only mode, which is good when you're running AstLinux on Compact Flash, and provides a clean easy upgrade path that does not endanger your data files.
usbkd is the default boot target. Use the livecd target when you don't want to mount a USB key.
Come back next week to dig deeper into the tiny but powerful AstLinux.
VoIPowering your Office with Asterisk: Building a Test Lab, Part 2 tells how to configure the X-Lite softphone