Difference between revisions of "Apache2 to provide streaming audio (MIPSel)"
Line 174: | Line 174: | ||
# run alien -t <debpackage> | # run alien -t <debpackage> | ||
# unpack the tgz into the root of the linkstation. | # unpack the tgz into the root of the linkstation. | ||
+ | |||
+ | [[Category:LS2]] |
Revision as of 23:21, 25 June 2006
(:toc:)
Contents
Overview
I have been using Apache2 with mod_musicindex to provide streaming audio to the various computers around my house and to enable me to access my music collection from work (my ADSL is confiured with static IP and did port forwarding to my laptop). On aquisition of my nice shiny new Linkstation2 it seemed only obvious that I move this functionality to the Linkstation so that I don't have to leave my laptop on all day when I am at work.
Apache Build
Pre-Requisites
- Linkstation2
- mipsel-openlink-052b.zip (from the downloads section and installed as per README).
- mipsel-tools-2.tgz (from the downloads section and inststalled with the install.sh).
- mipsel-screen-1.tgz (from the downloads section and inststalled with the install.sh). (NOT REQUIRED but the compile takes ages and this helps if you get disconnected when it is running).
- /usr/bin/sort extracted from the debian package coreutils-5.2.1
- apache source httpd-2.0.55.tar.gz
This is now enough to compile apache2
Procedure
( I enable ssl to help bypassing content filters at work. I have also enabled proxy which allows me to proxy to internal server resources if they are available (like my laptop running tomcat and some of my development work))
- Extract httpd-2.0.55.tar.gz
- cd httpd-2.0.55
- ./configure --prefix=/mnt/hda/apache --enable-ssl --enable-proxy
- make
- make install
- WAIT AGES
- create an apache user and group in /etc/passwd and /etc/group respectively with the users home set to /mnt/hda/apache
- cd ~apache/conf
- edit httpd.conf to set ServerName to something appropriate set the User and Group directives to apache
- edit /etc/thttpd.conf and change the port to 8080 (I did this to make my life easier accessing the apache instance and also to hide the config interface from the net when I set port forwarding to the linkstation)
- run /etc/init.d/thttpd restart
- Start apache (cd ~apache/bin; ./apachectl start)
- Go to http:/<linkstation>/ and see the apache page.
- Create a start script in /etc/init.d (included below)
- cd /etc/rc.d/rc2.d
- ln -s ../init.d/apache S95apache
- cd /etc/rc.d/rc0.d
- ln -s ../init.d/apache K05apache
- cd /etc/rc.d/rc6.d
- ln -s ../init.d/apache K05apache
That should be a nice little apache2 install which will restart every reboot now.
Apache init script
#!/bin/sh # # apache - startup script for apache # This goes in /etc/init.d and gets run at boot-time. # PATH=/bin:/usr/bin:/sbin:/usr/sbin APACHE_HOME=/mnt/hda/apache if ! [ -x $APACHE_HOME/bin/apachectl ]; then exit 0 fi case "$1" in start) echo "Start services: apache" $APACHE_HOME/bin/apachectl startssl ;; stop) echo "Stop services: apache" $APACHE_HOME/bin/apachectl stop ;; restart) echo "Restart services: apache" $APACHE_HOME/bin/apachectl restart ;; *) echo "usage: $0 { start | stop | restart}" >&2 exit 1 ;; esac exit 0
Build mod_musicindex
Pre-Requisites
- All of the above has been done
- download libapache-mod-musicindex_1.0.2.orig.tar.gz from http://www.parisc-linux.org/~varenet/musicindex/
- obtain required libraries
Required Libraries
I only wanted vobis and mp3 support so this is all I have used. If you figure out all the dependencies for other codecs feel free to add them. The libraries were downloaded from my local debian mirror and I used alien -t <debfile> to convert them to tgz files which were extracted into the root of the link station.
* libid3tag0-0.15.1b.tgz
* libid3tag0-dev-0.15.1b.tgz
* libmad0-0.15.1b.tgz
* libmad0-dev-0.15.1b.tgz
* libogg0-1.1.3.tgz
* libogg-dev-1.1.3.tgz
* libvorbis0a-1.1.2.tgz
* libvorbis-dev-1.1.2.tgz
* libvorbisenc2-1.1.2.tgz
* libvorbisfile3-1.1.2.tgz
Procedure
- Extract libapache-mod-musicindex_1.0.2.orig.tar.gz
- cd libapache-mod-musicindex-1.0.2
- ./configure --with-apxs=/mnt/hda/apache/bin/apxs
- make
- make install
- Add LoadModule musicindex_module modules/mod_musicindex.so near the top of ~apache/conf/httpd.conf
- Add a Directory config for music index to the bottom of ~apache/conf/httpd.conf (see mine below).
- Create a directory ~apache/musicindex and do chmod 0777 ~apache/musicindex (this will be used to cache stuff so I didn't want it on the root filesystem).
- Create a directory ~apache/htdocs/musicindex and copy the contents of /usr/local/share/mod_musicindex/ into it.
- Restart apache
My Directory Config
Alias /music /mnt/hda/share/home_backup/media/mp3 <Directory /mnt/hda/share/home_backup/media/mp3> Options Indexes MultiViews FollowSymlinks AllowOverride Indexes MusicLister On MusicSortOrder album disc track artist title length bitrate freq filetype filename uri MusicFields title artist length bitrate MusicAllowDownload Off MusicAllowStream On MusicAllowSearch On #MusicRssItems Off MusicPageTitle BlackHole #MusicDefaultCss nomadindex.css MusicDefaultDisplay HTML MusicIndexCache file://mnt/hda/apache/musicindex #MusicIceServer [ice.domain.my]:8000 #MusicCookieLife 300 </Directory>
RSync
The home_backup was created from my laptop running Ubuntu after I installed rsync on to the link station. This allows me to regularly back up my laptop and rsync will only copy deltas which saves me loads of time.
- obtain rsync deb package
- run alien -t <debpackage>
- unpack the tgz into the root of the linkstation.