2.4.3 Install 1.6.X

muPBX Install Notes

1.6.x testing is complete. See Status ver 1.6.2 for details.
Summary
  1. Download CentOS and burn to DVD.
  2. Install CentOS 5.4.
  3. Setup autofsck at boot.
  4. Setup remote access for VNC.
  5. Use GNOME to setup root email account.
  6. Fix sendmail from slow starting at boot.
  7. Boot muPBX in Server mode.
  8. Run YumInstall for Asterisk 1.6.
  9. Set asterisk to autostart.
  10. Set Network Time Protocol Daemon to startup after boot.
  11. USB Flash Backup.
  12. Setup HTTP Server. OPTIONAL
  13. Installing Asterisk 2.0 GUI. OPTIONAL

Download CentOS 5.4 e and burn to DVD.

  • Go to the CentOS homepage, http://www.centos.org/ (external link) .
  • At the top of the page you'll see CentOS Download Information.
  • Click on "CentOS-5 ISOs", then on "i386".
  • Click on mirror site for CentOS-5.4-x86_32-bin-DVD.iso.
  • After download burn to DVD.

Asterisk 1.6.2 will be downloaded later with Yum.

See YumInstall for details.

Install CentOS 5.4

  1. Install CentOS 5.4 DVD drive and reboot.
  2. Install in graphical mode - press <ENTER>.
  3. Skip CDROM media test.
  4. Select: Remove all partitions on selected drives and create default layout. - Next
  5. Edit: Network Devices
    1. Enable IPv4 support - Manual Configuration -
    2. Add IP Address and Netmask. e.g., 10.1.1.10 255.255.255.0
  6. Disable IPv6 support.
  7. Set hostname - manually e.g., muPBX1
  8. Add Gateway IP address and Primary / Secondary DNS e.g., 10.1.1.1 10.1.1.1
  9. Set time zone.
  10. Enter root password.
  11. Select Customize Now
    1. Desktop Environments: GNOME
    2. Applications: Authoring and Publishing, Editors, Graphical Internet, Office and Productivity, Text-based Internet
    3. Development: Development Libraries, Development Tools, GNOME Software Development, Java Development, Legacy Software Development, Ruby, X Software Development.
    4. Servers: Mail Server, Network Servers, Print Support, Server Configuration Tools
  12. Base System: Administration Tools, Base, Java, Legacy Software Support, System Tools, X Windows System.
  13. Next-> To start install.
  14. Remove CD/DVD and reboot after install.
  15. Firewall: Disable
  16. SELinux: Disable
  17. Set Date and Time
  18. Add user "admin".



autofsck at boot

If the server goes down dirty from a power outage, autofsck will run fsck at boot.
su - root
touch /.autofsck
cd /etc/sysconfig
vi autofsck - This will create the file.
AUTOFSCK_TIMEOUT=5
AUTOFSCK_DEF_CHECK=yes
AUTOFSCK_OPT="-y"



Setting up VNC for remote muPBX desktop access

#If NOT installed, install the VNC server.
yum -y install vnc-servers

cd /etc/sysconfig
vi vncservers
# Add the following lines
VNCSERVERS="1:admin"
VNCSERVERARGS[1]="-geometry 1280x720"
su - admin
run "vncpasswd" - Enter a password for admin.
"exit"  - to become root again
run "service vncserver restart" - this will create the .vnc directory in the admin's home directory.

su - admin
cd ~/.vnc
vi xstartup
#Uncomment "unset SESSION_MANAGER" and "exec /etc/X11/xinit/xinitrc" - see xstart example below.
Add "( while true ; do xterm ; done ) &"
run "exit"  - Exit from admin back to root user.
run "service vncserver restart"
run "chkconfig vncserver on" - This will enable VNC after a reboot.

file:xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
# Add the following line to ensure you always have an xterm available.
( while true ; do xterm ; done ) &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

file:vncservers - non-secure example
#Bunch of comments...#
VNCSERVERS="1:admin"
VNCSERVERARGS[1]="-geometry 1280x720"

Download TightVNC to your PC: Enter your.ip.address:1 to connect to the muPBX VNC server.
Or
Use a Java enabled browser and surf to: http://your.ip.address:5801 (external link) to connect to the muPBX VNC server.
If it doesn't work properly, try rebooting your server or restarting the Xserver. I rebooted.


Use GNOME to setup root email account.

  1. Using VNC or KVM (Keyboard, Video, Mouse), log into the muPBX GNOME Desktop Manager (GDM)
  2. Goto Application->Internet->Email
  3. Follow the instructions for setting up email.
  4. Test.

Fix sendmail from slow starting at boot.


The problem is that sendmail is looking for a FQDN, and it is probably finding "myhostname" before localhost and localhost.localdomain. Your host file entry should have "myhostname" after the others:
/etc/hosts 127.0.0.1 localhost.localdomain localhost myhostname <-- order matters!!!
If done this way, sendmail sees a FQDN for your loopback interface and will breeze right through.

/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost s4upbx1
::1             localhost6.localdomain6 localhost6


Booting muPBX in Server mode

Set initdefault to 3 for Server mode or 5 for GUI mode.
/etc/inittab
#
# inittab       This file describes how the INIT process should set up
#               the system in a certain run-level.
#
# Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#               Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left.  Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon

Install Asterisk 1.6.

You can either use YumInstall or, for the more adventurous, there is an "Install Asterisk" procedure in the Debugging page for building and installing Asterisk from the source code.


Install Asterisk 1.8.

You can either use YumInstall or, for the more adventurous, there is an "Install Asterisk" procedure in the Debugging page for building and installing Asterisk from the source code.

Set Asterisk to startup after boot.

Asterisk YumInstall will install a start file in /etc/init.d called "asterisk". But, it will not start at boot.
To start Asterisk at boot time, run the following:
chkconfig --add asterisk

Set Network Time Protocol Daemon to startup after boot.

Asterisk YumInstall will install a start file in /etc/init.d called "asterisk". But, it will not start at boot.
To start Asterisk at boot time, run the following:
yum install ntp (if not already installed)
vi /etc/ntp.conf (to make changes to the default servers)
chkconfig ntpd on

USB Flash Backup


Initial Setup Of USB Flash Drive
Insert flash drive in USB before executing these commands.
mlabel -i /dev/sdb1 ::BACKUP
mkdir /mnt/flash
mount -t vfat /dev/disk/by-label/BACKUP /mnt/flash
mkdir /mnt/flash/backup
vi /etc/fstab
LABEL=BACKUP            /mnt/flash              vfat    nosuid,auto     1 2


Make sure to change the CMOS to not boot to USB or the muPBX will hang when rebooted.

Create a logrotate script for cron.
/tools/upbx.logrotate
#Rotate muPBX-Backup.tgz backups to make room for new muPBX backups
cd /etc/logrotate.d

#Global Commands

#Don't rotate directory if it's missing, or empty
missingok
notifempty


/mnt/flash/backup/muPBX-Backup.tgz {
    # Make sure the USB Flash Drive is mounted
    prerotate
         /bin/mount -a
    endscript
    # Do not create a blank backup file.
    nocreate
    # Keep 7 days of backup files
    rotate 7
}

To test logrotate:
/usr/sbin/logrotate -vf /tools/mupbx.logrotate


Create a backup script for cron.
/tools/backup
[root@upbx1 tools]# cat backup.sh
#!/bin/bash
# This is where to add directories to backup.
SRCD="  /etc/asterisk
        /usr/lib/asterisk
        /var/lib/asterisk
        /var/lib/asterisk/agi-bin
        /var/spool/asterisk
        /tools
        /etc/zaptel.conf
        /etc/misdn-init.conf
        /etc/crontab
        /etc/fstab
        /etc/xinetd.d"

#This is the where the backup will be stored.  This path/directory must be created manually before running the script.
TGTD="/mnt/flash/backup/"

#This is the name of the current backup file. Logrotate must be run to make room for this backup.
OF=muPBX-Backup.tgz

#Run mount to rescan the mountab file so the USB flash drive is mounted.
mount -a
df
sleep 3

cd /
tar -czvf $TGTD$OF $SRCD

sleep 3


Update the crontab to enable nightly backups.
/etc/crontab
[root@upbx1 etc]# cat crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=support@micropbxsolutions.com
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
# This command is run daily at 10:32 PM
#32 22 * * * root /tools/gsbackup >/dev/null 2>&1
# This command is run daily at 11:02 PM
02 23 * * * root /usr/sbin/logrotate -fv /tools/upbx.logrotate >/var/log/cron 2>&1
# This command is run daily at 11:32 PM
32 23 * * * root /tools/backup.sh >/var/log/cron 2>&1
32 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly


Create the restore script.
/tools/restore
[root@upbx1 tools]# cat restore.sh
#!/bin/bash

#This is the where the backup is stored.  
TGTD="/mnt/flash/backup/"

#This is the name of the current backup file. If an earlier version is desired, change the name in the script.
OF=muPBX-Backup.tgz

#Run mount to verify the USB flash drive is mounted.
mount -a
df
sleep 3

cd /
tar -xzvf $TGTD$OF


Setup HTTP Server

Asterisk 1.6/1.4 has its own "Micro" HTTP server. To enable the server for the GUI:

manager.conf
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0

[admin]
secret = mysecret
;I left the commented ACL deny/permit in for reference.
;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate


http.conf
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
prefix=asterisk
enablestatic=yes
redirect = / /static/config/cfgbasic.html


Installing Asterisk 2.0 GUI

NOTE - I made a few updates/changes from the original document. See the link above for the original document.

cd /usr/src
svn checkout http://svn.digium.com/svn/asterisk-gui/branches/2.0 asterisk-gui
cd ./asterisk-gui
run ./configure
run "make install"

NOTE - I think make install is going to overwrite http.conf and manager.conf. It might be necessary to do the procedure "Setup HTTP Server", again. Running "make checkconfig" should pass if they are okay.
run "make checkconfig"
cd /var/lib/asterisk/static-http
chmod 0777 ./config
asterisk -r - for Asterisk CLI
CLI> reload


To run the GUI use the following URLs.
NOTE - you MUST use the URLs below. Trying to surf to just the ip.address:port will result in some goofy behavior.
http://your.ip.address.here:8088/asterisk/static/config/cfgbasic.html
http://your.ip.address.here:8088/asterisk/static/config/cfgadvanced.html





Menu [toggle]