Installing Ubuntu Server On the HP MediaSmart EX490

A continuation of my previous post, the aim with this particular entry is twofold.

  1. Documentation. I want to document which steps I took and what had to be done to make this work in case I need to review the information at a later date.
  2. It can potentially help others who are just starting out with Ubuntu Linux Server, too.

I’ve never had much experience with Ubuntu Linux, save for being able to install, configure and use the Desktop version of Ubuntu. While that’s all fine and dandy, it doesn’t really qualify one to install and configure an Ubuntu Server. Nevertheless, I decided that a learning experience never hurt anyone, so I set out the following goals and read up on the subjects:

  1. Set up Ubuntu Server.
  2. Creating RAID5 partitions on Ubuntu Server.
  3. Samba network sharing.
  4. Plex media server over the command line.

That’s it. It doesn’t sound terribly complicated, I’ll admit, but there really was a lot of fiddling, reading and trial and error involved.

Creating the installation media.

Having attached a VGA debug board and keyboard to my EX490 I was ready to create something to install Ubuntu from. Since I don’t have a USB optical drive, I opted for the flash drive variant. I headed on over to the official Ubuntu download page and got the latest version of 64 bit Ubuntu Server. (12.10 at the time of writing this.)

I also went and grabbed Linux Live USB Creator. There is absolutely nothing complicated about using this application. Point it at an image file and at a thumb drive – and everything is handled for you.

On the back of the EX490 there are three USB ports. Insert the installation thumb drive in to the bottom one, enter the BIOS and select boot from USB. Unplug all hard-drives, if present, from the server and reboot.

Installing Ubuntu Server and configuring a RAID 5 array.

Once the Live USB has initialized you’ll see the Ubuntu logo and various options. At this point you should slide the hard drives back in to the server and select Install Ubuntu. Follow the on-screen instructions and provide information where necessary. Once you reach the hard drive setup screen, you should select the manual option. I relied heavily on this post: https://help.ubuntu.com/12.04/serverguide/advanced-installation.html from the Ubuntu documentation. If you find my list lacking in detail, reference that instead.

  1. Select the first hard drive, hit enter, and agree to the prompt asking if you want to create a new empty partition table.
    When finished the drive should only list “FREE SPACE”.
  2. Repeat step #1 for every drive you want to be in the array. If using RAID5, like me, a minimum of 3 is required.
  3. Selecting the first drive hit enter and select automatically partition in the list. I deviate a bit from the Ubuntu documentation in this, but I found it much less difficult and I was also sure that I wouldn’t do anything completely daft using this method.
  4. Repeat step #3 for every drive.
  5. In the main partitioning list select “Configure Software RAID”, commit the changes after which you should select the “Create MD Device” option. Select RAID5 and enter the number of drives you’ve decided to use. You might be asked if you want to use a “hot spare” – I recommend against it, but it’s entirely up to you.
  6. Now you’re presented with a list of partitions. Select all partitions of the same size (use the spacebar to select and navigation keys to move up and down.) and hit enter. I chose the largest partitions first, but it’s entirely up to you which way to go. Please make a note of your partition names here. I.e. /dev/sda1 etc. It’s important later.
  7. Repeat step #6 for the remaining, smaller, partitions after which you’ll be sent back to the main partitioning screen. With any luck you’ll have md0 and md1 in your list now, which are your RAID arrays. Note that your drives will still be visible in the list.
  8. Open the large RAID array and select ext4 and mounting point “/”. For the smaller array chose “swap”
  9. Select “Finish” and you’re done configuring the array itself.
  10. Installation will now continue and ask you a few things, fairly self-explanatory. Feel free to encrypt the home directory, but I find it shouldn’t matter since this is a server we’re setting up after all. At some point you’ll be asked about which services to add – Open SSH and Samba should be sufficient.
  11. You’ll be asked to set up the grub boot loader. This could be a chapter all in itself, but I’ll try to simplify. Basically you’ll want the boot loader on every device. If you only select one device, and that fails, you’ll be left with a system that cannot boot – and we don’t want that. Check your list from #6 and specify the non-swap drives. i.e. /dev/sdx /dev/sdx etc. This will install the boot loader on all drives.
    Side note: if you screw up completely not all hope it lost. When the system is up and running you can open dpkg-reconfigure grub-pc from the terminal, select all the devices and install the grub bootloader to all of them. You’ll probably want to do this after a disk failure, too, just to be safe.
  12. Done! Sit back, enjoy the feeling, open a cold one and pat yourself on the back.

Improving the RAID array speed.

By default the synchronization of your RAID array will be, for lack of a better word, atrocious. To fix this and to see why, you can read the full explanation in this article. If you just want to be done with it, enter the following in your terminal:

sudo sysctl -w dev.raid.speed_limit_min=50000
sudo sysctl -w dev.raid.speed_limit_max=200000

If you want to see what your array is doing at any time, use the following command.

cat /proc/mdstat

Try it now, note the speed it’s working at and the progress, then apply the above and see the difference. Thank me later. With beer.

Network configuration.

First things first you’ll want to set up your sparkling new server with a static IP address, it’ll save you lots of annoyances in the long run. First, you’ll open up your interfaces file using a command line based text editor. In your terminal, enter the following:

sudo nano /etc/network/interfaces

Sudo is “super user do” and nano is the name of the text editor. You should have the eth0 interface in the list. Now change it to suit your needs. Here’s an example:

auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8

Yours will most likely be different from the above. Change IP address of the server to something easy to remember, network and broadcast addresses are not strictly needed – but I like to keep them just in case I make a typo in the netmask. The most important part here is to change the dhcp to static – as highlighted in bold. Press ctrl+x to save and then exit the editor. Then write the following command in terminal to restart the networking service.

sudo /etc/init.d/networking restart

Now test that your network settings are properly configured by opening an ssh tool, I use Putty, and connect to your server. If you can connect and log on, you could technically remove the debug cable, close up the server and put it back in place. The remaining configuration can be done via Putty over the network. I suggest you wait until the RAID array has finished resyncing, and then safely shut down the server using this command:

sudo shutdown -h now

You could also ignore the resync and proceed – do so as you wish. At any rate, don’t move the server to it’s final location and remove the debug cable until the resync is finished.

Updating the server and applying updates.

Having an up-to-date server is obviously a great idea, here are the commands you need to issue to accomplish that:

sudo apt-get update
sudo apt-get upgrade

get-update will update your package lists from the ubuntu repositories, while upgrade will apply the found updates. Confirm any queries and you’re done. You may need to restart the server to finish applying all updates. A restart is simple and is done with this command:

sudo reboot

Setting up Webmin.

Webmin is a web based administration tool, which simplifies some administrative tasks and saves you from having to rely so much on remembering commands. I used this to create my Samba shares and users.

Rather than re-invent the wheel, I defer to this guide: http://www.havetheknowhow.com/Configure-the-server/Install-Webmin.html

Follow that and you’re golden. Remember the part about checking for the name of the latest package.

Setting up Samba.

Again, I defer to an external guide: http://www.havetheknowhow.com/Configure-the-server/Create-users-share-folders.html

Unlike the guide, however, I did not create my share within the home folder. I simply used mkdir to create /shares/TV, /shares/movies, /shares/music etc.

If, for some reason, when trying to mount the resulting drives in Windows, you get “access denied” or similar errors, you should check that the share folders have the correct permissions set.

For example, you want to make sure that the user “paul” has permissions within the /shares/music directory, even though the Samba configuration should have given him these permissions. Issue the following command, and see if that resolves the issue:

sudo chown -R paul:users /shares/music

The syntax, then, is: sudo chown -R username:group directory

The -R changes permissions for all folders and files within the directory as well. Leave it out, and it will only change permissions for the directory itself.

With any luck, you’ll now be able to mount your shares as network drives in windows.

Installing the Plex Media Server.

While giving your server PMS doesn’t immediately sound like the most appealing thing in the world, it’s well worth it. (I know.. I know.. couldn’t resist it..)

Update August 17th 2013 - text changed since the information changed. Refer to official documentation instead.

http://wiki.plexapp.com/index.php/Downloads#Ubuntu_-_PMS

Once the server has been installed, open your browser and navigate to http://server-ip:34200/manage – and set up your server! Basically you only need to point it at your media and it’s ready to go.

Final Thoughts

This was a first for me. Installing Ubuntu Server, creating a SoftRAID, and much of the above – I’d never tried before. There’s certainly a somewhat steep learning curve to all this, and I must admit I find documentation, that’s applicable to whatever version you’re running, fairly hard to find – not to mention that the Ubuntu forums of the internet tend to be flooded with a lot of outdated information. I’m sure I’ll contribute to this trend with this post, but I can laugh at my idiot self in a year or two.

For those of you who know what IRC is, I highly recommend #ubuntu-server on FreeNode as a great place to ask questions and have them answered, provided you have patience. I Certainly owe a few chaps on there a great deal of thanks for helping me troubleshoot issues with, amongst other things, the grub loader.

That said, the performance gains from using Ubuntu Server, rather than the desktop MediaSmartFrontedition, are certainly not negligible. Use it, if you dare, otherwise just install Ubuntu Desktop on a drive and pop it in the box, as I mentioned briefly in my first post about this server.

I hope you’ve enjoyed this mini-series about this project of mine, I’ll make new posts if I find some new interesting things to do with this neat little Home Server.