Monday, December 18, 2006

Upgrading mt-daapd to firefly

Ever since I ordered the soundbridge I spent a lot of time on forums about mt-daapd and the soundbridge. I found out that the pinnacle soundbridge (available in my country) does not work with the mt-daapd music server I am currently running (0.2.4). I decided not to wait until the SB arrives but to update my server with a more uptodate version of the server. So that if the SB arrives it is truly plug and play. And not "plug -updating my server- and play".

Unfortunately it did not go as smooth as I hoped it would go. First I downloaded the most recent version of firefly, firefly is the software formally knows as mt-daapd. Version 0.2.4 is the last official stable version of firefly. Unfortunately this version may not be compatible with the Pinnacle soundbridge, with the ROKU soundbrigde it should work fine.
So I decided to upgrade to a development version You can find these development "nightly" versions here. As I am still running a ubuntu dapper Linux server, I downloaded the Debian (.deb) package. And typed
sudo dpkg --install mt-daapd_0.9-svn-1450_i386(2).deb
Unfortunately it gave back a list with all kinds of packages that were missing. After an hour I managed to install all the missing packages. And tried another install of the firefly server.

Although the installation went smooth It still did not work. Mt-daapd was clearly running (find all the processes running on your server by typing "top") but it did not show up in my I-tunes. After a while I found out the problem was that, although I re-installed the software, it was still using my old mt-daap.conf file. after overwriting the the old mt-daapd.conf file and restarting the server it showed up in I-tunes and seemed to work perfectly.

I was pretty proud that I all got it working. Unfortunately my mt-daapd.log file was showing loads of errors.
2006-12-17 15:09:58 (00004000): Firefly Version svn-1450: Starting with debuglevel 2
Starting rendezvous daemon
Starting signal handler
Signal handler started
Error: enum_begin failed (error 1): Misc SQL Error: no such table: config
Can't get db version. New database?
Initializing database
Error: enum_begin failed (error 1): ?
Starting web server from /usr/share/mt-daapd/admin-root on port 3689
Registering rendezvous names
Serving 1234 songs. Startup complete in 4 seconds
The database errors confused me, I could not remember that I ever installed a database to support mt-daapd. After a while I found out that firefly was dependend on sqlite database. So I installed the sqlite database
sudo apt-get install sqlite
. After re-installing firefly it finally stopped showing all the errors.

The updated software has some really nice new features, like making playlists with the web interface without restarting the server and it even has a java-applet to play you music from your browser. But more about this in the next post.
From now on I will sum up the links to pages that I found usefull for the topic of the post.

download firefly development
firefly forum
rokulab soundbridge forums

Friday, December 08, 2006

Ordered the soundbridge

Since I am so happy with my mtdaapd server. I decided to buy a Roku soundbridge. With the soundbridge I am able to listen to my music over my network without having to turn my pc on and it is compatible with the daap-music server installed on my ubuntu linux server. It looks like this
The soundbridge is capable of streaming my music and I can also listen to many digital radio station. Once I got it I will write a review here. Check the website here.

Tuesday, December 05, 2006

Play counter mt-daapd part 2

Yesterday I told about the counter of my daap-server. I altered the code a bit and now it is smaller.
$myFile = "mt-daapd.log";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);

$address = array('/172.19.3.22/','/172.19.3.19/','/172.19.3.18/') ;
$name = array(john, Joe, Lisa);
for ( $counter = 0; $counter <= 2; $counter += 1) {

if (preg_match_all($address[$counter], $theData, $user)) {
echo $name[$counter]," ", count($user[0]), "
";
} else {
echo $name[$counter]," did not play any songs";
}
}
?>

Monday, December 04, 2006

mt-daapd play counter

Hello,

Since a couple of months I use the mt-daapd software to make my server share my music collection over my local network. I posted about this a while ago. Since I live with 8 people in a house I was very curious if anybody besides me was using the music server, and how often do they play songs. I found out that the admin pages show how many songs are played but not who has played them.

than I found out that the daap-server could keep a log of all actions going on. The log looks like this
2006-12-02 23:17:48: Session 0: Streaming file help.mp3' to 172.19.3.22 (offset 0)
2006-12-02 23:17:49: Session 0: Streaming file 'yesterday.mp3' to 172.19.3.22 (offset 0)
2006-12-02 23:19:54: Session 0: Streaming file 'imagine.mp3' to 172.19.3.22 (offset 0)
Since I installed my php server I thought it must be possible to write some php code to count the ip-adresses of the different users. It took a while but finally it worked.
The php code is probably not as efficient as possible. If you know an easier way please comment:

?php
$myFile = "mt-daapd.log";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);

if (preg_match_all("/172.19.3.22/", $theData, $john)) {
echo "John ", count($john[0]), "
";
} else {
echo "John did not play any songs";
}
if (preg_match_all("/172.19.3.18/", $theData, $jef)) {
echo "jef ", count($jef[0]), "
";
} else {
echo "Jef did not play any songs";
}

if (preg_match_all("/172.19.3.19/", $theData, $lisa)) {
echo "Lisa ", count($lisa[0]);
} else {
echo "Lisa did not play any songs";
}
?>

mysql phpmyadmin

Hello
Actually I promised to talk about installing mysql and phpmyadmin. Unfortunately it has been a while ago since I installed these packages and I do not remember much of it. Since there are so many really good howto`s on these two packages I will not discuss them here. If you encounter problems please visit ubuntuforums.org if you have trouble installing either-one of the packages these people can certainly help you.

Friday, November 17, 2006

Installing php5

It has been a while since my last post. In this post I want to talk about installing php5. I start with
sudo apt-get install php5
Next to make it work with apache2
sudo apt-get install libapache2-mod-php5
And now restart the apache2 webserver with
sudo /etc/init.d/apache2 restart
Now test if it all works. the DocumentRoot is standard set to the directory "/var/www" So all php files you produce must be placed into this directory. To change the DocumentRoot location type
sudo vi /etc/apache2/sites-available/default
and change the DocumentRoot on line 5 in something else.I decided to keep the DocumentRoot to /var/www. Now go to this directory and make a test.php file with
sudo touch test.php

edit the file with
sudo vi test.php
now insert the following line into the new file
<?php phpinfo(); ?>
now with your browser go to
yourserver/test.php
if everything is installed correct you`ll see the php info page. Make sure so remove this file if you open your server to the public as it may pose a security risk. For more information visit ubuntu dapper wiki.

Next post about mysql and phpmyadmin

Wednesday, October 11, 2006

Apache webserver

Installing the apache2 webserver was very easy
sudo apt-get install apache2
Now it should work. To test if the server is installed correct just type the ip address of your server into the address-bar of your browser and you should be seeing something like this
"It Worked! The Apache Web Server is Installed on this Web
Site!

"If you can see this page, then the people who own this
domain have just installed the Apache Web server software
successfully. They now have to add content to this directory
and replace this placeholder page, or else point the server
at their real content.
---
"If you are seeing this page instead of the site you expected,
please contact the administrator of the site involved. (Try
sending mail to .) Although this site is
running the Apache software it almost certainly has no other
connection to the Apache Group, so please do not send mail
about this site or its contents to the Apache authors. If you
do, your message will be ignored.
---"


For more information on installing the apache2 webserver go to apache.org
Please note that I did not pay any attention to security of the server. This is because my server is still behind a firewall. So if you intend to host anything on the webserver please do some more research than I did.

Wednesday, September 20, 2006

Creating playlists

It has been a while since my last post. In this post I will show how I created playlists on my I-tunes daap server. Actually this one is very easy. just type:
sudo vi /etc/mt-daapd.playlist
Now you can add playlists for instance
"new this month" { Date after 4 weeks ago }
Now restart the daap-server and you will see the playlist listed in I-tunes.
The mt-daapd.playlist file is very well commented with a lot of examples. here are some more examples of smart playlists you can add to your server.
Next posts will be about setting up a (apache)webserver with php and mysql.

Thursday, August 24, 2006

I-Tunes server part 2

Now I am ready to install the mt-daapd software. The guide provided in the mt-daapd wiki will run you through the steps of installing the mt-daapd software on Ubuntu. I decided to do it a bit different. Since Ubuntu is a debian-based distro I tried installing it with the debian package found here I downloaded the ".deb" file to my (windows)desktop PC.

Now I have to copy the file to the server to install. Luckily I installed a samba server before. So I copied the package to the shared folder on the server. Next I logged on to the server went to the location of the file and typed:
sudo dpkg --install mt-daapd_0.2.4-1_i386.deb
Next step: open the configuration file:
sudo vi /etc/mt-daapd.conf
I did not change a lot in this file. I changed the path to my music, and changed the server-name. Now I was ready to start the service
sudo mt-daapd start
Now start I-tunes and your server should be there listed as shared music. Now you should also be able to access the daap-server through a web-interface. Startup your browser and type your servername or IP Address of the server followed by a colon (:) and then 3689 (port 3689). You can find out the IP-address of your server with the command
ifconfig

So for my server it would be
172.19.3.13:3689
Now login with username: admin and password: mt-daapd (you can change this in the mt-daapd.conf file). Now you`ll see a website where you can monitor your server and change some things...

next post I will explain how I added and changed playlists.

I-Tunes server part 1

In this post I will write about setting up a daap-server . With this server you`ll be able to stream your music collection to I-tunes and some other music-programs. There are different projects working with the DAAP (digital audio access protocol). Check here for an overview of the projects.

On my ubuntu-server I am going to work with the mt-daapd software. You can find the homepage of this project here.

basically I just started with following the steps out of the quick-start Ubuntu guide. The first step in the guide is: install non-standard packages. the following packages need to be installed
libsqlite0
libsqlite0-dev
gawk
gcc
libid3tag0-dev
libgdbm-dev
So type
sudo apt-get install libsqlite0
And do this for every package. Now you should be ready to install the server.
I will explain how I did this in the next post...

Friday, August 18, 2006

Remote Access

Until now I have been working on the server like a desktop. So the server has a screen and a keyboard connected to it. This is not an ideal situation. I rather connect to it from my desktop machine, so that I don`t need an extra screen and keyboard to work on the server. Another benefit is that the machine is pretty noisy and now I can just put it up the ceiling in the hallway where it doesn`t bother me or any of my flat-mates.

So to remotely connect to the machine I`ll use the software openSSH. Simply install this with:
sudo apt-get install openssh-server
Test it with:
ssh localhost
Stop the ssh server with:
sudo /etc/init.d/ssh stop
Start ssh server with:
sudo /etc/init.d/ssh start
Restart the ssh server with:
sudo /etc/init.d/ssh restart
To connect to my server from my windows desktop I use the program "putty" you can download this software here It is a small program that works very easy. Just fill in the IP-Address of your server and select SSH. Now press "open" and a screen should pop up where you can login to your server. With command "exit" you`ll close the connection to the server. If you are in a Local Area Network and you want to remotely access your server from outside the network you should make sure that port 22 is forwarded to the server. You should be able to change this somewhere on your router.

The last thing to do before moving the machine to the hallway is making sure that it will boot without a keyboard connected. You can change this in your BIOS. On my machine I first had to enable "the power on password" Option. After that I was able to enable the "Server Boot" option, which makes it boot without the keyboard connected.

check this site for a detailed totorial on installing openssh.

Next time I will post about installing an openDaap itunes server..

Thursday, August 17, 2006

Samba part 2

In the first part about Samba I talked about installing Samba and a way to edit the configuration file smb.conf. In this post I will talk about the steps I took to get it all working. Please note that I am not a linux-expert. So if something works for me it is not guaranteed that it will work for you too.
The first thing I did is add a user to samba. In order to add a user to samba you should first add the user for the server itself. So type
sudo useradd john
now you can add user "john" to samba
sudo smbpasswd -a john
the "-a" parameter means add user. To delete the user type:
sudo smbpasswd -x john
Now that we added the user the only thing left is configure samba. Type:
sudo vi /etc/samba/smb.conf
with editing the existing configuration-file I did not get it working. So decided to start with an empty file and build it from scratch. With some help of examples on the net I ended up with this:

[global]
workgroup = MSHOME
server string = %h
security = user
printable = no
read only = no

[homes]
browseable = no
writable = yes

[music]
path = /mnt/music
writable = yes
browsable = yes
This did the trick for me. Now I am able to access the directory "/mnt/music". The only problem I encountered that, although browsable is set to "yes", I was not able to write to this location from my windows client. I found out that this had to do with the permission settings in Unix. You can change these permissions with the command CHMOD. I typed
sudo chmod a=rwx /mnt/music/
now the directory is readable(r), writable(w) and executable(x) for everyone(a). Check here for a very clear tut on the CHMOD command. To start, stop, restart samba type:
sudo /etc/init.d/samba start
sudo /etc/init.d/samba stop
sudo /etc/init.d/samba restart

Next post will be about connecting remotely to the server with "ssh". After that I will post about setting up a DAAP server to serve music to I-tunes with the "(open) digital Audio Access Protocol".

Wednesday, August 16, 2006

Samba part 1

So it is time to put some music into the server. With samba you are able to share the data on the server with windows-computers connected to your network. Check the samba web-site here

Installing the server is very simple with ubuntu server. Just type
sudo apt-get install samba
For me this went perfectly smooth. Now we can start configuring the samba server. You configure the samba server by editing the "smb.conf" file. The ubuntu-server user guide advises to make a copy of the smb.conf file before you start editing. You do this by giving the command
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.original
Ok now we should edit the "smb.conf" file. For editing files I`ll use the program "vi". you start editing the smb.conf file with the command
sudo vi /etc/samba/smb.conf
now you see the contents of the file on the screen. I used the following commands to change the file and save it: With the arrow keys you can move up and down in the file. To edit the file press the "insert" key and start typing. To save the file: exit the editing mode by pressing the escape key. now press ":". At the bottom of your screen you should now see a colon. With the command "w" you`ll save the changes you made. With the command "q"you`ll exit vi ("q!" exits without saving). here you`ll find a list with all the basic commands you need for vi editor.
If you`re not sure what you`re doing first try it without sudo in front of the vi command. Note that you cannot save you`re changes now and have to exit with ":" followed by "q!".

Next time I will finish configurating the smb.conf file and add shares and users...

Monday, August 14, 2006

Mounting the harddisk

So the server is up and running. First thing I want to do now is find my secondary harddisk and find out if all the data on it is accessible. All files in a Unix-system are arranged in a tree. All the files can be spread over different devices such as harddisks, cd-rom, usb device. With the command "mount" you can attach the file system found on a device to the file tree. So I gave the command:
sudo mount -t ext3 /dev/hda1 /home/data
With this command I told the server to mount my harddrive with the "ext3" file-system. The name/location is "/dev/hda1/" (note that this is somehow a different name than when the harddisk was connected to my desktop-pc). The "/home/data" at the end is the location in the file-tree where I can find the data after mounting the disk.
After this I went to the directory to check if it was mounted correctly
cd /home/data
And there it is. All data is accesible.

Next time I will work on samba to share all the data over a windows-network.

Sunday, August 13, 2006

Installing server

So I am ready to start installing the server. I chose for the ubuntu-server edition. You can download the software here. I restarted the pc and made sure it booted from CD (you can change the boot sequence in the BIOS, access the BIOS by pressing a "specific" key during startup). I chose to install just the minimal server. You can also choose to install a LAMP server with linux, Apache (webserver), Mysql (database) and PHP installed automatically. Although I want to have all these features on my server I rather install them myself later.

The first question in the installation proces that I had to answer was where I wanted to install ubuntu-server. I installed two harddrives in my system. One of 10 gig and one of 320 gig. I chose to install the software on the small one. And to keep the large one for data storage. After the choosing the location the only difficult question was whether I wanted to use LVM (logical volume manager). I decided not to use LVM. For me it is not really clear what LVM does. I am not sure if I made the right decision but I`ll probably find out later. I just try to keep it as simple as possible. check this forum to see an answer of someone with the same question. After this, the installation proces was very easy and in less then 15 minutes I rebooted the system and the server was up and running...

Friday, August 11, 2006

Copying data

As posted before, I wanted to copy data from a removable usb-harddrive to the harddisk for the linux-server. So I connected the USB harddrive to my pc running Ubuntu. At that time something went wrong and I was logged out of Ubuntu and was not able to log on again. I couldn`t really figure out what the problem was. Although I was still able to log onto a terminal-session I could not get it up and running again.

So the only thing left for me was reboot the pc and run Windows. Browsing in some newsgroup I found a solution for my problem. with the tool "fs-driver" (fs-driver.org)I was able to copy the data of the usb harddrive to the ext3 disk.

So now I can finally start working on the linux-server...

Storage

The next step should be installing the software on the machine. But in this case it is a bit different. I borrowed a Removable Harddisk from a friend with a lot of data. The only free space I had was on my brand new harddisk. Unfortunatley I did not have the server up and running yet and I had to return the removable harddisk the next day. So I had to copy the data onto the harddisk using my desktop pc.

An issue here is that Microsoft Windows uses another file-system than Linux. So formatting the harddisk as NTFS- file system was no option. My first thought was that fat32 file system could be read by both linux and windows. But the problem with fat32 is that the maximum partition-size seems to be 32gig. Luckily I once experimented a bit with a Linux distribution called Ubuntu. Although I had not used this for a long time. I did not really see another option than to format the harddisk with a Linux OS.

So I plugged in the Harddisk and started Ubuntu (5.10). After clicking for a while I couldn`t find a GUI-program to format the disk. So I decided to give a try with the terminal. With help of forums on the internet I found a way.

I gave the comment:
sudo fdisk /dev/hdd
Ubuntu is configured in a way that when you type "sudo" in front of you command it will be run as root-user. I found out the name of the harddisk (/dev/hdd) with help of the GUI of Ubuntu. Of course there is a way to view this in the terminal, but I don`t know how.

here you can find the steps to follow.
I chose to make 1 primary partition.
After this I gave the command
sudo mkfs.ext3 /dev/hdd1

This did the trick for me.

Hardware

To set up a server you need hardware. I am going to use is an old pc of a friend. The machine has a Pentium III 450 processor with 256Mb Ram and a Harddisk of 10gig. One of the main purposes of the server is storage so the 10gig harddisk will not be sufficient. Luckily hard disks are not very expensive these days. So I bought a 320gig harddisk at the local store.

Thursday, August 10, 2006

The start

Setting up a Linux server is something I wanted to do for ages. But somehow I could always come up with something that seemed more important at the time. The main reason to build a server is of course the functionalities of the server. But another reason to set up a linux server is to learn how to work with Linux.

In this Blog I will post about my efforts in setting up the server. Right now I have very little experience with Linux systems. So I`ll probably run into a lot of problems. I will try not only to post about problems I experience, but also about parts that go smooth. I hope that at the end this blog could be of any help for people that want to set up there own linux-server