Ubuntu Scratch Install

Hi everyone, Just wanted to post this out there for Newbies like me. I am running Dell Poweredge 2650's and ran into an issue with installing Vicibox Redux 3.1.9 or any of the versions. The problem was the Grub Bootloader which had to do with openSUSE 11.3 and how it installs on Dell PE's. After pulling out whats left of my hair I decided to go with the scratch install for Ubuntu 8.0.4 that I found on the Wiki. Along the way I updated the links that were broken and added some more explanations in the steps for "Newbies" like me. For the experts out there any suggestions would be welcome and I hope this helps anyone with similar issues! Note : I have this successfully installed and working on 3 servers so far.

From a full default install of Ubuntu Server 8.0.4.3 LTS 32 bit or 64 bit: (Updated Links)


 * For 64 bit http://old-releases.ubuntu.com/releases/hardy/ubuntu-8.04-server-amd64.iso
 * For 32 bit http://old-releases.ubuntu.com/releases/hardy/ubuntu-8.04-server-i386.iso

Then burn the iso image and enjoy !!!!

Once you have Ubuntu installed:

Open a terminal on the system ( Coming over from windows I use WinScp and Putty) http://winscp.net/eng/index.php

$ sudo su $ passwd #(set the root user's password)

$ apt-get update #(retrieves the latest repository information) $ apt-get upgrade #(upgrades any out of date packages $ apt-get install linux-headers #(Used for zaptel compile) or $ apt-get install linux-headers-server $ apt-get install linux-source #(needed if you are going to recompile the linux kernel) $ apt-get install linux-image-server $ reboot #(reboot to use the new kernel)

- Apply Security Updates Reference: https://help.ubuntu.com/community/AutomaticSecurityUpdates

Open a terminal on the system $ sudo su $ passwd

Follow these steps:

Using cron and aptitude

To begin, create a new file:

$ nano /etc/cron.weekly/apt-security-updates

Copy the following text into this new file, save, and exit:

echo "**************" >> /var/log/apt-security-updates date >> /var/log/apt-security-updates aptitude update >> /var/log/apt-security-updates aptitude safe-upgrade -o Aptitude::Delete-Unused=false --assume-yes --target-release `lsb_release -cs`-security >> /var/log/apt-security-updates echo "Security updates (if any) installed"

Press ctrl+x and the Y "enter" to save

Once you are complete, you want to make the file executable. So, via the terminal, type the following line:

$ sudo chmod +x /etc/cron.weekly/apt-security-updates

This script will run once weekly and it installs all available packages from the security repository. It also generates a log in /var/log/apt-security-updates for later inspection in case something goes wrong.

This script will output information to a log file, so to prevent this log file from getting too large we need to make sure it gets rotated out. To do this, we'll use the logrotate utility, which comes with Ubuntu. Press Alt+F2 and type this command:

$ nano /etc/logrotate.d/apt-security-updates

Paste this into the editor, save, and exit:

/var/log/apt-security-updates { rotate 2 weekly size 250k compress notifempty }

Press ctrl+x and the Y "enter" to save

This will rotate the log file every week (weekly), or if it's over 250kB in size (size 250k), compressing old versions (compress). The previous two log files will be kept (rotate 2), and no rotation will occur if the file is empty (notifempty).

Done- From your Terminal use - 'apt-get install' for the following packages:

$ apt-get install apache2 #(web server) $ apt-get install apache2-mpm-prefork #(multi threaded portion to apache2) $ apt-get install build-essential #(this is the build tool chain for gcc) $ apt-get install lame #(this is a mp3 encoding tool) $ apt-get install libmysqlclient15-dev #(library that lets programs connect to mysql) $ apt-get install libncurses5-dev $ apt-get install libploticus0-dev $ apt-get install libsox-fmt-all #(encoding and decoding libraries for sox) $ apt-get install mpg123 #(mp3 playback utility for the commandline) $ apt-get install mysql-client-5.0 #(command for connecting to mysql) $ apt-get install mysql-doc-5.0 #(documentation for mysql) $ apt-get install mysql-server-5.0 #(this will ask for a password you can just press enter a bunch of times Note: Do not put a password in here, You will be able to add it at the end) $ apt-get install mtop #(utility for monitoring mysql) $ apt-get install mytop #(utility for monitoring mysql) $ apt-get install ntp #(time synchronization utility) $ apt-get install openssh-server #(ssh server allows for remote connection) $ apt-get install php5 #(base php files) $ apt-get install php5-cli #(php command line interface (allows us to run php -v for eaccelerator)) $ apt-get install php5-dev #(development tools for php5 allows us to compile eaccelerator $ apt-get install php5-mysql #(allows php5 to connect to a mysql server) $ apt-get install phpmyadmin #(vicidial uses apache2 as its webserver please select this) $ apt-get install ploticus #(this is what creates the graphs for the server performance screen) $ apt-get install screen #(vicidial runs its core scripts in screen so this is REQUIRED) $ apt-get install sipsak #(tool for sending various information to sip phones) $ apt-get install sox #(command line encoding and decoding tool) $ apt-get install subversion #(code versioning tool) $ apt-get install subversion-tools $ apt-get install unzip $ apt-get install libcurl3 $ apt-get install curl $ apt-get install vim $ apt-get install phpsysinfo $ apt-get install iftop #(this is a useful tool for looking at the network interface) $ apt-get install htop #(this is a useful tool for looking at the network interface)

From your terminal:

$ cd /usr/src $ tar -xjf linux-source-2.6.24.tar.bz2 #(where * is the kernel version)( to find kernel version use this command: uname -r. This one was a little tough kept getting an error. My linux kernel was 2.6.24-29-server, took off -29-server and it worked? ) $ cpan

(press enter to go through the prompts. If you have a multi cored system you should enter the -j option when specified with n+1 as the value, where n is the number of CPUs you have in your system. Also enter UNINST=1 when asked. until you get to the mirror selection portion) (select 3 mirror sites in your area)

> install MD5 > install Digest::SHA1 > install readline > install Bundle::CPAN #(do not change settings,This one takes a while be patient and keep hitting enter!) > quit $ cpan (enter through questions until you get to the cpan prompt) > o conf commit (saves the config changes) > force install Scalar::Util > install DBI > force install DBD::mysql > install Net::Server > install Time::HiRes > install Net::Telnet > install Unicode::Map > install Jcode > install OLE::Storage_Lite > install Spreadsheet::WriteExcel > install Proc::ProcessTable > install Spreadsheet::ParseExcel > install Mail::Sendmail > quit

$ cd /usr/src $ wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz $ tar xzf asterisk-perl-0.08.tar.gz $ cd asterisk-perl-0.08 $ perl Makefile.PL $ make all $ make install

$ cd /usr/src $ wget http://www.daveltd.com/src/util/ttyload/ttyload-0.5.tar.gz $ tar xzf ttyload-0.5.tar.gz $ cd ttyload-0.5 $ make $ make install

$ cd /usr/src $ wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip $ unzip eaccelerator-0.9.5.3.zip $ cd eaccelerator-0.9.5.3 $ phpize $ ./configure $ make $ make install $ cd /etc/php5/conf.d/ $ nano eaccelerator.ini > add the following to the eaccelerator.:

extension="eaccelerator.so" eaccelerator.shm_size="48" eaccelerator.cache_dir="/var/lib/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"

Press ctrl+x and the Y "enter" to save

$ mkdir /var/lib/eaccelerator $ chmod 0777 /var/lib/eaccelerator $ php -v NOTE: You should see a line mentioning eaccelerator. If you do not or you get an error you have done something wrong

$ mkdir /usr/src/asterisk $ cd /usr/src/asterisk

- FOR 1.4 asterisk do the following:

$ wget http://download.vicidial.com/required-apps/asterisk-1.4.27.1-vici.tar.gz $ wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.12.1.tar.gz $ wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.1.tar.gz $ tar xzf asterisk-1.4.27.1-vici.tar.gz $ tar xzf zaptel-1.4.12.1.tar.gz $ tar xzf libpri-1.4.10.1.tar.gz $ cd libpri-1.4.10.1 $ make clean; make; make install $ cd ../zaptel-1.4.12.1 $ ./configure; make clean; make; make install $ cd ../ $ mv asterisk-1.4.27.1-vici asterisk-1.4.27.1 $ cd asterisk-1.4.27.1 $ ./configure; make clean; make; make install $ make samples $ modprobe zaptel $ modprobe ztdummy

(I use XLite 3.0 softphone http://en.kioskea.net/download/download-1656-x-lite so I skipped this next section and resumed at Test Asterisk: below)

- install the module for the digium device that you are using, we are using the T100P single span T1 card so we use:

modprobe wct1xxp

Here's the list of all digium cards and the modules you use with them:

Card Module - TDM400P wctdm X100P wcfxo TDM* wcfxs S100U wcusb T100P wct1xxp E100P wct1xxp T400P tor2 E400P tor2 TE110P wcte11xp TE410P wct4xxp TE405P wct4xxp TE411P wct4xxp TE406P wct4xxp TE210P wct2xxp TE205P wct2xxp TDM2400P wctdm24xxp

- If you have chosen a Sangoma T1/E1 or analog card, you will need to follow their instructions for installation of their driver software LATEST Sangoma Wanpipe drivers:

wget ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.3.9.tgz

- now your asterisk installation is built and loaded and it's time to configure it.

NOTES: If you want to install zttool diagnostics you may need the newt package installed:

$ wget http://download.vicidial.com/packages/newt-0.51.6.tar.gz $ ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51

then go to your zaptel folder and do 'make zttool'

Digium/Clone X100P EXAMPLE for reliable cheap hardware timer:

$ ./conf_examples/zaptel.conf.x100p.sample $ ./conf_examples/zapata.conf.x100p.sample

Digium/Clone T100P EXAMPLE, also works for TE4xxp cards

$ ./conf_examples/zaptel.conf.t100p.sample $ ./conf_examples/zapata.conf.t100p.sample

Test Asterisk:

$ asterisk -vvvvvvvvvvvvvvvvvvvvvvvvvvvvgc #(to see if Asterisk runs) > core show version > dahdi show status > core show application meetme > stop now

- FOR Sounds asterisk run the following steps

$ cd /usr/src/ $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-ulaw-current.tar.gz $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-gsm-current.tar.gz $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-ulaw-current.tar.gz $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz $ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz

- Set the sounds in place

$ cd /var/lib/asterisk/sounds $ tar xzf /usr/src/asterisk-core-sounds-en-gsm-current.tar.gz $ tar xzf /usr/src/asterisk-core-sounds-en-ulaw-current.tar.gz $ tar xzf /usr/src/asterisk-core-sounds-en-wav-current.tar.gz $ tar xzf /usr/src/asterisk-extra-sounds-en-gsm-current.tar.gz $ tar xzf /usr/src/asterisk-extra-sounds-en-ulaw-current.tar.gz $ tar xzf /usr/src/asterisk-extra-sounds-en-wav-current.tar.gz

- Grab parking file, and convert audio to native formats

$ wget http://download.vicidial.com/conf/conf.gsm $ sox conf.gsm conf.wav $ sox conf.gsm -t ul conf.ulaw $ cp conf.gsm park.gsm $ cp conf.ulaw park.ulaw $ cp conf.wav park.wav $ cd /var/lib/asterisk $ ln -s moh mohmp3 $ mkdir mohmp3 $ cd mohmp3 $ rm CHANGES* $ rm LICENSE* $ rm .asterisk* $ mkdir /var/lib/asterisk/quiet-mp3 $ cd /var/lib/asterisk/quiet-mp3

- for SVN 2.2.0 trunk: ( There are other options but this gives you the latest version)

$ mkdir /usr/src/astguiclient $ cd /usr/src/astguiclient $ svn checkout svn://svn.eflo.net:43690/agc_2-X/trunk $ cd trunk $ perl install.pl

Once in Perl Follow these steps:


 * manual configuration y
 * press enter until you get to webroot and set that to the following:
 * press enter through to the Sample configuration files and set that to 'y'
 * press enter through to the end of the script

- To change root mysql password

$ mysqladmin -u root password YOURNEWPASSWORD

- Dump vicidial database

$ mysql -p (enter the mysql root user's password you set earlier) > CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; > GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234'; > GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234'; > use asterisk; > \. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql > \. /usr/src/astguiclient/trunk/extras/first_server_install.sql > \. /usr/src/astguiclient/trunk/extras/sip-iax_phones.sql > quit

- Add my.cnf :

$ cd /etc/mysql/ $ wget http://download.vicidial.com/ubuntu/ubuntu-my-vici.cnf $ mv ubuntu-my-vici.cnf my.cnf $ /etc/init.d/mysql restart $ /usr/share/astguiclient/ADMIN_update_server_ip.pl --old-server_ip=10.10.10.15 $ /usr/share/astguiclient/ADMIN_area_code_populate.pl $ cp /usr/src/astguiclient/trunk/extras/performance_test_leads.txt /usr/share/astguiclient/LEADS_IN/ $ /usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl --forcelistid=107 --forcephonecode=1

- Setup Crontab

$ crontab -e

Add the following lines: (Found these on the forum, couldnt get the original to work (Hour format error?)

28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f 29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f 30 0 * * * /usr/bin/find / -maxdepth 1 -name "screenlog.0*" -mtime +4 -print | xargs rm -f 33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl 50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
 * 1) remove old vicidial logs and asterisk logs more than 2 days old
 * 1) fix the vicidial_agent_log once every hour and the full day run at night
 * 1) uncomment below if using QueueMetrics
 * 2) */5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check


 * 1) updater for VICIDIAL hopper
 * * * * * /usr/share/astguiclient/AST_VDhopper.pl -q

1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug --postal-code-gmt
 * 1) adjust the GMT offset for the leads in the vicidial_list table

3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl
 * 1) optimize the database tables within the asterisk database

2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl
 * 1) VICIDIAL agent time log weekly summary report generation


 * 1) roll logs monthly on high-volume dialing systems
 * 2) 30 1 1 * * /usr/share/astguiclient/ADMIN_archive_log_tables.pl


 * 1) uncomment below if using Vtiger
 * 2) 1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet

0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl --MIX 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl 1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3
 * 1) recording mixing/compressing/ftping scripts
 * 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
 * 2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --MP3


 * 1) kill Hangup script for Asterisk updaters
 * * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl


 * 1) updater for voicemail
 * * * * * /usr/share/astguiclient/AST_vm_update.pl


 * 1) updater for conference validator
 * * * * * /usr/share/astguiclient/AST_conf_update.pl

11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q
 * 1) flush queue DB table every hour for entries older than 1 hour

2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl
 * 1) reset several temporary-info tables in the database


 * 1) remove old recordings more than 7 days old
 * 2) 24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f


 * 1) Reboot nightly to manage asterisk issues and memory leaks - uncomment if issues arise
 * 2) 30 6 * * * /sbin/reboot


 * 1) remove text to speech file more than 4 days old
 * 2) 20 0 * * * /usr/bin/find /var/lib/asterisk/sounds/tts/ -maxdepth 2 -type f -mtime +4 -print | xargs rm -f

(ctrl+x and the Y to save)

$ cd /etc/init.d/ $ wget http://download.vicidial.com/ubuntu/vicidial $ chmod +x vicidial $ update-rc.d -f vicidial defaults

$ nano /etc/apache2/sites-available/default (add the following lines, Added right before  )

Alias /RECORDINGS/ "/var/spool/asterisk/monitorDONE/"  Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all  Forcetype application/forcedownload 

(ctrl+x and the Y to save)

$ chmod 0777 /var/spool/asterisk/monitorDONE/ $ /etc/init.d/apache2 restart

$ nano /etc/fstab (add the following line to the end of the file)

tmpfs /var/spool/asterisk/monitor tmpfs rw 0 0

(ctrl+x and the Y to save)

$ shutdown -r 0 (Once system reboots open Terminal and login)

$ sudo su $ screen -ls (should show at least 6 screens, one of which should be asterisk)

For asterisk CLI:

$ sudo su $ asterisk -rvvvvvvvvvvvvvvvv

In a web browser, go to (http://YOUR_SERVER_IP_ADDRESS/vicidial/admin.php) to see if everything is working. You should also reboot at this point to make sure everything will start back up properly.

(If you get this Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 19922944 bytes) in /var/www/vicidial/admin.php on line 26101 Go to nano /etc/php5/apache2/php.ini and search for memory_limit = and change to 32M ) Then restart Apache $ /etc/init.d/apache2 restart

From here on you should follow the tutorials in the VICIDIAL Manager Manual(available at eflo.net)

- For more Security

$ ln -s /dev/null /var/www/vicidial/project_auth_entries.txt $ ln -s /dev/null /var/www/agc/vicidial_auth_entries.txt $ ln -s /dev/null /var/www/agc/astguiclient_auth_entries.txt $ ln -s /dev/null /var/www/vicidial/admin_changes_log.txt $ ln -s /dev/null /var/www/agc/vicidial_debug.txt

- Change the WWW writable in the admin.php system settings to "0" - Change the default admin user "6666" or it's password from the default - Change the Default secret(password) for the default SIP and IAX accounts that are set up (admin.php -> Admin, Phones and Servers as "Conf File Secret") - Change the default password for the Asterisk manager connection in manager.conf then change it in the Server modification screen - Change the default password for the mysql cron user in mysql and change it to match in /etc/astguiclient.conf on each server - Possibly use static IP addresses for the IAX/SIP conf account entries - Change the default port for Apache in httpd.conf from 80 to something else - Change the default port for IAX in iax.conf from 4569 to something else - Change the default control port for SIP in sip.conf from 5060 to something else - Use a firewall to route access using different port numbers or restricting connection by VPN or set IP addresses - to set time :sudo dpkg-reconfigure tzdata

For changing your mysql password or installing a program that has trouble with your password : Follow these instructions: As the root user you need to clear the password for the root mysql user then install mtop, then set it back...

1. $ sudo bash (naughty way to get a root shell)

2. # /usr/bin/mysqladmin -u root -p password '' (that's two single quotes, then put your mysql root password in)

3. # apt-get install (install mtop)

4. # /usr/bin/mysqladmin -u root -p password 'yourpassword' (set the mysql root user password back to 'yourpassword')