How to Install Minimal Ubuntu Linux Server With GUI and Kodi
Published: 2013-08-22 Last Modified: 2015-01-05
I have particular needs when it comes to my home server, and since I couldn't find much useful information out there on this specific setup, I thought I'd share my experiences here in case anyone else is looking to do the same.
Basically what I need from my server are these two things:
• a stable, rock solid web/database/file/ssh/mail/ftp server platform
• a lightweight, minimal X desktop environment for simple tasks as well as running Kodi (formerly XBMC)
Sure, this is easily achieved by installing a full blown Ubuntu (or other) desktop distro, but that precludes the 'minimal' keyword. A full install of one of these distributions uses around 2.5 GB of disk space and includes hundreds of packages that I will never use - packages that also need to be updated regularly to maintain a secure system. These packages can be removed manually, but dependencies get broken and cruft gets left behind etc... so I find it better to START with a minimal system and add only what you need. Using this method I end up with less than 750 packages and less than 1.5 GB used by the system.
This info is based on Ubuntu 13.04, the current version at the time of writing. It is not an in-depth guide on every aspect of setting up a Linux server, so if you've never done it before you may need extra help from elsewhere. I'm also going to be using the XFCE desktop environment, but feel free to choose something else if you prefer. I recommend avoiding Gnome though, it's quite bulky and somewhat slower.
Anyway, here's what I do:
Download the Ubuntu Server iso image from ubuntu.com. Make sure to select the correct version for your system (32 or 64 bit).
Either burn it to a CD, or preferably write the image to a USB thumb drive - Linux Live USB Creator is a great, and free, tool for this task.
Boot to the installer CD or flash drive, and when prompted with the install menu, press F4 to select 'Install a minimal system'. Then install Ubuntu Server.
For brevity I have to assume here that you're familiar with the Ubuntu install process, once again consult Google if you need help with this. When the install is complete, the system will reboot and you'll have nothing but a shell prompt on the screen. Enter your chosen username and password to login.
Hopefully you were able to set up a working internet connection during the installation, so the first thing to do is run an update. Type sudo aptitude to launch the package manager, then press 'u' to update the package lists. Then shift+u to mark all for update. Then press 'g' twice to begin downloading and installing. Once that is complete you'll probably want to reboot the system.
At this point I usually install my custom built kernel and headers with dpkg -i, so if you have one of those, do that now. If not, never mind. :) Don't forget to uninstall any unused kernel/header packages when you're done.
Back in aptitude again, press ctrl+t, and arrow across to Options -> Preferences. Arrow down to 'Install recommended packages automatically' and uncheck it. Press 'q' to exit preferences.
The next step is to get a graphical login manager, X window system, and desktop environment installed. Search for and install the following packages (the forward slash '/' key opens the search box, the 'n' key moves to the next search result, and the '+' key adds a package for installation):
xorg slim xfce4 xfce4-terminal alsa-base alsa-utils
Press 'g' again to install the packages.
On reboot you should now be greeted with the 'slim' login manager. Go ahead and login and check out the XFCE desktop environment. You might notice a lack of pretty icons and such, so if this concerns you fire up aptitude in a terminal and install these packages:
xubuntu-icon-theme gnome-icon-theme fonts-droid dmz-cursor-theme
You'll need to go back into the settings to activate the icons, default font, and cursor theme. At this point I like to set up a panel (taskbar) and go through the settings to make everything the way I like it. This is how my XFCE desktop looks, with conky running at top right of the screen:
Some more packages you may want to install:
openssh-server if you want remote ssh access to your server
vino for remote desktop vnc access (run vino-preferences in the terminal after installation to set it up)
mousepad a lightweight and fast basic text editor replacement for gedit
midori a lightweight web browser
samba to share files/printers with windows clients
ntp to keep your system time accurate with ntp servers
wicd to manage wireless networks if needed
conky a cool desktop system monitor app
software-properties-common you need this for add-apt-repository to work later on
I compile my own mysql, nginx web server, and php, so I don't install them here. You may want to go ahead and install mysql/apache/php or whatever other server apps you may need from within aptitude. I also strongly suggest using a public/private key pair and disabling password authentication for ssh logins, please see Google for how to do this.
Some more packages I recommend, you'll need these if you plan on compiling php etc:
make cmake g++ libncurses5-dev bison libpcre3-dev zlib1g-dev libxml2-dev libpng12-dev libfreetype6-dev libjpeg62-dev imagemagick libcap-dev zip unzip
You'll also need these to compile a kernel later using kernel-package:
fakeroot kernel-package bc
I always uninstall this package: popularity-contest
If you installed wicd and find that it won't start, try issuing the following commands in a terminal:
sudo rm /etc/resolv.conf
sudo ln -s /run/resolvconf/resolv.conf /etc/
sudo rm /var/lib/wicd/resolv.conf.orig
sudo ln -s /run/resolvconf/resolv.conf /var/lib/wicd/resolv.conf.orig
If you need a basic mail server (you probably do) install exim4-daemon-light
Run sudo dpkg-reconfigure exim4-config to configure your mail server.
If you want to install the latest version of Kodi, add the official repo:
sudo add-apt-repository ppa:team-xbmc/ppa
Then head into aptitude again and hit 'u' to update, then search for and install Kodi.
You might also want xfce4-power-manager if you want to control when your screen powers off etc, but I don't bother with it I just go to Settings -> Session and Startup -> Application Autostart tab -> hit the 'Add' button and put 'Xset' in the name and 'xset s off -dpms' on the command line. This disables monitor power management, cuz I turn my TV off when I'm finished watching stuff on Kodi. :)
That's pretty much it, obviously you'll need to do a lot of configuration to get your web server etc set up but it's all good fun. Google is your best friend for this kind of job.
Don't forget to run sudo apt-get clean when you're finished installing packages, that will free up some disk space by removing the cached downloaded packages.