Build A Complete Linux Media Server – Debian Server Install

Debian Server Install

This article details how to create a standard, headless debian server install. For our linux media server project we will be using the latest version distribution available at the time of writing: Debian 8.3.

You can also use the process below to build a standard debian server. It will be headless, i.e. no desktop environment e.g. Gnome as we don’t want to waste resources on running a desktop environment we won’t be using after setup is complete.

Instructions

  1. Download either the netinstall image iso or the first complete image iso in the series
    • The net installer is about 315MB, the complete CD is around 650MB. If you are going to ever install more than one machine then the complete CD is far better value!
  2. Create a new virtual machine (or prepare your physical server if that’s what you will use)
  3. Go through a default install as shown below:
    1. Choose “Install” from the boot up screendebian server install - 1
    2. Configure your language, keyboard and country fro the options given – here we are using UK Englishdebian server install - 2
    3. Give your server a hostname, in this case we are using “merlin”debian server install - 3
    4. When asked to input a root password, we advise leaving this blank – this disables root login which is more securedebian server install - 4
    5. Enter a username – we are using “merlin” again here. This user will be able to carry out root permission commands using “sudo”, i.e. it will be a member of the “wheel” groupdebian server install - 5
    6. Accept all the default disk partitioning prompts (guided, use entire disk) then click to finish and write the partitions to diskdebian server install - 6
    7. When prompted to scan another disk, answer “no” – CD1 is enough to create what we need for our debian server
    8. Choose “yes” to use a network mirror in the next step. Don’t worry! We will not be downloading large amounts in the initial configuration but we will need it for the installation of individual packages later on. Pick your country and the relevant local network mirror site for quicker access to packages.debian server install - 7
    9. For the “Select and install software” use the arrow and spacebar  keys to deselect “Debian Desktop Environment” and “print server”, select “SSH server” and leave “standard system utilities” selected as shown below:debian server install - 8
    10. Choose the default to install grub to the master boot record, in our case /dev/sda and then “continue to finish the installation. debian server install - 9
  4. Set a static IP address
    • This is important so that you can always find your server! The article > here < details how to do this via the /etc/network/interfaces file.
  5. Make sure you can connect via SSH
    • Use a terminal client like putty to make sure you can connect – this install will all be done via console or SSH as we do not have a desktop environment.
  6. Run
    sudo apt-get update

    and then

    sudo apt-get upgrade

    to make sure you have all the latest updates, including security patches.

Give “nobody” a Home!

If you are following this guide as part of the Linux Media Server project then you must create a home directory for the nobody user – this is so that our media applications have somewhere central to store their configuration data.

For this, we need to edit the /etc/passwd file, create some directories and assign permissions:

  1. In /etc/passwd change the following line:
    • nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin

      to

      nobody:x:65534:65534:nobody:/home/nobody:/usr/sbin/nologin
  2. Create the necessary directory, including one for NzbDrone to save configuration into:
    • mkdir -p /home/nobody/.config/NzbDrone/
  3. Assign permissions:
    • chown -R nobody:nogroup /home/nobody/

 

You should now have completed your debian server install – why not carry on to the next srticle in the Complete Linux Media Server!

Build A Complete Linux Media Server – Introduction

Linux Media Server From Scratch!

This series of articles describes how to build a complete linux media server for finding, downloading, organising and streaming media.


 

Before we start, it goes without saying (but I’m saying it here anyway!) that this is a grey area, that you should already have legal entitlement to watch these shows through your terrestrial TV / cable TV provider and that downloading shows is your backup option.

This is simply a way to change how you store, manage and view the shows which you have already paid for – if people don’t pay for the shows, production companies cut their budgets, actors eschew parts in great dramas and instead plump for making adverts for Coca Cola – in a nutshell, all the cute bunnies and kittens die because of you!! You get the message.


 

We will be using the following technologies:

To implement the full stack you will need to have usenet access from either your internet provider or one of the many monthly subscription usenet services. There are a few examples of these listed in the usenet configuration article.

We will approach this project in the following order:

  1. Debian installation and configuration
  2. Transmission-daemon installation and configuration
  3. Nzbget installation and configuration
  4. Sonarr installation
  5. Sonarr configuration – due 5th April 2016
  6. Plex Media Server installation and configuration – due 10th April 2016

The linux media server example detailed in this article is built in a virtual machine on ESXi 5.5.

The information provided here draws on other information already available on the internet and will be referenced as such, credit where credit is due!

The links 1-5 above will be activated when the articles are published over the next week – subscribe to be notified of new posts!

f5 “Log disk usage still higher than 80% after logrotate” – No Files Found to Delete

F5 error message “Log disk usage still higher than 80% after logrotate” is issued and “df” shows that the var/log partition is nearly full but “du” finds no files to delete. This article describes how to find the “invisible” log files and regain the disk space.

Description of the Issue

The following error can be seen logged to the console:

011d0004:3: Disk partition var_log has only 7% free
Feb 25 09:25:03 f5-01 emerg alertd[7775]: 01100048:0: Log disk usage still higher than 80% after logrotate and 24 times log deletion

“df” shows that the /var/log partition is nearing its limit:

[admin@f5-01:Active:In Sync] ~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
<snip>
/dev/mapper/vg--db--sda-dat.log.1
                      485M  427M   33M  93% /var/log
<snip>

“du” however shows that there are only a few MBs in the /var/log directory:

[admin@f5-01:Active:In Sync] log # du -h ./ –max-depth=1
<snip>
26M     ./

Cause

Monitor logging has been enabled for e.g. a node which is ongoing. The file however has been deleted but as it is still being written to, the disk space is still in use.

Fix

We simply need to identify fo which node the monitoring has been enabled and then disable it. We can see a list of the files which have been deleted from the log directory with the following command:

[admin@f5edin:Active:In Sync] monitors # lsof | grep deleted | grep log
bigd   6775   root  7w   REG   253,2  407867086  109730 /var/log/monitors/Common_icmp-Common_panel1-0.log.1 (deleted)

Now go to Local Traffic -> Nodes -> Select the node and uncheck the monitor logging box:

monitor logging

Running “df” should now show plenty of recovered disk space:

[admin@f5-01:Active:In Sync] log # df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/vg--db--sda-dat.log.1
                      485M   36M  424M   8% /var/log