Tuesday, 15 January 2013

[Video] - Step By Step Guide To Install JunOS on GNS3

Note: Steps by Steps video guide to install JunOS 10.1 in Qemu for GNS3 for Juniper router simulation can be viewed at the end of this post.
Download the required software
1. JunOS 10.X (use Torrents may OS Image are available from there i also got)
Link
2. Download FreeBSD 4.11 as base OS for Router Download
3. Download Qemu 0.11.0 from GNS3 web site Download
4. Need to Software to create CD ISO image. ex:
Deep Burner

Time to Start
Step 1: Download all the given files above
Step 2: Extract Qemu in a folder
Step 3: Open cmd and navigate to extracted folder
Step 4: Create a HDD image to install JunOS of 4GB

qemu-img.exe create j.img -f qcow2


Step 5:
Start the Qemu with Free BSD CD and Created HDD

qemu.exe -L . -m 256 -hda j.img -boot d -localtime –cdrom ..\4.11.4.11-RELEASE-i386-miniinst.iso


Step 6:
Install Free BSD in Qemu
Skip Kernel configuration
Choose standard installation
With fdisk, press A to allocate entire disk for bsd
Select: install a standard MBR
Create partition (with C)
512M for /
1024M for swap partition
128M for /config
and the rest for /var
Choose installation type: user, and select No for FreeBSD ports
X to Exit the menu and install from CD/DVD
Wait until it's done
Yes for chance to set any last options
Type root password
Select 'X' to Exit the installation, it will reboot
while it's rebooting, exit from Qemu by pressing Ctrl-Alt-2,
then type: q

Step 7:
Make JunOS ready to transfer in guest OS
Create a CD Image (ISO) of junOS (using deepburner or any of it kind) and save in Qemu Folder with name like j8.iso
 

Step 8:
Make JunOS Ready for Installation

qemu -L . -m 512 -boot c -hda j.img –cdrom j8.iso

We need to untar the signed jinstall file first:


#mount /cdrom
#cd /var/tmp
#mkdir junos
#cd junos
#tar zxvf /cdrom/jinstall-10.1R1.8-domestic-olive.tgz
Then untar the unsigned image:
#mkdir jinst
#cd jinst
#tar zxvf ../jinstall10.1R1.8-domestic.tgz
Extract the pkgtools.tgz file and replace the checkpic binary inside with /usr/bin/true :
#mkdir pkgtools
#cd pkgtools
#tar zxvf ../pkgtools.tgz
#cd bin
#cp /usr/bin/true ./checkpic
#cd ..
Create tar for pkgtools then remove the directory:
#tar zcvf ../pkgtools.tgz *
#cd ..
#rm -rf pkgtools
Create tar for the new jinstall package with modified checkpic
#tar zcfv /var/tmp/j.tgz *
Then install the new jinstall with bsd pkg_add tool:
#pkg_add -f /var/tmp/j.tgz


It will ask to reboot to continue the installation.
One installation is finished and prompt is returned press Crtl+Alt+2 then type “q” press enter

Step 9:
Install JunOS in Guest VM

“qemu -L . -m 512 -hda j.img -serial telnet:127.0.0.1:1001,server,nowait,nodelay –localtime”

open new cmd and do telnet to 127.0.0.1 to enjoy the watching installtion process of JunOS
Once Prompt appear type cli to start junOS configuration

Step By Step Guide To Install JUNOS on GNS3 [Part 3]

Updating JunOS
You can update your version of JunOS from the CLI with the following command:

request system software add [jinstall_package]


Running your router(s)
Now you have a base olive image. Qemu allows you to use this as a base for other images and only writing the changes to your “slave” images saving on disk space! You can also use less memory for each Qemu instance.
Create a new image off of your base image. Repeat for all your routers you want to emulate:

qemu-img create -b olive-base.img -f qcow2 R1.img

Start your router and then telnet to it:

2001 Once logged in, you can type “cli” to launch the JunOS command line interpreter, exit to … exit and halt to shutdown FreeBSD. Remember to kill your qemu instance(s).

qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,macaddr=00:aa:00:60:01:01,model=e1000 -net user telnet localhost


Networking your routers
Ok, one router it’s cool but useless alone. It’s time to make your virtual network! There are many ways to network your olive routers.



Olive to Olive using UNIX sockets
UNIX sockets create a TCP stream between two Qemu instances with one a client and the other a server. Apparently this method creates duplicate packets sometimes.

qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,vlan=1,macaddr=00:aa:00:60:01:01,model=e1000 \
-net socket,vlan=1,listen=:6000

qemu R2.img -m 96 -nographic -daemonize -serial telnet::2002,server,nowait \
-localtime -net nic,vlan=1,macaddr=00:aa:00:60:01:02,model=e1000 \
-net socket,vlan=1,connect=127.0.0.1:6000


Olive to Olive using UDP tunnels
UDP tunnels are mainly used to connect to Dynamips/GNS3 emulated routers but can also be used as a more reliable way to connect two Qemu olives together but this can result in much lower latency connections as well.

Olive to real world using TAP interface
One way to connect an interface on your Olive with a real Ethernet NIC is to use a bridge and the Qemu tap option.

Linux:
It is required that you have the generic TUN/TAP driver either built-in to your kernel, or available as a module. To check the availability of this module do the following:

ls -la /dev/net/tun

If you get no such file or directory, try doing a modprobe tun. It should then appear in the

lsmod output.

One way to connect an interface on your Olive with a real Ethernet port is to use a bridge and the net -tap option. This requires you to have the generic TUN/TAP driver either built-in to your kernel, or available as a module. To check the availability of this module do the following:

Let’s say you started the emulator with the following:

qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,vlan=1,macaddr=00:aa:00:60:00:01,model=e1000 \
-net tap,vlan=1,script=no


Note the vlan=1 and -net tap options. This basically connects your Olive’s en0 to a virtual tap interface (usually tap0) on your host system. Start up Qemu, and once the emulator is running, proceed to the next step. You’ll need to start up the emulator as root, or change the ownership or permissions on /dev/net/tun.
We’re going to need to now bridge the tap0 interface to another Ethernet interface on the host system. To do this, we’ll utilize the bridge capabilities of Linux. First, get the bridge utilities:

sudo apt-get install bridge-utils


Let’s assume you want to connect en0 on the Olive to eth1 on the host system.

Do the following as root:

brctl addbr br0
brctl addif br0 eth1
brctl addif br0 tap0


This creates a bridge device, br0, and binds the two interfaces to it. Right now everything is still down. Let’s bring it up…

ifconfig eth1 up
ifconfig tap0 up
ifconfig br0 up


Now the bridge and member interfaces should be up. Don’t assign any IP addresses to either of the member interfaces. If you want to, you can assign something to br0 if needed. (br0 is analogous an SVI in the Cisco world) To see the status of the bridge, do the following:

brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000cf19ce06c no eth1
tap0


Now, assign an IP address to the em0 interface on your Olive, and it should be online. You are also free to tcpdump on the bridge or member interfaces, for debugging. All of this can probably be put into a Qemu interface script, so you can remove the script=no option, and make it a little more automatic.
Your kernel might have ethernet filtering (ebtables, bridge-nf, arptables) enabled, and traffic gets filtered except ARP and STP. The easiest way to disable this is to go to /proc/sys/net/bridge. Check if the bridge-nf-* entries in there are set to 1; in that case, set them to zero and try again. More information on bridges available
here.

# cd /proc/sys/net/bridge
# ls
bridge-nf-call-arptables bridge-nf-call-iptables
bridge-nf-call-ip6tables bridge-nf-filter-vlan-tagged
# for f in bridge-nf-*; do echo 0 > $f; done


Windows:

Using OpenVPN you can create several tap interfaces with “Add a new TAP-Win32 virtual Ethernet adapter” and rename them with something like ‘Tap1′, ‘Tap2′ and so on Let’s say we have created 1 Tap interface and renamed it as Tap1. Right click this Tap1 interface on Windows Control Panel – Network Connections and give IP address for example 10.1.1.1/8.
Now you can start Qemu with the -net tap option and ping the interface from your Olive:

qemu -L . -m 96 -hda R1.img -localtime \
-net nic,vlan=1,macaddr=00:aa:00:60:01:01,model=e1000 \
-net tap,vlan=1,ifname=tap0
 

Mac OS X

On Mac OS X, download and install the TunTap package.

qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,vlan=1,macaddr=00:aa:00:60:00:01,model=e1000 \
-net tap,vlan=1,ifname=tap0,script=no
 

We need to give this inter face an ip address:

sudo ifconfig tap0 198.18.0.250/24 up


Olive to real world using PCAP/LACP
In the patch provided in this howto, there is an option to use PCAP or LCAP libraries to bridge directly to a physical interface. You will probable need to run Qemu under Administrator privileges. Please also note that it will stop any other traffic on your interface.

For PCAP:


 qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,macaddr=00:aa:00:60:01:01,model=e1000 \
-net pcap,ifname=eth0


For LCAP:

 qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,macaddr=00:aa:00:60:01:01,model=e1000 \
-net lcap,ifname=eth0
 

Please note that you have to configure an IP address your physical interface before being able to communication between your routers. Also I didn’t test PCAP/LCAP on Windows.

Olive to Dynamips or Pemu

The lastest patch also added a udp option to allow networking to a Dynamips or pemu.

qemu R1.img -m 96 -nographic -daemonize -serial telnet::2001,server,nowait \
-localtime -net nic,vlan=1,macaddr=00:aa:00:60:00:01,model=e1000 \
-net udp,vlan=1,sport=10000,dport=10001,daddr=127.0.0.1
 

Then in your dynagen .net file

[[router Cisco1]]
fa0/0=NIO_udp:10001:127.0.0.1:10000


Olive to GNS3
Under GNS3, you can create a “Cloud” and configure a NIO UDP (you can add as many NIO UDP as you want). The “Cloud” will be your interface between Olive and GNS3, you can link a firewall or a router per NIO UDP.


Of course, you can do the same with other NIOs like NIO TAP to connect to yourolive using a TAP interface.

Testing
To check if everything work, let’s configure 2 Olives:

root@%cli
root>edit
[edit]
root#

[edit]
root#set system root-authentication plain-text-password
New password:
Retype new password:

[edit]
root#set interfaces em0 unit 0 family inet address 10.0.0.1/8
[edit]
root#commit
commit complete

Configure the other device using the same commands but with another IP address (e.g. 10.0.0.2/8) and ping.

root#exit
Exiting configuration mode
root> ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2): 56 data bytes

64 bytes from 10.0.0.2: icmp_seq=0 ttl=64 time=9.771 ms
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.614 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.693 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.630 ms


Additionally, configure OSPF (or any other multicast based protocol) to test if your routers can talk to each other using multicast packets. Again, type those commands on both routers:

root# set protocols ospf area 0 interface em0

[edit]
root# commit
commit complete

[edit]
root# exit
Exiting configuration mode

Then monitor the traffic from one of the router, you should see some multicast traffic (from/to 224.0.0.5):

root> monitor traffic interface em0

02:30:30.973748 Out IP 10.0.0.1 > 224.0.0.5: OSPFv2, Hello, length 48
02:30:31.007675 In IP 10.0.0.2 > 224.0.0.5: OSPFv2, Hello, length 48


Is everything working? yes? then you are successfully running JunOS! Happy networking

What is working
Here is a list of what has been tested and works. You can extend this list by posting comments on what is working or not for you and I’ll update the list:

                                                OSPF (fxp0) OK                            
                                                OSPF (em0) OK                            


A few words about the patch By default using JunOS with a non-patched Qemu, multicast based protocols didn’t worked. As I have very little driver coding experience (and time to learn), I patched Qemu to allow multicast frames to be received by JunOS, instead of being filtered at the driver level multicast frames are filtered by JunOS. The only problem I see could be on the performance side, as JunOS receives every multicast frames, even those not destined to it. However, I think this is not an issue for a simulated lab environments and it worked just fine so far.
If you feel you can do something cleaner, please don’t hesitate, you can still read one of the
Intel manuals concerning the e1000 to have an overview of how complicated driver programming can be.

Conclusion
If you are IT guy (hope you are if you want to play with JunOS), you should be able to run JunOS on your PC without too many issues. I wrote this howto to be as complete as possible, showing how to compile and patch Qemu on 3 different operating systems, installing FreeBSD and JunOS. I encourage everyone to contribute to it by providing fixes, comments or any other help.

FreePBX on Debian



UPDATE:Try this to fix the problems with mysql permissions.  This was suggested by someone else.  I have not tried it myself.  "The 'astrundir' must be changed to  /var/run/asterisk before installing FreePBX. Otherwise, the owner for /var/run/mysqld will be changed to asterisk and that causes mysqld to fail starting. Or you can just change permission of /var/run/mysqld to 777"
I have updated the how-to build asterisk with freepbx on debian sarge with a minimal install that was originally located atsquishychicken.com.
The total install is around 500MB (after deb archives are removed of course :)  )... enjoy.  Please let me know if there are any glaring errors that I have over looked.
Just a quick note before we get started.... there are a couple of things that I assume here.  One is that you are familiar with your shell.  Be sure that you don't just blindly cut and paste this into a window... look at the command and think about what they are doing.  When you see cat > /some/file <<EOF  make sure you cut to the next EOF...
 YMMV and use at your own risk.
 #Install barebones Debian Sarge using the "linux26" command from the initial boot screen.
 boot:linux26
# update all packages and make sure we are current
 apt-get update
apt-get upgrade
 # install and configure etherconf for static IP
# specify the hostname and assign a static ip for later
 apt-get install etherconf
#install sshd so that you can do the rest of the install remotely without the need for a mouse/kb/monitor.  It is also handy for doing the cut and paste thing which Windows users know and love.
apt-get install ssh
# get needed software and dependencies
apt-get install vim libasound2 libgsm1 libltdl3 libpq3 libspeex1 libsqlite0 libtonezone1 odbcinst1 unixodbc openssl libssl0.9.7 libssl-dev libreadline4 libreadline4-dev libeditline0 libeditline-dev libedit-dev libedit2 libncurses5 libncurses5-dev zlib1g-dev bison libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl subversion libipc-signal-perl libproc-waitstat-perl apache2 mysql-server php4 php4-cli php4-mysql php4-pear libapache2-mod-php4 php4-curl libmysqlclient14-dev libmysqlclient14 php4-gd make gcc g++ fxload
# don't forget the kernel headers
apt-get install kernel-headers-`uname -r`
# get the latest asterisk  from cvs
cd /usr/src
svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
svn checkout http://svn.digium.com/svn/asterisk-addons/branches/1.2 asterisk-addons-1.2
svn checkout http://svn.digium.com/svn/asterisk-sounds/trunk asterisk-sounds
# build zaptel drivers for 2.6 kernel
cd zaptel-1.2
make clean; make linux26; make install
# if you need pri support
cd ../libpri-1.2
make clean; make install
#NOTE: In asterisk 1.2.x and above you no longer need the mpg123 player so the installation procedure has been removed from this document.  You DO need to install the asterisk-addons package in order to use the built in MOH.
cd ../asterisk-1.2
make clean; make install
# build asterisk addons with mysql patch to makefile
cd ../asterisk-addons-1.2
perl -p -i.bak -e 's/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/' Makefile
make clean; make install
# build asterisk-sounds
cd ../asterisk-sounds
make clean; make install
# install lame for mp3 resample
cd /usr/src
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.96.1.tar.gz
tar -xvzf lame-3.96.1.tar.gz
cd lame-3.96.1
./configure --prefix=/usr --sysconfdir=/etc
make && make install
# use xorcoms handy zaptel toolset
cd /usr/src
wget http://rapid.sunsite.dk/rapid/pool/main/z/zaptel/zaptel_1.2.5-3_i386.deb
dpkg -i zaptel_1.2.5-3_i386.deb
# If it asks you whether to keep the existing package or install the new one 
go with the default by hitting 'ENTER' or typing 'N'
# auto detect zaptel hardware
genzaptelconf -ds
# install asterisk perl
cd /usr/src
wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
tar zxf asterisk-perl-0.08.tar.gz
cd asterisk-perl-0.08
perl Makefile.PL
make install
# get freepbx
cd /usr/src
wget http://ufpr.dl.sourceforge.net/sourceforge/amportal/freepbx-2.1.1.tar.gz
tar -xvzf freepbx-2.1.1.tar.gz
cd freepbx-2.1.1

# create the databases and tables
mysqladmin create asteriskcdrdb
mysql asteriskcdrdb < /usr/src/freepbx-2.1.1/SQL/cdr_mysql_table.sql
mysqladmin create asterisk
mysql asterisk < /usr/src/freepbx-2.1.1/SQL/newinstall.sql
#grant access to asterisk user.  The usernames and passwords here MUST be the same as those configured during the freepbx install.  Freepbx defaults (username 'asteriskuser' and password 'amp109') are used here.  If you change them here you MUST also change them to the same during the freepbx install.
 echo "GRANT ALL ON  asterisk.* to asteriskuser@localhost identified by 'amp109'" | mysql
 echo "GRANT ALL ON  asteriskcdrdb.* to asteriskuser@localhost identified by 'amp109'" | mysql
 # add the asterisk user and group
 groupadd asterisk
useradd -g asterisk -d /var/lib/asterisk -s /bin/bash asterisk
# make the directory for the virtual host and for recordings.
mkdir -p /var/www/`uname -n`/cgi-bin
mkdir -p /var/www/`uname -n`/htdocs
mkdir -p /var/lib/asterisk/sounds/custom
# build the default zapata.conf
 cat > /etc/asterisk/zapata.conf << EOF
[channels]
language=en
language=en
context=from-pstn
signalling=fxs_ks
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no
;faxdetect=both
relaxdtmf=yes
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

; include zap extensions defined in AMP
#include zapata_additional.conf
#include zapata-channels.conf
EOF
# don't forget the run directory
mkdir /var/run/asterisk
# Now install freepbx.  During this install, it will ask for changes to the defaults.  If you hit ENTER the default will be used.  You MUST pay close attention to these defaults as they need to be changed to the defaults used earlier and in the next step after this one.  There is nothing preventing you from using different usernames, passwords, and directories as long as they are the same in the freepbx setup as they are through out the rest of this document which I have/will point out.
uname -n
#Change the defaults during the install to the following.  Substitute "uname -n" to whatever was returned when you typed in "uname -n" above:
#Enter the path to use for your AMP web root:[/var/www/"uname -n"/htdocs]
#Enter the path to use for your FOP web root:[/var/www/"uname -n"/htdocs/panel]
#Enter the path to your Apache cgi-bin:[/var/www/"uname -n"/cgi-bin]
#Enter the IP ADDRESS or hostname used to access the AMP web-admin:[xx.xx.xx.xx] The IP Address of your #Asterisk Machine

cd /usr/src/freepbx-2.1.1
./install_amp
# create the virtual host file with good defaults.  These original defaults MUST have been changed manually during the automated freepbx install above.
cat > /etc/apache2/sites-available/pbx.conf << EOF

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName `uname -n`
DocumentRoot /var/www/`uname -n`/htdocs
<Directory />

Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/`uname -n`/htdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

</Directory>
ScriptAlias /cgi-bin/ /var/www/`uname -n`
<Directory "/var/www/`uname -n`/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

</VirtualHost>
EOF
# make apache run as user asterisk and enable the virtual host
ln -s /etc/apache2/sites-available/pbx.conf  /etc/apache2/sites-enabled
perl -p -i.bak -e 's/User www-data/User asterisk/' /etc/apache2/apache2.conf
perl -p -i.bak -e 's/Group www-data/Group asterisk/' /etc/apache2/apache2.conf
# make tweeks for php to allow for file uploads
perl -p -i.bak -e 's/upload_max_filesize.*$/upload_max_filesize = 20M/' /etc/php4/apache2/php.ini
perl -p -i.bak -e 's#AddType application/x-httpd-php-source .phps#AddType application/x-httpd-php-source .phps\nLimitRequestBody 20000000#' /etc/apache2/mods-available/php4.conf
# restart to get changes
/etc/init.d/apache2 restart
# change the security to database authentication.  The username and password must be the same as those used during the freepbx install earlier in this document.  The freepbx defaults (username=admin, password=amp111) are used
perl -p -i.bak -e 's/AUTHTYPE=none/AUTHTYPE=database/' /etc/amportal.conf
echo "insert into ampusers values ('admin','amp111','','','','*');" | mysql asterisk
# You will probably get an error/warning here.  Something about "duplicate entry 'admin' for  key 1".  Just ignore it.
# install astmanproxy for astapi dialing
cd /usr/src/
svn checkout http://svncommunity.digium.com/svn/astmanproxy/tags/1.20
cd 1.20
make && make install
# modify /etc/asterisk/astmanproxy.conf and assign username/password
eg: host = localhost, 5038, proxy, 1234, on
# modify /etc/asterisk/manager_custom.conf to add the following
[proxy]
secret = 1234
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.255
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

[astapi]
secret = 1234
deny=0.0.0.0/0.0.0.0
permit=10.0.0.0/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
# build an rc.local startup script
echo '#!/bin/bash' > /etc/init.d/local
chmod +x /etc/init.d/local
update-rc.d local defaults 80
echo '/usr/local/sbin/astmanproxy' >> /etc/init.d/local
# change the user that astmanproxy runs as
perl -p -i -e 's/proc_user.*$/proc_user = asterisk/' /etc/asterisk/astmanproxy.conf
perl -p -i -e 's/proc_group.*$/proc_group = asterisk/' /etc/asterisk/astmanproxy.conf
# change permissions and start amp
amportal chown
amportal start
#If you don't have a zaptel card
modprobe ztdummy
#build a freepbx automatic start and stop script as last to start and first to stop.  I know there is a way to do it with just one script but I haven't figured out how to modify the "skeleton" file included in init.d yet.
echo '#!/bin/bash' > /etc/init.d/amportal-start
chmod +x /etc/init.d/amportal-start
update-rc.d amportal-start start 99 2 3 4 5 .
# Add this line if you do NOT have a zaptel card
echo 'modprobe ztdummy' >> /etc/init.d/amportal-start
# Now complete the start script and add the stop script
echo '/usr/sbin/amportal start' >> /etc/init.d/amportal-start
echo '#!/bin/bash' > /etc/init.d/amportal-stop
chmod +x /etc/init.d/amportal-stop
update-rc.d amportal-stop stop 10 0 1 6 .
echo '/usr/sbin/amportal stop' >> /etc/init.d/amportal-stop

Asterisk GUI v2 Install

Install Asterisk GUI
cd /usr/src
svn co http://svn.digium.com/svn/asterisk-gui/branches/2.0 asterisk-gui
cd asterisk-gui

sh configure && make && make install

nano /etc/asterisk/http.conf
Add the following information

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
prefix=gui
enablestatic=yes


(ctl-x,y,ENTER)


nano /etc/asterisk/manager.confAdd the following information.  You can substitute [admin] and secret= to whatever username/password you want for logging into the Asterisk GUI
[general]
enabled=yes
webenabled=yes
port=5038
bindaddr=0.0.0.0
[admin]
secret=password
read=system,call,log,verbose,command,agent,user,config,originate,read,write
write=system,call,log,verbose,command,agent,user,config,originate,read,write

(ctl-x,y,ENTER)
make checkconfig
look for any errors

asterisk -r>restart now

Now go to your web browser and log on to the GUI at 'http://ip:8088/gui/static/config/cfgbasic.html' using the [admin] and 'secret' username/password.  It will take a few seconds to generate the new scripts and prompt you when complete.

You are now done with the Asterisk GUI install.  You can continue with the rest of the install as required as per the following install procedure starting here:
www.powerpbx.org/content/firewallrouter-configuration-centos-v5x-asterisk-v14x-freepbx-v24x

Sangoma Wanpipe Installation

If you don't have a sangoma card you can skip this and go to the next section.
cd /usr/src
Check sangoma.com to see if this is the latest wanpipe driver.  Download the newest released or beta version for the A200D card.wget ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-2.3.4-13.tgz
tar zxvf wanpipe-3.3.x.tgz
cd /usr/src/wanpipe-3.3.x
./Setup install
Would you like to install WAN Router now? (y/n) y
Would you like update/upgrade wanpipe drivers? (y/n) y
Press [Enter] to continue...
Proceed to build WANPIPE kernel modules ? (y/n) y
Please Select Compilation Mode
1. WAN Protocol Support (Default)
        Protocols: Frame Relay, CHDLC, PPP, X25 and ADSL
2. TDM Voice (Asterisk) Support Only
        Protocols: TDMV (Asterisk) on AFT adatpers.
3. TDM Voice (Asterisk) + WAN Protocol Support
        Protocols: TDMV, Frame Relay, CHDLC, PPP, X25, ADSL
4. TDM Voice (Asterisk) + SS7 Support + WAN Protocol Support
        Protocols: TDMV, SS7, Frame Relay, CHDLC, PPP, X25, ADSL
5. Custom Compilation Mode
        Specify protocols to be added into the WANPIPE
        kernel drivers.
Please select (1,2,3,4 or 5) [Default: 1]: 2
Press Enter for Default
Press Enter for Default
Enable TDMV DCHAN Native HDLC Support & Patch Zaptel ? (y/n) y
Your Zaptel source was modified, recompile/reinstall zaptel ? (y/n) y
Everything else just continue to go with “y” or ENTER for defaults
To upgrade the Wanpipe driver proceed as follows:
check your current version
wanrouter version
Rename or delete original wanpipe source directory
Download new source from Sangoma
And just to make sure asterisk stops
asterisk stop
Now stop the wanrouter software
wanrouter stop

Compile/install Zaptel and Asterisk

cd /usr/src/zaptel-1.4.x
make clean
./configure; make menuselect
Edit according to your hardware
At menu press "x" to save

make; make install
This command creates the start up scripts so zaptel starts on boot. If you have a Sangoma card then skip this step.make config
cd /usr/src/asterisk-1.4.x
make clean
./configure; make menuselect
select core sounds and uncheck all except ulaw.  Same with extra sounds
At menu press "x" to save
make; make install

make samples
make config

cd /usr/src/asterisk-addons-1.4.x./configure; make menuselect
Select the applications you want
At menu press "x" to save


mkdir /var/run/asterisk
mkdir /var/lib/asterisk/sounds/custom

From a command prompt run 'genzaptelconf' to automatically create the /etc/zaptel.conf and /etc/asterisk/zapata.conf files

Download and untar source files

lame is not available through a yum repository; but it can be obtained and installed from Dag Wieers' RPM repositoryrpm -ivh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/lame-3.97-1.el5.rf.i386.rpm
You may wish to check that the link specified here is actually the latest and greatest. Look at the files available on Source Forge and pick the latest one there. 
cd /usr/src 
Get the latest released version of zaptel
wget http://downloads.digium.com/pub/telephony/zaptel/zaptel-1.4.x.tar.gz
tar zxvf zaptel-1.4.x.tar.gz 


Get the latest released version of Asteriskwget http://downloads.digium.com/pub/telephony/asterisk/asterisk-1.4.x.tar.gz
tar zxvf asterisk-1.4.x.tar.gz
wget http://downloads.digium.com/pub/telephony/asterisk/asterisk-addons-1.4.x.tar.gz
tar zxvf asterisk-addons-1.4.x.tar.gz