Asterisk for Raspberry Pi on ArchLinux: Difference between revisions
No edit summary |
|||
Line 63: | Line 63: | ||
</pre> | </pre> | ||
== vi to vim = | == vi to vim == | ||
<pre> | <pre> | ||
pacman -R vi | pacman -R vi |
Revision as of 02:16, 26 October 2012
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 SD Card
Using Win32DiskImager and the latest version of Arch Linux ARM from Rasberry Pi write the image to the SD card.
Once the image is written insert the Sd card into the Rasberry Pi and boot. The device will get an IP address from DHCP.
Expand Parition
Now that the device has booted log on and change the default partiion from 2 GB to the maximum partiion of your SD card.
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
Once the rPi has rebooted
resize2fs /dev/mmcblk0p2 reboot
Swap File
As the rPi has limited RAM, either 256 or 512 depending on your version we'll creat a swap file to allow appliction to use higher memory if required.
I would recommend allocating the size of the swap file to be that equal to the RAM size.
fallocate -l 256M /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile
The swap file is now active. We now need to ensure that it is used at boot.
vi /etc/fstab <pre> add the line to the file <pre> /swapfile none swap defaults 0 0
Update OS
pacman -Syu reboot
Utilities
Install utilities to help with setup/administration
# pacman -S initscripts vim mlocate zip unzip
vi to vim
pacman -R vi ln -s /usr/bin/vim /usr/bin/vi
Create ll alias
vi /root/.profile <pre> add the line <pre> alias ll="ls -la"
= Enable Sound Card =
vi /etc/rc.conf <pre> add the line <pre> MODULES=(snd-bcm2835)
Regional settings
vi /etc/locale.gen (enable all AU and US, 4 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 hwclock (remove) ntpdate (add)
Edit hostname 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