Install And Configure Nagios on Ubuntu 14.04 LTS


This is a great blog post on Unixmen about installing Nagios, an open source network and infrastructure software solution, on Ubuntu Server 14.04LTS. Not only does it cover the install but also a basic configuration for monitoring a networked computer.

http://www.unixmen.com/install-configure-nagios-ubuntu-14-04-lts/

If you do not know how to install Ubuntu Server 14.04.1LTS then read the following blog post on HowToForge

http://www.howtoforge.com/ubuntu-14.10-utopic-unicorn-server

If you have not got a spare computer lying around but have one with 4Gb of RAM, make it multi-purpose and install VirtualBox on it . Then install Nagios as virtual machine on Ubuntu Server under Virtualbox.

As with everything open source, the only cost is your time to install and your willingness to explore and learn.

Enjoy!

Installing Subsonic 5.0 on NAS4Free 9.2.x Embedded–PART 2


Installing Subsonic 5.0

With the Subsonic Jail created, you now need to install Subsonic.

These instructions are based on https://lameguy.wordpress.com/2013/02/08/subsonic-install-in-freebsd-jail/

SSH into the Subsonic Jail by entering from Terminal

ssh root@xxx.xxx.xxx.xxx

e.g. ssh root@192.168.1.55

Enter the root password and you should be taken to a command prompt for NAS4Free!

enter

jls

this checks your new jail, you should see something like this

clip_image001.png

Based on the above output, enter the jail by entering

jexec 7 csh

Now configure the server with the necessary packages

As I am using a i386 I will download mine from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9.2-release/Latest/

If you are using AMD 64 Bit then download from ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/

The following command sets the location where the packages are going to be downloaded:

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9.2-release/Latest/

Now start installing the packages required by Subsonic:

pkg_add -v -r xtrans

pkg_add -v -r xproto

pkg_add -v -r xextproto

pkg_add -v -r javavmwrapper

pkg_add -v -r http://denieru.no-ip.org/filecache/subext/lame.tbz

pkg_add -v -r flac

pkg_add -v -r ffmpeg

pkg_add -v -r openjdk7

Create folders and download and extract Subsonic Standalone v5.0

mkdir /var/subsonic

mkdir /var/subsonic/transcode

mkdir /var/subsonic/standalone

cp /usr/local/bin/lame /var/subsonic/transcode/

cp /usr/local/bin/flac /var/subsonic/transcode/

cp /usr/local/bin/ffmpeg /var/subsonic/transcode/

cd /tmp/

fetch http://heanet.dl.sourceforge.net/project/subsonic/subsonic/5.0/subsonic-5.0-standalone.tar.gz

cd /var/subsonic/standalone

tar xvzf /tmp/subsonic-5.0-standalone.tar.gz

chmod 777 *.*

Assuming the above installed successfully, enter the following to start Subsonic manually:

sh /var/subsonic/standalone/subsonic.sh

It takes about a minute for Subsonic server to start up, in the meantime go to your web browser and enter the ip address you assigned to your subsonic Jail.

If you can not remember In NAS4Free go to Extensions > TheBrig and check it from there.

Subsonic runs on port 4040 so the url you need to enter would be your-jail-IP-address:4040. e.g., 192.168.1.49:4040.

The default Subsonic username and password are both admin.

With Subsonic hopefully up and running, we now need to make the above script run automatically whenever the NAS4Free server starts.

From NAS4Free go to System > Advanced > Command Scripts

Click on the ‘+‘ sign to add an additional command script as follows:

Command: jexec 1 /var/subsonic/standalone/subsonic.sh
Type: PostInit

clip_image002.png

Save and reboot your server.

If all is well, you should be able to login to subsonic as before on port 4040.

Accessing your Music stored in NAS4Free from within your Subsonic Jail

Jails separate your installed applications like Subsonic from your NAS4Free server. The downside is that they are isolated from your NAs servers storage and in the case of Subsonic, your music.

To get subsonic to see your music you need to setup your Jails fstab so it mounts your music directory on your NAS4Free server locally within the Jail.

To do this go to your Jail’s settings (Extensions > TheBrigg) and then select the settings for your Subsonic Jail. You will need to create an Fstab entry to mount your NAS4Free directory to a mount point within your jail.

If you wish to find more about Fstab see https://www.freebsd.org/cgi/man.cgi?query=fstab%285%29&sektion=

Below is the configuration for my Subsonic Jail

clip_image003.png

/mnt/data1/Music /mnt/data1/jail/Subsonic/mnt/music nullfs rw 0 0

The above fstab entry can be broken down as follows:

/mnt/data1/Music – This is the directory where my music is located on my NAS4Free server

/mnt/data1/jail/Subsonic/mnt/music – This is mount point WITHIN my subsonic Jail.

nullfs rw 0 0 – The important bit is rw which stands for Read/ Write, which you need in order to upload music to your NAS4Free music directory via Subsonic. The alternative option is ro which is Read Only which does what it says!

To setup this up do the following:

  1. Identify the path to your music on your NAS4Free server e.g. /mnt/data1/Music
  2. Create a directory (e.g. music) in your Susonic Jail’s mnt directory where you wish to mount your NAS4Free Music directory /mnt/data1/jail/Subsonic/mnt/music. To create a directory called music within the mnt directry use the Unix command mkdir music.
  3. Now put all the above (from 1 and 2) together along with nullfs rw 0 0 and place your Fstab entry into your NAS4Free Subsonic Jail Fstab as in the screenshot above and example above.
  4. Save and Apply the changes and reboot your NAS4Free server.
  5. Once the NAS4Free server has restarted, test that the mount has worked. SSH back on to your Subsonic jail, navigate to your mount point directory e.g. mnt/music by entering cd /mnt/music and then enter ls to list the contents. If the mount has worked you should see the contents of your NAS4Free Music directory within the jail.
  6. Login to Subsonic and go to Settings and point this to the mount point you created in step 2 above. Below is how it should look in Subsonic.

clip_image004.png

7. Click on Scan Media folders, this should show in the top right hand corner that it is scanning folders.

Subsonic is now installed and running under NAS4Free. Enjoy!

NOTE:

If nothing is found check the log files for errors under the About menu option, it may give you a clue as to what may be going wrong. A common problem is that there may be a problem with the database (as happened to me) and nothing appears. To resolve (source http://forum.subsonic.org/forum/viewtopic.php?f=2&t=10835):

  • Uncheck the check boxes for ALL Enabled folders
  • Click Save
  • Click on Clean-up database
  • Click on Scan Media Folders Now
  • Re-enable your media folders
  • Click Save
  • Rescan your media folders by clicking on Scan Media Folders Now

Installing Subsonic 5.0 on NAS4Free 9.2.x Embedded–PART 1


To be able to run Subsonic on a NAS4Free server you need to run it within its own separate environment which is called a Jail. There are different ways of creating a Jail within NAS4Free, this post is going to cover installing TheBrigg Jail manager. In part 2 we will look at how to install Subsonic within a Jail in NAS4Free.

PART 1 – Install TheBrig Jail manager

http://www.forums.nas4free.org/viewtopic.php?f=79&t=3894 and associated YouTube video

Note: All existing Jails must be removed from NAS4Free

Create a directory to contain your Jail, do this in the root of your data drive rather than anywhere else. in my case the directory was created on the first data drive called data1

From terminal SSH into your server and create a directory called Jail in the root of your share:

mkdir /mnt/data1/Jail

Change directory to the root of the share by entering

cd /mnt/data1

Now we are going to download the script from https://raw.githubusercontent.com/fsbruva/thebrig/working/thebrig_install.sh and save it to the current directory using the fetch command

fetch -o thebrig_install.sh https://github.com/fsbruva/thebrig/raw/working/thebrig_install.sh

If successful you should get something similar to the following

clip_image001.png

we then change permissions on the script file so it can be executed

chmod a+x thebrig_install.sh

and then we execute it:

/bin/sh thebrig_install.sh /mnt/data1/jail 2

This downloads a zip file, the 2 at the end says to download it from the working branch. The script is then executed and produces the following output

clip_image002.png

once complete you should see the following

clip_image003.png

Return to the web browser and refresh the NAS4Free GUI by pressing F5, under Extensions you should now see

clip_image004

Selecting TheBrig you will see the following error

clip_image005.png

Do not worry this is normal!

Now configure the locations for jails , basejail and template. Select Maintenance > Rudimentary Config and use Installation folders for all locations like so

clip_image006.png

Click Save

Under the Maintenance > Tarball Management tab, press the Query button and select the base.txz file for the release of NAS4FREE you have installed. in my case this was 9.2-Release.

NOTE: If you are running the 64-Bit version of NAS4Free YOU MUST also download the lib32.txz tarball

clip_image007.png

Click Fetch.

With the tarball installed it is now time to configure the Jail for Subsonic

Click on the Current Jails tab to display the following

clip_image008.png

We are now going to add a jail for Subsonic, click on the + sign in the TheBrig config panel and configure as per the screenshot below

Set Jail name to Subsonic

Type to Full

Allocate a static IP address for the Jail, one which is outside the DHCP range of your network.

Set Jail to Start on Boot

Leave Jail Location blank so it defaults to /mnt/DISK1/Jail/Subsonic/

clip_image009.png

Check the Enable the mount devfs checkbox

clip_image010.png

then then check the Official FreeBSD Flavor checkbox

clip_image011.png

Once done save the setting by clicking Add

In the Current Jails screen, click Save

Start the Jail Subsonic by clicking on the Green start button under Action.

Your Jail should then start and the resulting screen should look similar to the screenshot below

clip_image012.png

The Subsonic Jail is now configured. In Part 2 we will install Subsonic 5.0 into this Jail.

 

Categories: Configuration, NAS4Free, server

Installing MiniDLNA extension in NAS4Free

November 1, 2014 1 comment

Before you start making any changes to your NAS4Free server, please remember to backup your config.xml file

Before you can install MINIDLNA on your NAS4Free server, you need to ensure you have SSH setup.

Configuring SSH Access

From the NAS4Free menu select Services > SSH

Check the Enable box on the right hand side to enable SSH.

In my screenshot below I have checked the Permit Root Login option, this is optional but useful.

N4F_SSH1jpeg

Then click Save and Restart to start the service.

Connecting to NAS4Free Server via SSH

From a computer open Terminal or if you are using a Windows computer you can use PuTTY

Login to the NAS4Free server using SSH as follows, where xxx.xxx.xxx.xxx is the IP address of your server

ssh root@xxx.xxx.xxx.xxx

You will be asked for a password and once logged in will get a command prompt

The following instructions apply to NAS4Free v9.2.x and were obtained from this forum post

Create a directory on the server where you wish to install your Extensions, I’ve created one called app at the root of my DISK1.

mkdir /mnt/disk1/app

then change to that directory

cd /mnt/disk1/app

Download the minidlnav3 tar file into the current directory by entering

fetch https://sites.google.com/site/aganimkarmiel/home/free-time/file-sharing/minidlnaV3.tar.gz

then extract the tar file contents

tar xzf minidlnaV3.tar.gz

A directory called minidlna will be created, change to that folder

cd minidlna

Then run the PHP script called install.php by entering

./install.php

The following window will be displayed

clip_image002

Select option 1 Install minidlna.

Once installed you will be returned to the command prompt.

From the NAS4Free web menu select Extensions > MiniDLNA

N4F_SSH2jpeg

Check the Enable box on the right hand side to enable the service.

Then add the locations of the content you wish to access via minidlna by selecting the browse button […] in the content section and then the Add button to add it to the list of file locations.

To test things, I like to enable the WebViewer. The URL which you can access the WebView is displayed once you save the settings.

Once configured, click Save.

When you then connect to your NS4Free server via your DLNA TV you will see a server which will have the same name as your NAS4Free server, this can be changed in the minidlna name option.

Categories: Configuration, NAS4Free, server

Mythbuntu 12.04LTS to 14.04.1LTS Upgrade

September 28, 2014 Leave a comment

After holding off for five months, testing the point one release on a test MythTV server, I decided to bite the bullet and upgrade from Mythbuntu 12.04LTS to 14.04.1 LTS on the basis that this point release has addressed all the initial bugs identified in 14.01LTS.

The good news is that this is true, except if you are using the MythTV Web interface which breaks as a result of the upgrade Sad smile 

The cause of the problem is that the Apache web server configuration file is broken because MythTV 12.04LTS had Apache 2 2.2. and Mythbuntu 14.04.1LTS has 2.4. The supported syntax changed between Apache releases and prevents the Apache server for starting.

How to Fix

Open Terminal and do the following:

1. Delete the old configure file for Apache 2.2:

sudo rm /etc/apache2/sites-available/mythweb.conf

2. Reconfigure mythweb:

sudo dpkg-reconfigure mythweb

Unless you feel you need to, I would suggest that you do not choose the default of password protecting MythWeb

clip_image001

Unless you are sharing Apache on this server, select the default

clip_image002

Once configured you will be returned to the command prompt with the following message

clip_image003

Ignore the error message from Apache!

3. Restart the Apache webserver

sudo /etc/init.d/apache2 start

You will get the previous error message repeated, as before ignore!

If you now go to your web browser you should once again be able to access MythWeb Smile

The full details of the bug (#1307548) and alternative solutions if the above does not work can be found at https://bugs.launchpad.net/ubuntu/+source/mythtv/+bug/1307548

Categories: Multi-Media, MythTV, Upgrading

Dual Booting the HP Pavilion Sleekbook 15 with Windows 8.1 and Ubuntu 13.10


The HP Sleekbook 15 was launched late in 2012 and if you get the Intel variant it comes with a 3rd generation Core ix processors (Ivy Bridge), offering good battery life for a 15.6″ laptop which is around five hours with average use or the AMD A series or processors. Graphics options are quite broad with either stock Intel HD Graphics 4000, AMD Radeon or nVidia GPUs. On some models there is even an option for a SSD drive although apparently you can’t install Ubuntu to thsi drive.

Much to my surprise you get s choice of pre-installed operating systems from HP:

  • Windows 8.x
  • Ubuntu 12.04LTS 64-bit – Certified by Cannonical, although this is only the Pentium Gen. 2 variant.

There are also touchscreen (Sleekbook Touchsmart) variants as well as 14″ screen versions making the model range quite extensive. Because all Sleekbooks are around 2cm thin, there is no room or a DVD drive and no external drive is supplied as standard. However, if you need one these are cheap to buy.

My own model is a Sleekbook 15-b052sa which was pre-installed with Windows 8 and uses a Intel Core i5 CPU (3rd gen) running at 1.7Ghz 8Gb RAM and now fitted with a 500Gb Seagate Momentus XT hybrid had disk drive replacing the stock 750Gb SATA drive.

As with all new computers they are supplied with the dreaded UEFI BIOS which adds aditional security to the computer whilst eliminating the traditional BIOS. For users of non-Microsoft operating systems and Microsoft ones before Windows 8 this has the potental of being an additional hurdle to jump. However, in reality this is not a deal breaker people make it out to be and is just different to the traditional way of installing an operating system with some additonal steps.

On my Sleekbook I set-up Kubuntu 13.10 64-bit to dual boot, with the only issue being the installer which did not give me an option to install Kubuntu alongside the existing operating system. This is a know bug in the 13.10 Ubuntu installer and the workaround is to manually create the partitions, not too difficult but a step which may be daunting to a new Linux user. There are a number of guides on the internet if you know where to find them although the Mint 16 Install Guide (Mint 16 is based on Ubuntu 13.10) makes a decent job of describing the process.

Note: If you do not want a separate data partition your Home folder will be located on the same partition as the operating system. In itself not a problem, but some people prefer t keep the two separate, and if you are using Mint this is recommended because unlike Ubuntu there is no official way of upgrading to a new version without a reinstall, so keeping data on a separate partition makes re-installation a lot easier.

The basic steps for setting up dual-boot using GRUB are as follows:

  1. Make your Windows 8 recovery USB Key/ DVD
  2. Backup Windows
  3. Resize your Windows Partition
  4. Create a boot-able Ubuntu USB drive using a downloaded ISO
  5. Deactivate in Windows 8.x Fast Startup and Secureboot in BIOS (press F10 on boot on HP laptops to access BIOS settings)
  6. Install your flavour of Ubuntu off the USB drive creates earlier (step 4) which will install GRUB
  7. Reboot off USB  drive and Run Boot-Repair. Why this is not pre-installed in Ubuntu is beyond me because when GRUB 2 breaks it’s a complete pain to fix. This utility is a Linux tool-kit must have!
  8. [HP Only] Once you have done the above you may still find that you do not get GRUB appearing. Apparently this is a feature of HP laptops, pressing F9 on boot will display a boot options menu and you can select Ubuntu from there and display the GRUB menu, otherwise the default boot option is Windows and this default can not be changed.

Despite step 8 above, I’m loving Ubuntu on the HP Sleekbook 15 as being Canonical certified, everything just works out of the box, has good battery life is vary fast especially with the hybrid drive I installed and because it’s a slim design the keyboard is easier to type on.

Encouraging Linux not to use the SWAP partition


I recently doubled the memory in my eee PC 1005HA netbook running Mint 16 from 1Gb to 2Gb and to try to maintain the 7 hours battery life I get out of it decided to reduce the possibility of it using the swap drive unless necessary. My initial thought was to delete the swap partition but after some research decided that this was not a good idea, it would be better to discourage Linux from using the SWAP partition!

I came across an excellent post written in 2012 by mikecrosoft in the Linux Mint Forums which clearly explains the steps. As I can’t improve it have reproduced it below. Of course this would apply to all modern day Linux systems, so I’ve since applied it to all of my desktop PCs and to my HP Sleekbook laptop.

I think there is really no problem with letting your system use some swap space, but if you really need to decrease the priority of Virtual Memory vs RAM usage you can simply change the swappiness value; to do that it would be as follows (extracted from https://help.ubuntu.com/community/SwapFaq, and tested so many times in the past and once while writing the comment):

** This would be just in case you haven’t deleted your swap partition or permanently modified anything related, I’ve read you have already deleted your swap partition so I post this just in case somebody needs a less aggressive approach **

1. Open a terminal

2. Type:

cat /proc/sys/vm/swappiness

3. That will display your swappiness actual value (60)

4. If you are going to be testing your system performance during some time to see if you really need to make this change permanent or if you’re going to try with different swappiness values until you find the optimum one, I suggest you to create a launcher in your desktop with the following command:

gksudo sysctl vm.swappiness=10

5. That will change your swappiness value to 10 when you double click the launcher, to try with different values just replace 10 by any integer number in the range 0-100

6. Once you have find the optimum value and decided to make changes permanent, open a terminal and type:

sudo gedit /etc/sysctl.conf

7. Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10
Categories: Configuration Tags:
Follow

Get every new post delivered to your Inbox.

Join 56 other followers

%d bloggers like this: