Asterisk for Raspberry Pi on ArchLinux: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 49: Line 49:
   # ln -s /usr/bin/vim /usr/bin/vi
   # ln -s /usr/bin/vim /usr/bin/vi


   # vim /root/.profile
   # vi /root/.profile
         alias ll="ls -la"
         alias ll="ls -la"


enable sound card in Linux
enable sound card in Linux
   # vim /etc/rc.conf
   # vi /etc/rc.conf
         MODULES=(snd-bcm2835)
         MODULES=(snd-bcm2835)


Regional settings
Regional settings
   # vim /etc/locale.gen (enable all AU and US lines)
   # vi /etc/locale.gen (enable all AU and US lines)
   # vim /etc/rc.conf
   # vi /etc/rc.conf
   # locale-gen
   # locale-gen


Line 69: Line 69:
   # ntpdate ntp.bri.connect.com.au
   # ntpdate ntp.bri.connect.com.au


   # vim /etc/rc.conf
   # vi /etc/rc.conf
remove hwclock
remove hwclock
         add ntpdate
         add ntpdate


Edit hostnamer and network settings
Edit hostnamer and network settings
   #  vim /etc/hostname
   #  vi /etc/hostname
   #  vim /etc/hosts
   #  vi /etc/hosts


   #  vim /etc/dhcpcd.conf
   #  vi /etc/dhcpcd.conf
           add line: nohook resolv.conf
           add line: nohook resolv.conf
         remove line: nohook lookup-hostname
         remove line: nohook lookup-hostname
Line 83: Line 83:


change IP address details
change IP address details
   # vim /etc/conf.d/network
   # vi /etc/conf.d/network


interface=eth0
interface=eth0
Line 91: Line 91:
gateway=192.168.0.254
gateway=192.168.0.254


   # vim /etc/systemd/system/network.service
   # vi /etc/systemd/system/network.service


[Unit]
[Unit]
Line 117: Line 117:
   # reboot
   # reboot


   #  vim /etc/resolv.conf
   #  vi /etc/resolv.conf
domain klaverstyn.com
domain klaverstyn.com
search klaverstyn.com
search klaverstyn.com
Line 141: Line 141:


Set asterisk service to start automatically
Set asterisk service to start automatically
   # vim /etc/rc.conf
   # vi /etc/rc.conf
   add asteirsk to DEAMONS=
   add asteirsk to DEAMONS=


Line 158: Line 158:
   # pacman -S apache php-apache php php-gd  
   # pacman -S apache php-apache php php-gd  


   # vim /etc/httpd/conf/httpd.conf
   # vi /etc/httpd/conf/httpd.conf
         AllowOverride All
         AllowOverride All
         DirectoryIndex index.php index.html index.htm index.html.var
         DirectoryIndex index.php index.html index.htm index.html.var
Line 164: Line 164:
   # systemctl enable httpd.service
   # systemctl enable httpd.service


   # vim /etc/php/php.ini
   # vi /etc/php/php.ini
       uncomment
       uncomment
           extension=mysqli.so
           extension=mysqli.so
           extension=mysql.so
           extension=mysql.so


   # vim /etc/httpd/conf/httpd.conf
   # vi /etc/httpd/conf/httpd.conf
           LoadModule php5_module modules/libphp5.so (add)
           LoadModule php5_module modules/libphp5.so (add)
           Include conf/extra/php5_module.conf      (add)
           Include conf/extra/php5_module.conf      (add)
Line 176: Line 176:
           AddHandler application/x-httpd-php .php  (add)
           AddHandler application/x-httpd-php .php  (add)


   # vim /etc/httpd/conf/mime.types
   # vi /etc/httpd/conf/mime.types
           application/x-httpd-php5 php php5
           application/x-httpd-php5 php php5
    
    

Revision as of 01:54, 26 October 2012

Note: Work In Progress

These instructions work for the Raberry Pi B-512 version with 512 MB RAM and not the 256MB version. You can follow these instruction for the 256MB version but you will have to skip the perl modules which is used for fax2mail and Google's text to speech.

If you don't want to follow these instuctions and would prefer to download an image you can do so by downloading the image from Asterisk for Rasberry Pi Image.

The following instructions are based on Arch Linux ARM (archlinux-hf-2012-09-18.zip)

Write image to sdcard and boot Rasberry Pi.

expand sdcard to use full capacity
  #  fdisk /dev/mmcblk0
     d (delete)
     2 (partition 2)
     n (new)
     p (primary partition)
     2 (partition 2 as previously deleted)
     enter (accept default start sector)
     enter (accept default end sector)
     w (write changes)

  # reboot

  # resize2fs /dev/mmcblk0p2
  # reboot

create swap file
  # fallocate -l 256M /swapfile
  # chmod 600 /swapfile
  # mkswap /swapfile
  # swapon /swapfile

  # vi /etc/fstab
       /swapfile none swap defaults 0 0  (add)



update operating system
  # pacman -Syu
  # reboot

Install utilities to help with setup/administration
  # pacman -S initscripts vim mlocate zip unzip


change vi to vim
  # pacman -R vi
  # ln -s /usr/bin/vim /usr/bin/vi

  # vi /root/.profile
         alias ll="ls -la"

enable sound card in Linux
  # vi /etc/rc.conf
        MODULES=(snd-bcm2835)

Regional settings
  # vi /etc/locale.gen (enable all AU and US lines)
  # vi /etc/rc.conf
  # locale-gen

Time Synchronisation
  # cp /usr/share/zoneinfo/Australia/Brisbane /etc/localtime

  # pacman -R openntpd

  # pacman -S ntp
  # ntpdate ntp.bri.connect.com.au

  # vi /etc/rc.conf
	remove hwclock
        add ntpdate

Edit hostnamer and network settings
  #  vi /etc/hostname
  #  vi /etc/hosts

  #  vi /etc/dhcpcd.conf
           add line: nohook resolv.conf
        remove line: nohook lookup-hostname


change IP address details
  # vi /etc/conf.d/network

	interface=eth0
	address=192.168.1.1
	netmask=255.255.255.0
	broadcast=192.168.0.255
	gateway=192.168.0.254

  # vi /etc/systemd/system/network.service

	[Unit]
	Description=Network Connectivity
	Wants=network.target
	Before=network.target

	[Service]
	Type=oneshot
	RemainAfterExit=yes
	EnvironmentFile=/etc/conf.d/network
	ExecStart=/sbin/ip link set dev ${interface} up
	ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
	ExecStart=/sbin/ip route add default via ${gateway}
	ExecStop=/sbin/ip addr flush dev ${interface}
	ExecStop=/sbin/ip link set dev ${interface} down

	[Install]
	WantedBy=multi-user.target


  # systemctl disable dhcpcd@eth0.service
  # systemctl enable network.service

  # reboot

  #  vi /etc/resolv.conf
	domain klaverstyn.com
	search klaverstyn.com
	nameserver 192.168.13.1


install required packages for asterisk
  # pacman -S gcc make hgsvn libxml2 libnewt sqlite subversion mysql spandsp speex
  # systemctl enable mysqld.service
  # systemctl start mysqld.service


secure mysql
  # /usr/bin/mysql_secure_installation

stop services to free memory
ensure correct time
  # systemctl stop ntpd.service
  # systemctl stop mysqld.service

install asterisk


Set asterisk service to start automatically
  # vi /etc/rc.conf
  add asteirsk to DEAMONS=


Install Sendmail
  # pacman -R heirloom-mailx
  # rm /etc/mail.rc.pacsave
  # pacman -S ssmtp
  # vi /etc/ssmtp/ssmtp.conf
          mailhub=192.168.13.3
          hostname=rpi.klaverstyn.com
          FromLineOverride=yes


install Apache, PHP and aCDR
  # pacman -S apache php-apache php php-gd 

  # vi /etc/httpd/conf/httpd.conf
         AllowOverride All
         DirectoryIndex index.php index.html index.htm index.html.var

  # systemctl enable httpd.service

  # vi /etc/php/php.ini
       uncomment
          extension=mysqli.so
          extension=mysql.so

  # vi /etc/httpd/conf/httpd.conf
          LoadModule php5_module modules/libphp5.so (add)
          Include conf/extra/php5_module.conf       (add)
          TypesConfig conf/mime.types               (uncomment)
          MIMEMagicFile conf/magic                  (uncomment)
          AddHandler application/x-httpd-php .php   (add)

  # vi /etc/httpd/conf/mime.types
          application/x-httpd-php5		php php5
  

  # systemctl start httpd.service

Note: The web root is /srv/http/


Backup Script
  # pacman -S smbclient



(perl requires ram, ensure swapfile)
google text to speech
  # pacman -S perl-yaml libyaml perl-libwww sox mpg123
  # perl -MCPAN -e "install Bundle::LWP"
  # perl -MCPAN -e "install CGI::Util"


fax2mail
  # yum -y install perl cpan libyaml perl-YAML

  # wget http://search.cpan.org/CPAN/authors/id/R/RO/ROSCH/mime-construct-1.11.tar.gz
  # tar xzvf mime-construct-1.11.tar.gz
  # cd mime-construct-1.11
  # perl Makefile.PL
  # make install 

  # cd
  # perl -MCPAN -e "install Bundle::LWP"
  # perl -MCPAN -e "install Proc::WaitStat"
  # perl -MCPAN -e "install MIME::Types"





reference:
https://wiki.archlinux.org/index.php/Systemd
https://wiki.archlinux.org/index.php/Configuring_Network
https://wiki.archlinux.org/index.php/Beginners%27_Guide
https://wiki.archlinux.org/index.php/LAMP#PHP