I bought an Asus Eee-PC 701 4G in spring 2008 but I realised after some time it was too small to not be used ”painfully”, at least compared to my MacBook. Since noone is interested of buying that computer I wanted to create a media server of it. The disk space inside is only 4 gigabytes as well as the SD card, i.e. totally 8 gigabytes. However, that’s not enough if you want to store music and films. So I bought a Western Digital Extern HDD My Passport Essential 500GB since it is small, quiet and does not require an external power source (it is USB-powered). The downside is that it is a bit more expensive that those larger in dimension.
As base system I went for Ubuntu Server since I am familiar with Ubuntu and I know how to set up most needed software.
Following the steps below will do mainly this:
Since we create a server, we’ll use the command line. Therefore lots of commands are given here, most often preceeded by a dollar sign ($). It is not meant to be typed, but indicates what has to be written in the console. Yeah, I guess you already knew that!
Also, my username is hans. Change where appropriate.
I installed using netboot installer and GRUB, since I had already a Linux distribution installed.
Find appropriate version and look for files named linux and initrd.gz at this location:
http://cdimage.ubuntu.com/netboot/
Install to harddrive (SSD). Just answer all questions, at the end I only checked the "Ubuntu Base Server" (or
something like that, the first option in list).
I didn’t have the external harddrive connected during install so I afterwards added it to fstab as /media/Titan. If unsure how it is done, the best way is to connect it before install and let the installer take care of it. The way I mounted it physically is shown in figure 1.
|
Install ALSA:
Running lspci gives:
To make it work run
Test if sound does work with:
In this case it is not and may be solved by adding the user to the same group as those listed in /dev/snd/, probably audio. Fix with
then logout and relogin. You should now be able to set volume with alsamixer.
OneSwarm currently requires X to run. Fluxbox is a small window manager.
Start X with startx.
Install the SSH server with:
If you do not want to be logged out automatically after inactivity, add the following to /etc/ssh/sshd_config:
Based on guide at https://help.ubuntu.com/8.10/serverguide/C/openssh-server.html. Generate the keys on remote machine (not server), from a terminal prompt enter:
This will generate the keys using a DSA authentication identity of the user. During the process you will be prompted for a password. Simply hit Enter when prompted to create the key.
By default the public key is saved in the file ~/.ssh/id_dsa.pub, while ~/.ssh/id_dsa is the private key. Now copy the id_dsa.pub file to the remote host and appended it to ~/.ssh/authorized_key:
Finally, double check the permissions on the authorized_key file, only the authenticated user should have read and write permissions.
Uncomment line in /etc/ssh/sshd_config:
To disable login without this key, also change to this:
It will now not be possible to login with a password as before, but only with these keys. Don’t forget to restart the SSH server:
If you have X installed you can run it from another computer (similar to VNC) using
Based on http://ubuntuforums.org/showthread.php?t=249889, this will install an NFS server which gives better transfer speeds than mounting as SSH. In this case I’ll use unfs3 since it can handle mappings of user id’s, good if your user on local machine has different UID than that on the server. Install with:
Add share to /etc/exports:
Use id username to see username’s UID and GID. Then set up file /etc/nfs/hikari.map with mappings:
Restart server:
Install Music On Console Player:
To start the player (including the server), run mocp.
This program plays the sound locally, i.e. through the speakers of the Eee PC or connect it to an amplifier. It plays FLAC, MP3, OGG and Wave. Information on how to convert AAC to playable format, read 7.3.
Enable “remote access” in OneSwarm, see section 6.2.
Due to hardware limitations this may not work flawlessly.
Install VLC, FFMPEG and some codecs using
On server terminal, write
On client machine (IP: 192.168.1.2), start VLC check the SAP announcements setting. Name ”Video” will show up, click to start playing. However, it is streamed and pausing is not possible.
A small and text-based torrent software is rTorrent. Install by
User guide found at http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide. When logged in to the server by SSH it is very convenient to use the program screen. It is then possible to initiate an rtorrent session, then log off (or perform other tasks) and let it continue. The command to use is
Hiding the “screen” is done by Ctrl+a+d. You may now disconnect the SSH session and resume it another time from any other computer. To resume the screen again, use
Download OneSwarm, current version is 0.6, from http://oneswarm.cs.washington.edu/. It requires Java and a browser, for example:
Set it up from within X, see 4.1.
It is possible to use the X virtual frame buffer which doesn’t need to run X.org. The downside is that you can currently not add swarms manually (only automatically). But if you’ve set up remote access you can as always access your swarms. To install the X virtual frame buffer, run
It is then possible to run OneSwarm from the terminal using
Using Xvbf saves resources compared to using normal X. But if you need to manually add files, stop OneSwarm, start normal X with startx, open Firefox and then add files. Hopefully OneSwarm developers will implement functionality for adding files remotely soon.
Turn the backlight of the LCD on or off (NB: it will not turn on automatically by keyboard or mouse use!!):
Make files written to /tmp only be in RAM instead, hence these will be lost when computer shutdowns or reboots. Add this line to /etc/fstab:
Reduce disk writes by putting the /var/log directory into RAM, and save it to disk only on halt or reboot, and eventually every n:th hour or so.
Add this line to /etc/fstab:
Create the Upstart jobs logsave and logload, save to /etc/event.d/. logsave reads:
And logload reads:
Eventually add command initctl emit logsave to crontab (see section 7.4 for information).
Reduce what is logged by editing /etc/syslog.conf.
To get a warning when the /var/log memory is full, put these lines in /etc/bash.bashrc which is run every time you log in:
Following based on information from http://gimpel.gi.funpic.de/wiki/index.php?title=Howto:convert_aac/mp4_to_wav/mp3/ogg_on_Linux.
Install faad (read AAC-files) and lame (MP3-converter) with the following command:
Now convert files with
To convert many files at once, use this script:
The external disk is also used as backup of important files. Backups should according to Linux Standard Base (LSB) be stored at /mnt/backup. Therefore I made a soft link to the external disk. The following script is based on script found at https://help.ubuntu.com/8.10/serverguide/C/backup-shellscripts.html and is run once a day (in my case below at 23:45). Put
in the crontab file (edit it by running sudo crontab -e). The script, sysbackup.sh follows below and the filename of the backup file will contain the name of the day, hence only the last 7 days will be stored.
Music Tag Editor for console.