Tuesday, April 7, 2009

Installing and configuring a mpd client


We will use gmpc (Gnome Music Player Client) as an example mpd client. There are many others of course. On the desktop computer, in the Terminal :
  • write "su" and press ENTER
  • enter the root password for the desktop computer
  • write "aptitude update" and press ENTER
  • write "aptitude install gmpc" and press ENTER
  • exit Terminal
Open gmpc (Gnome Music Player Client).

On the upper left side click "Music" and then "Preferences"

Under "Connection" :
  • Name = chose what you like (for example : Alix)
  • Host = 192.168.1.30
  • Port = 6601
  • leave the rest unchanged
  • click "Connect" on the lower right side
  • click "Close" on the lower right side
If you have connected your USB DAC to the Amp and the Alix and if you have entered music (for example FLAC files) into your music library (= the folder /home/your_username/music/mpd_music) you should here music as soon as you add a song to the playlist and click "Play" (or double-click on the song).

Monday, April 6, 2009

Configuring mpd.conf


MPD won't work until you tell it where the media files are. You do that by changing the etc/mpd.conf file on the Alix.

But first, you have to create some folders (which will be used by mpd) on the desktop computer :
  • write "cd /home/your_username/music" and press ENTER
  • write "mkdir mpd_music" and press ENTER
  • write "mkdir mpd" and press ENTER
  • write "cd /mpd" and press ENTER
  • write "mkdir playlists" and press ENTER
Then do the configuration of the mpd.conf file :
  • write "ssh -2 -p 22 root@192.168.1.30" and press ENTER
  • enter the root password of the Alix
  • write "remountrw" and press ENTER
  • write "jed etc/mpd.conf" and press ENTER
  • change the content of this file according to the example text you find in this post.
  • save the file with "Ctrl+x+s" and quit jed with "Ctrl+x+c"
Then restart mpd :
  • write "/etc/init.d/mpd restart
Finally add the user (the one you entered in the mpd.conf file under "user") to the audio group :
  • write "adduser your_username audio" and press ENTER
  • write "remountro" and press ENTER
  • write "exit" and press ENTER (you exit the Alix)
Now, everything should be configured and working on the mpd server side.

Sunday, April 5, 2009

Example mpd.conf


Use the following example as a guide to configure your mpd.conf on the Alix (in particular the text in red). Read this post first !

Nota bene : the important lines are the ones which are uncommented (in red text), i.e. the ones which have no # at the beginning of the line. The lines which have a # at the beginning of the line will be ignored by mpd. The green text is text you have to adapt to your own case (i.e. your own username or your own USB DAC's name).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.

######################## REQUIRED PATHS ########################
# You can put symlinks in here, if you like. Make sure that
# the user that mpd runs as (see the 'user' config parameter)
# can read the files in this directory.
music_directory "/mnt/nfs/mpd_music"
playlist_directory "/mnt/nfs/mpd/playlists"
db_file "/mnt/nfs/mpd/tag_cache"
log_file "/mnt/nfs/mpd/mpd.log"
error_file "/mnt/nfs/mpd/errors.log"
pid_file "/mnt/nfs/mpd/pid"
################################################################


######################## OPTIONAL PATHS ########################
#
# If specified, MPD will save its current state (playlist,
# current song, playing/paused, etc.) at exit. This will be
# used to restore the session the next time it is run.
#
state_file "/mnt/nfs/mpd/state"
#
################################################################


######################## DAEMON OPTIONS ########################
#
# If started as root, MPD will drop root privileges and run as
# this user instead. Otherwise, MPD will run as the user it was
# started by. If left unspecified, MPD will not drop root
# privileges at all (not recommended).
#
user "your_username"
#
# The address and port to listen on.
#
# For privacy, we default to the loopback interface. In Debian, "localhost"
# may resolve to both an IPv4 and an IPv6 address. For MPD 0.13 or earlier,
# it is recommended to only use one or the other.
#
bind_to_address "any"
port "6601"
#
# Controls the amount of information that is logged. Can be
# "default", "secure", or "verbose".
#
#log_level "default"
#
################################################################


########################## PERMISSIONS #########################
#
# MPD can require that users specify a password before using it.
# You may specify one ore more here, along with what users who
# log in with that password are allowed to do.
#
#password "password@read,add,control,admin"
#
# Specifies what permissions a user who has not logged in with a
# password has. By default, all users have full access to MPD
# if no password is specified above, or no access if one or
# more passwords are specified.
#
#default_permissions "read,add,control,admin"
#
################################################################


########################## AUDIO OUTPUT ########################
#
# MPD supports many audio output types, as well as playing
# through multiple audio outputs at the same time. You can
# specify one or more here. If you don't specify any, MPD will
# automatically scan for a usable audio output.
#
# See
# for examples of other audio outputs.
#
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "your_USB_DAC's_name"
device "hw:0,0" # optional
# format "44100:16:2" # optional
#}
#
# An example of an OSS output:
#
#audio_output {
# type "oss"
# name "My OSS Device"
# device "/dev/dsp" # optional
# format "44100:16:2" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
# type "shout"
# name "My Shout Stream"
# host "localhost"
# port "8000"
# mount "/mpd.ogg"
# password "hackme"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
# user "source" # optional
# description "My Stream Description" # optional
# genre "jazz" # optional
# public "no" # optional
#}
#
# Force all decoded audio to be converted to this format before
# being passed to the audio outputs.
#
#audio_output_format "44100:16:2"
#
################################################################


############################# MIXER ############################
#
# MPD needs to know what mixer settings to change when you
# adjust the volume. If you don't specify one here, MPD will
# pick one based on which ones it was compiled with support for.
#
# An example for controlling an ALSA mixer:
#
#mixer_type "alsa"
#mixer_device "default"
#mixer_control "PCM"
#
# An example for controlling an OSS mixer:
#
#mixer_type "oss"
#mixer_device "/dev/mixer"
#mixer_control "PCM"
#
# If you want MPD to adjust the volume of audio sent to the
# audio outputs, you can tell it to use the software mixer:
#
#mixer_type "software"
#
################################################################


######################### NORMALIZATION ########################
#
# Specifies the type of ReplayGain to use. Can be "album" or
# "track". ReplayGain will not be used if not specified. See
# for more details.
#
#replaygain "album"
#
# Sets the pre-amp used for files that have ReplayGain tags.
#
#replaygain_preamp "0"
#
# Enable on the fly volume normalization. This will cause the
# volume of all songs played to be adjusted so that they sound
# as though they are of equal loudness.
#
#volume_normalization "no"
#
################################################################


########################### BUFFERING ##########################
#
# The size of the buffer containing decoded audio. You probably
# shouldn't change this.
#
#audio_buffer_size "2048"
#
# How much of the buffer to fill before beginning to play.
#
buffer_before_play "100%"
#
# Similar options for the HTTP stream buffer. If you hear
# skipping while playing HTTP streams, you may wish to increase
# these.
#
#http_buffer_size "128"
#http_prebuffer_size "25%"
#
################################################################


########################### HTTP PROXY #########################
#
# Specifies the HTTP proxy to use for playing HTTP streams.
#
#http_proxy_host "proxy.isp.com"
#http_proxy_port "8080"
#http_proxy_user "user"
#http_proxy_password "password"
#
################################################################


############################# LIMITS ###########################
#
# These are various limits to prevent MPD from using too many
# resources. You should only change them if they start
# restricting your usage of MPD.
#
#connection_timeout "60"
#max_connections "5"
#max_playlist_length "16384"
#max_command_list_size "2048"
#max_output_buffer_size "8192"
#
################################################################


###################### CHARACTER ENCODINGS #####################
#
# If file or directory names do not display correctly, then you
# may need to change this. In most cases it should be either
# "ISO-8859-1" or "UTF-8". You must recreate your database
# after changing this (use mpd --create-db).
#
filesystem_charset "UTF-8"
#
# The encoding that ID3v1 tags should be converted from.
#
id3v1_encoding "UTF-8"
#
################################################################


######################### OTHER OPTIONS ########################
#
# The metadata types MPD will recognize.
#
metadata_to_use "artist,album,title,track,name,genre,date,composer,performer, disc"
#
# Enable this if you wish to use your MPD created playlists in
# other music players.
#
#save_absolute_paths_in_playlists "no"
#
################################################################

Saturday, April 4, 2009

Installing NFS file sharing


The Alix computer (the MPD server) needs to be able to access the music files (over the network) which are stored on the desktop computer (in the music library).

So we need to install NFS file sharing between the two machines where the desktop computer will be the NFS file server and the Alix computer the NFS file client.

remember : in my example the desktop computer's IP address is 192.168.1.20 and the Alix's 192.168.1.30

On the desktop computer, install the NFS server packages :
  • write "aptitude install nfs-kernel-server nfs-common portmap" and press ENTER
On the Alix computer, install the NFS client packages :
  • write "ssh -2 p 22 root@192.168.1.30" and press ENTER
  • enter the root password
  • write "remountrw" and press ENTER
  • write "apt-get install nfs-common portmap" and press ENTER
  • write "remountro" and press ENTER
  • write "exit" and press ENTER (= leave the Alix computer)
Setting up the NFS server :
For setting up an NFS server, you need to edit /etc/exports.

In this example we will share the following folder on the server with the client 192.168.1.30 : "/home/your_username/music"

remember : "your_username" = same username as on the desktop computer

Create the /music folder (if it doesn't exist yet) :
  • write "cd /home/your_username" and press ENTER
  • write "mkdir music" and press ENTER
Then open the file /etc/exports with your favorite text editor :
(I use "jed". If you don't have jed on the desktop computer, install it with "aptitude install jed")
  • write "jed /etc/exports" and press ENTER
  • add the following text :
/home/your_username/music 192.168.1.30(rw,no_subtree_check,sync)

Save the modification and exit the editor :
  • press "Ctrl+x+s" and then press "Ctrl+x+c"
To (re-)start the NFS server :
  • write "/etc/init.d/nfs-kernel-server restart" and press ENTER

Setting up the NFS client :
We want the Alix computer to mount the NFS share every time it starts up. So we have to modify the /etc/fstab configuration file.
  • write "ssh -2 -p 22 root@192.168.1.30" and press ENTER
  • enter the root password of the Alix
  • write "remountrw" and press ENTER
  • write "jed /etc/fstab" and press ENTER
  • add the following line at the end (and after that press ENTER to have an empty line after this line) :
192.168.1.20:/home/your_username/music /mnt/nfs nfs rw 0 0
  • press Ctrl+x+s
  • press Ctrl+x+c
  • move to the /mnt folder and write "mkdir nfs" and press ENTER
  • write "mount -a" and press ENTER
  • write "remountro" and press ENTER
  • write "exit" and press ENTER (you will leave the Alix computer)

Friday, April 3, 2009

Configuration of the Alix board


During the configuration of the Alix board, don't install it into the enclosure until everything is up an running for at least a couple of days. Use the bubble wrap under the board (suggestion of nyc_paramedic).
























Don't touch the contacts of the Alix board when the power cord is connected to it as this could damage the circuitry. If you are worried about electrostatic discharge damage, touch something which is grounded (a radiator pipe in your house for example) before manipulating the Alix board, although this shouldn't be really necessary.

Then :
  • on the Alix board, insert the CF-card
  • on the Alix board, insert the Ethernet cable in the connector which is nearest to the power connector (connect this cable on its other end to your router)
  • on the Alix board, first connect the power cord to the board's connector and only after that, connect the AC adapter to the wall socket
  • wait approx. 1 minute for the Alix to boot
You need to know the IP address of the Alix board, so do the following (on your desktop computer' Terminal) :
  • write "aptitude install nmap" and press ENTER
  • write "nmap -sP 192.168.1.*" (or replace "192.168.1" with your router's address ; don't forget the asterisk at the end)
  • this will take something like 30 seconds and then you will get a list of all computers, routers, ... which are on your network, amongst them should be the Alix board :
Host 192.168.1.2 appears to be up.
MAC Address: 00:0D:B9:17:7E:A0 (PC Engines GmbH)

Here you can see the Alix's IP address = 192.168.1.2 (or whatever is indicated there). I suggest to fix the IP addresses of the Alix board and the desktop PC which will contain the music library (for example : desktop PC = 192.168.1.20 and Alix board = 192.168.1.30, that's the example I will use here). You fix the IP addresses from inside your router's interface (see router manual for that).

When you have finished fixing the IP addresses for both computers, restart your router and then do the nmap command again on the desktop computer to check if it's ok.

To be able to work on the Alix board via the desktop computer, you need to install openssh-server on the desktop computer :
  • write "aptitude install openssh-server" and press ENTER
As you know the IP address of the Alix board, you can now enter the board via ssh :
  • write "ssh -2 -p 22 root@192.168.1.30" (or the address you chose)
  • after a little moment it will ask for the root passwort : write "voyage" and press ENTER
  • now you are inside the Alix computer with root privileges
You need to change the read/write configuration of the Alix computer which is normally read only :
  • write "remountrw" and press ENTER
Then :
  • write "apt-get update" and press ENTER
  • write "apt-get upgrade" and press ENTER
Modify the country specific language settings :
  • write "apt-get install locales" and press ENTER
  • write "dpkg-reconfigure locales" and press ENTER
  • chose the settings related to your country and language
Install some packages which will be used or which are useful (jed = userfriendly text editor, mpd = music player daemon, alsa-base = sound drivers) :
  • write "apt-get install jed mpd alsa-base" and press ENTER
Add a user (without root privileges) :
  • write "apt-get install adduser" and press ENTER
  • write "adduser your_username" (your_username = same as on the desktop computer)
  • enter the desired password (and remember it)
Change read/write configuration back to read only :
  • write "remountro" and press ENTER
Exit the Alix computer :
  • write "exit" and press ENTER (you are back on the desktop computer)
You can login to the this new user on the Alix board :
  • write "ssh -2 -p 22 your_username@192.168.1.30" and press ENTER
  • enter the password for that user
  • if you need root (super user) privileges : write "su", press ENTER and enter the root password (= "voyage" if you didn't change it)
  • if you want to end the root seesion : write "exit" and press ENTER
  • if you want to logout from the Alix board : write "exit" and press ENTER

Thursday, April 2, 2009

Installing Voyage Linux


On your Debian Linux (desktop) computer :


Download the latest version (for me this was voyage-0.6.1) of Voyage Linux to the desktop.

There will now be the following file on your desktop :
voyage-0.6.1.tar.bz2

Open the Terminal (with root privilege -> write "su" and press ENTER) :
  • write "cd Desktop" and press ENTER
  • write "tar xjf voyage-0.6.1.tar.bz2" and press ENTER
  • write "cd voyage-0.6.1" and press ENTER
Outside of the Terminal, open the "voyage-0.6.1" folder and then open the file "README" (double-click). There you will find the installation instructions which are the ones I describe here.

You first need to format and partition the CF-card. So, insert the card in the card reader. Then in the Terminal :
  • write "dmesg" and press ENTER
  • you will get a very long list with at the end the device name for the CF-card (the size of the card should appear at the end of the line between brackets), it should be "sda" or sdb" (you will need this name in the following step, to be sure to format the right device and not your hard drive)
  • write "fdisk /dev/sdb" (or your own device name instead of "sdb") and press ENTER
  • write "d" and press ENTER
  • write "n" and press ENTER
  • write "p" and press ENTER
  • write "1" and press ENTER
  • press ENTER (default value)
  • press ENTER (default value)
  • write "w" and press ENTER
Outside of the Terminal, right-click on the volume which represents the CF-card and choose "Unmount volume".

In the Terminal window :
  • write "mkfs.ext2 /dev/sdb1" (or your own device name instead of "sdb")
  • write "tune2fs -c 0 /dev/sdb1" (or your own device name instead of "sdb")
Ok. Now your CF-card is formatted and partitionned.

In the Terminal window :
  • write "aptitude install rsync" and press ENTER
  • move to the /mnt folder and write "mkdir cf" and press ENTER
  • move to the voyage-0.6.1 folder
  • write "./usr/local/sbin/voyage.update" and press ENTER
  • press ENTER (default value = "Create new Voyage Linux disk")
  • press ENTER (default value)
  • press ENTER (default value = "Select Target Profile")
  • write "5" (=ALIX) and press ENTER
  • press ENTER (default value = "Select Target Disk")
  • write "/dev/sdb" (or your own device name instead of "sdb") and press ENTER
  • press ENTER (default value = "1")
  • write "/mnt/cf" and press ENTER
  • press ENTER (default value = "Select Target Bootstrap Loader")
  • press ENTER (default value = "grub")
  • press ENTER (default value = "1")
  • press ENTER (default value = "Configure Target Console")
  • press ENTER (default value = "Serial Terminal")
  • press ENTER (default value = "38400")
  • press ENTER (default value = "Copy Distribution to Target")
  • now you can check if the entered values are ok (if yes, then write "y", in no, then write "n" and start the whole process again), then press ENTER
  • press ENTER (default value = "Exit")
If above the line "What would you like to do?" you get a message like "copyfiles.sh script completet" then Voyage Linux is now installed on your CF-card.

Now you can remove the CF-card from your desktop computer.

To remove the "voyage-0.6.1" folder from your Desktop :
  • write "cd .." and press ENTER
  • write "rm -r voyage-0.6.1" and press ENTER

Wednesday, April 1, 2009

Installing Debian Linux


We need a PC with Linux running on it which will act as terminal for configuring the Alix board and which will also host the music library which will be served by the Alix board to the Amp via the USB DAC.

I chose to buy a new machine, mainly because I am sick of the high noise level of the old PC which I used till now for experimenting with Linux. But as I already told, you can use almost any old PC to install Linux on it.

As noise level was an important factor, I chose the following computer :
  • Mainboard : Gigabyte EG31M-ES2L / Intel G31 Chipset, FSB 1333, DDR2, SATAII, GLAN
  • Processor : Intel DUAL-Core E2220, 775P, 800MHz, 1MB, 65nm, Fan, BOX
    Conroe, 2.4GHz, SpeedStep, I64bit, NX
  • Memory : 2048MB DDR2 PC-6400, (1x2048MB Max. 4GB), 240Pin
  • Harddisc : 320GB, SATA-II, 7200rpm, Samsung (possibility to put 3 more disks)
  • Graphiccard : Intel GMA 3100 Integrated Graphics (on Board), up to 256MB Shared
  • Network : Gigabit-LAN 10/100/1000 Realtek 8111C
  • Card Reader : Yeong-Yang 33-in-1, USB 2.0 (which is useful for configuring the CF card for the Alix board)
  • Tower : Yeong-Yang Midi-Tower YY-5704 Silver, 350Watt, ATX
This is a very quiet computer which is what I wanted. It should also be very low on energy consumption, which is good. And it is quite cheap, too (around 350 US$).

I installed Debian Linux 5.0, which is the latest stable one. I will not explain how to install it. You will find a lot of informations here. The easiest way to install it, is to download a CD image and to burn a CD with it. Then you just have to put this CD into the computer and follow the onscreen text. There is a detailed installation manual here. This should be easy (the proof : I was able to do it).

After this, you should have a running Debian Linux 5.0 system in front of you.