Asterisk for Raspberry Pi on ArchLinux: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 30: Line 30:
   # pacman -Syu
   # pacman -Syu
   # reboot
   # reboot


Install utilities to help with setup/administration
Install utilities to help with setup/administration
Line 43: Line 42:
         alias ll="ls -la"
         alias ll="ls -la"


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


Regional settings
Regional settings

Revision as of 11:04, 25 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


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

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

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

Regional settings
  # vim /etc/locale.gen (enable en_AU ISO-8859-1)
  # vim /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

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

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

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

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


change IP address details
  # vim /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

  # vim /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



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
  # vim /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 

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

  # systemctl enable httpd.service

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

  # vim /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)

  # vim /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



google text to speech
  # pacman -S perl-libwww sox mpg123
  # perl -MCPAN -e "install Bundle::LWP"
  # perl -MCPAN -e "install CGI::Util"



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