Building a Ubuntu fileserver: The Software
After planning and building a Ubuntu-based fileserver, it’s time to add software to the mix, so that the computer does the work it was originally meant for. In the case with my command-line only server, the software I added was for file sharing and media serving.
The software I’m explaining here was all installed via the command line. To do any of this with the GUI of Ubuntu, simply open a terminal window.
The priority of my project was that the media on the computer would be accessible on my PS3 via wireless network. To do that, I researched a number of software projects, and settled on MediaTomb because I had heard good things about it. MediaTomb has lots of great features including, but not limited to: web administration, daemon operation, transcoding and instantaneous library additions.
After finding an excellent tutorial on adding all the necessary and optional libraries to get every feature working, I had a good setup. I highly recommend reading that blog post and others on it to find out about all that MediaTomb can do. Essentially, the task involves downloading and compiling MediaTomb to use all the features. While initially the MediaTomb daemon did not run, I was able to fix the problem and got everything working. I’ll be sharing the process in an upcoming post.
Using the command-line doesn’t really bother me, but I wanted another way to administer the server over the network and a browser. To do that, I used Webmin, which enables users to change many aspects of the system, without using the terminal.
Installing Webmin is quite easy, because it is included in the Ubuntu repositories. Simply open a terminal window and type
sudo apt-get install webmin
Enter your admin password when prompted, and Webmin will be downloaded and installed automatically. Once it is installed, open a new browser window and navigate to https://ip_of_server:10000 then enter your user credentials. Once logged in, you can do many operations without using the terminal. I have found the best benefit so far to be local disk management — after all, mess that up, and your data vanishes.
Ffmpeg is a suite of libraries and applications for operating on videos and multimedia. Once installed with all the add-ons, nearly every type of video can be modified and converted. Once again, the blog of Julien Simon has an excellent tutorial about making the program work with Ubuntu. Following his instructions, you’ll have a fully operational ffmpeg installation for other applications to use.
The only thing I’ll add to his tutorial is a fix for ffmpegthumbnailer, which is necessary for MediaTomb thumbnails. Install ffmpegthumbnailer by running
sudo apt-get install libffmpegthumbnailer2
then make an addition to the ffmpeg configure code. Add the text
--enable-libffmpegthumbnailer2 to the configure stage, and you should see ffmpegthumbnailer — yes when the configuration has finished.
Netatalk is an open-source file server that can be configured to use the Apple File Protocol. To do this, I followed these instructions, and was up and running in no time. Once installed, Netatalk is very easy to administer from the command line. I was able to create multiple shares for guest and user access and can now access my files from any Mac in the house.
To enable guest access, an additional element must be added to the
/etc/netatalk/afpd.conf file. Add the following text
so that the entire line is
- -transall -uamlist uams_randnum.so,uams_dhx.so,uams_guest.so - nosavepassword -advertise_ssh
This will enable you to access shares without entering a password, provided the shares themselves are open to the use
rtorrent + screen
Torrents are a convenient way to download large files like Linux distributions, and a media server is a perfect platform for unattended downloads. rTorrent is a powerful but easy to use command line client that can be customized for any situation. On its own, rTorrent will not run as a daemon, but coupled with screen, it can run in the background.
Install rTorrent and screen by executing the following commands in the Terminal.
sudo apt-get install rtorrent
sudo apt-get install screen
Once installed, start screen and attach rTorrent to it.
screen -S torrents
Detach the screen session by pressing
ctrl + a, d and you’ll be back to the main prompt. Now rtorrent will remain running even when you disconnect from SSH.
To rejoin the rTorrent session, you must attach to it.
screen -r torrents
Avidemux is set of audio/video tools for the command line that can do many operations. So far I’ve used it to shift audio inside video tracks. Like most other programs, it simply requires a few arguments to do whichever job you need.
sudo apt-get install avidemux
Slightly different than ffmpeg, mencoder is another suite of video conversion for a variety of formats. This is an excellent tool to use for converting MKV or OGM files to AVI (video does not need to be converted). Again, it requires basic command line arguments, and can be used in a screen session to work in the background.
sudo apt-get install mencoder
An important part of running a headless media server is making sure the hardware is operating within its temperature restraints. A tool do monitor that is called lm-sensors and must be set up with the specific hardware in your computer. I could explain the system, but a post on the Ubuntu forums does a much better job. Once installed, simply issue the command
sensors to see the temperature of various compontents, and — if your motherboard supports it — the chassis fan speed.
Of course, this only begins to scratch the surface of possible software for a Ubuntu fileserver, but I think the applications shown are important for running a system without local input. Set them up, and enjoy central storage for all the computers in your house.