Dec 4, 2015

HOWTO: Configuring Kodi to use NAS4Free MySQL DB for central library

If you haven't already installed and setup MySQL on your NAS4Free box, I suggest you follow this guide:
http://www.geekfreely.com/2015/12/howto-mysql-install-guide-for-nas4free.html

We start off by making a for Kodi to access the DB. First we need to login to the MySQL environment to define the user:

mysql -u root -p

Note: If MySQL isn't started then

Enter the password for  root and then create the Kodi user, here I call them xbmc for nostalgia:

CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
GRANT ALL ON *.* TO 'xbmc';
quit;

Create (or add to, if you already have one) an advancedsettings.xml file in your Kodi userdata folder.
Using nano copy and paste the following information into the advancedsettings.xml file, if there is already content, merge the sections appropriately:

advancedsettings.xml configuration found in the following location:
http://kodi.wiki/view/HOW-TO:Share_libraries_using_MySQL/Setting_up_XBMC

And should look like this:

<advancedsettings>
    <videodatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </videodatabase>

    <musicdatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </musicdatabase>

     <videolibrary>
          <importwatchedstate>true</importwatchedstate>
     </videolibrary>
</advancedsettings>

Replace the two instances of ***.***.***.*** with local network IP address of your NAS4Free server. It is recommended not to use its NetBIOS name, as not all devices may be able to resolve them.

Save the file as advancedsettings.xml.  Copy this advancedsettings.xml file you just created to the userdata folder of every Kodi install you want to sync .

If you exported your existing DBs, go ahead and import them.  If you created a fresh DB, scan all your content again, make sure to use the NAS4Free server IP rather than NetBIOS for your shares, as mentioned - not all devices may resolve the NetBIOS.

As a final note, specifically with OpenELEC and Raspberry Pi, although OpenELEC suggest this for WiFi boxes, set Wait for network before starting Kodi under OpenELEC addon settings, network.
That is it...you should be good to go.  Let me know how it goes for you, or if you have any issues.

HOWTO: MySQL install guide for NAS4Free 10.2.x

In some of my previous posts I have written about using NAS4Free and installing various extensions on the system, well it was time to upgrade my NAS4Free but I didn't have the space on the Operating System drive - so a complete re-install was looming.

As daunting as it was, it was inevitable that I had to redo everything, but thanks to the new package manager in FreeBSD 10.x this turned out to be an enjoyable exercise.

The first step I decided to tackle was implementing the MySQL DB on NAS4Free, so I could provide a shared DB for Kodi installs.

First let's determine an appropriate location to install the temporary files for installation:

setenv PKG_TMPDIR /mnt/Data

Next let's create the appropriate user and group for the MySQL install in NAS4Free:

Group
Name: mysql
ID: 88

User
Name: mysql
Fullname: mysql
UserID: 88
Primary Group: mysql
NO PASSWORD

After defining the user to access the MySQL DB, the next step was installing MySQL server, using the following commands:

pkg install mysql56-server
rehash
cd /usr/local
mysql_install_db

At this point it is good practice to confirm that MySQL will indeed starts:

/usr/local/etc/rc.d/mysql-server onestart

Hopefully everything is good at this point and, the next step is to make sure that MySQL is enabled in NAS4Free:

nano /etc/rc.conf

Add the following line to the rc.conf file:

mysql_enable="YES"

Now you should be good to go.

If you want to configure this for Kodi to use, check out the following guide:
http://www.geekfreely.com/2015/12/howto-configuring-kodi-to-use-nas4free.html

HOWTO: OpenVPN installation guide for NAS4Free 10.2.x

So as you may have read in earlier posts - I did a complete reinstall of my NAS4Free server and setup all services running on it. Here in this post I will describe the steps required to install OpenVPN on your NAS4Free server, and configure it to start automatically on bootup.

First let's determine an appropriate location to install the temporary files for installation:

setenv PKG_TMPDIR /mnt/Data/tmp/

Next let's install all the required components: curl, expect:

pkg install openvpn
pkg install curl
pkg install expect

Typing the following command will update yourr shell session with the new commands available based on the installed packages:

rehash

Move openvpn file so it does not get executed every time thesystem is started, otherwise your boot process will stop and you will be prompted for a username/password.  NAS4Free executes all the files inside "rc.d" folder on startup.

mkdir /usr/local/etc/openvpn
mv /usr/local/etc/rc.d/openvpn /usr/local/etc/openvpn/

Edit startup settings and add OpenVPN support:

nano /etc/rc.d

Add the following:

openvpn_enable=YES"

And ONE of the following, this is based on your VPN provider (check the opvn file contents to determine which to use):

openvpn_if="tun"
openvpn_if="dev"

Now retrieve the relevant information from your VPN provider: certificates, location, configuration files etc. Rename the certificate (*.crt) and chosen location (*ovpn) to openvpn.crt and openvpn.conf, and copy *.pem file.

Install certificates (.crt) and location (.ovpn) files:

mkdir /usr/local/etc/openvpn
mv openvpn* /usr/local/etc/openvpn/
mv *.pem /usr/local/etc/openvpn/

Make sure the certificate authority configuration line (ca) is set to openvpn.crt by editing the following file:

nano /usr/local/etc/openvpn/openvpn.conf

Now it's time to test OpenVPN and make sure you have an appropriate IP.

/usr/local/etc/openvpn/openvpn start /usr/local/etc/openvpn/
curl icanhazip.com

The curl command should return your NAS' new WAN IP, and this should be different to your regular WAN IP - as it should be now based on the location file you provided.

Now we need to configure OpenVP to start and connect on startup, so let's create an auto-sign-on script, and make it executable:

nano /usr/local/etc/openvpn/autosignon
chmod +x autosignon

Paste the following, and edit username and password to match your details, for your VPN provider:

#!/usr/local/bin/expect -f
set force_conservative 0
spawn /usr/local/etc/openvpn/openvpn start /usr/local/etc/openvpn/openvpn.conf
match_max 100000
expect -exact "Enter Auth Username:"
send "YOUR USERNAME"
send "\r"
expect -exact "Enter Auth Password:"
send "YOUR PASSWORD"
send "\r"
expect eof

Add the following command script PreInit (System|Advanced|Command Scripts) via your NAS4Free web interface:

/usr/local/etc/openvpn/autosignon

Reboot your machine and you should be automatically connected to your VPN service.

Oct 8, 2015

Configuring ddclient on Ubuntu Server to work with Dynu.com

I use dynu.com for determining my public IP address, I use a public IP address for Plex among many other things. dynu.com offers a completely free service, with no requirements to log in every 30 days, so this suits my needs perfectly.

Originally I installed an DDNS update client on my Windows box, but it suffers from flaky RAM and BSOD, so I decided to install the service on my Plex Media Server. It was a simple enough task, but I figured I should write down the step in case it can help anyone else.

Fist, install ddclient on your Ubuntu box:

sudo apt-get install ddclient

Then configure the ddclient:

sudo nano /etc/ddclient.conf

The contents should be similar to the following, using your username, password, domain name obviously:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
protocol=dyndns2
use=web, web=checkip.dynu.com/, web-skip='IP Address'
server=api.dynu.com
login=username
password='password'
domain.dynu.com

You can also determine the update interval by specifying the following in ddclient.conf:

# check every 60 seconds
daemon=60

Hope this is of some use for you. Thanks for reading.

Sep 23, 2015

Kodi on Raspberry Pi 2 Model B

The other week while watching KordKutters I heard the team talking about the Raspberry Pi 2 being a great device for running Kodi, I was slightly hesitant because I have first generation Pi's, and as some of you may know they are pretty sluggish at times.

Anyway, I dropped the cash on the device to check it out. I bought the:
The major thing to note here is that the Pi 2 doesn't use SD cards, it uses microSD cards, which is great for compactness, but I was surprised - you can tell this was an impulse buy and not researched.

Anyway, as soon as I received the device I loaded the microSD card with the latest beta OpenELEC (5.95.5) - it runs like a dream, snappy GUI (Conq) and quick, timely playback.

As some of you may know I had posted about the history of my devices and my recommendations, I think I would go with the Pi 2 now...

Let me know your thoughts and feelings in the comments, or if you have any questions.

Aug 10, 2015

Setting Up Samba Shares On Plex Media Server

So I decided to setup a samba share on my Plex Media Server so I could pull off the mobile photos that are uploaded.

First off you need to know the location of your mobile uploads, on Ubuntu Server 12.04 that would be:

cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Media\ Upload/Mobile\ Photos/

Once you are aware of the location you can now define the samba share. Open the following file, with write privileges:

sudo nano /etc/samba/smb.conf

At the very end of this file, put in your share details:

[Pictures]
path = /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Media Upload/Mobile Photos/
available = yes
valid users = macleod
read only = yes
browseable = yes
public = yes
writable = no

Share name is [Pictures], path is obviously path and the rest of the settings are self-explanatory.

Restart samba using the following command

sudo service smbd restart

And to test the syntax use the following:

May 26, 2015

Summary Software/Hardware for Kodi/XBMC

The Hardware
After approximately 10 years of using XBMC, the old name for Kodi, I have tried a variety of hardware end-points.

Always searching for the best bang for my buck. My conclusion is the Chromebox, I have a single Asus Chromebox and I am considering replacing my Pi's with two more Chromeboxes. Raspberry Pi's are nice and all, but they just don't have the grunt, you are constantly modifying settings and over-clocking. The Asus Chromebox is a no hassle Kodi player.

It's silent, powerful, and it comes at the great price ~$160.

Now I know a lot of people will be saying the Pi is cheaper, but let's be honest - you need to spend at least $95. For that you get, the Pi 2 (~$45), wireless adapter (~$10), case (~$10), SD card (~$15) - and that doesn't even include cables or a power supply, because you may have it lying around.

The only question about the Chromebox is to consider which version. Some will handle 4k, and some will give you AC, and of course some will give you both.  I have a basic Asus, but am tempted by the Dell Chromebox for the AC network adapter+Matt DeVillier provided some insightful comments on the Chromebox support of 4k and Wireless AC. AC network support can be gained in the cheaper Asus box with the Intel Dual Band Wireless-AC 726, and there appears to be no difference in 4k support between models, however I had previously read the i5 would be required for 4k.


Update: Some other readers noticed hardware omissions, I'd love to hear feedback on other hardware users have had success with, but a comparison always helps.  Here are a few I would love some more performance comparisons on:


The Software
There are a bunch of approaches, with the only real restriction being the hardware your running it on. I have tried the following:

If you have ever read any of my other posts, it will be no surprise that OpenELEC is the clear winner for me.



The Remote
For me this was a simple decision, nothing fancy here - I have tried a variety of solutions.

At this time I am using the USB receiver from a Windows MCE remote and USB IR receiver I purchased for my initial XBMC HTPC, I have programmed my Harmony Ultimate to send MCE commands - and that's it. You could also use FLIRC and have IR commands converted to keyboard commands - which gives you a lot of flexibility (I used to have a remote button programmed to send "w", to update watched status quickly.)


Update: One attentive reader, +Samuel Petat, noted the omission of Pulse-Eight's CEC adapter. Utilizing the CEC adapter leverages your current TV remote to take care of the basic HTPC functionality. I personally find I want a few more buttons, but if you need the basics this is certainly worth investigating.

The Installation and Configuration
So you have your hardware and software, all you need to do now is install the software and you are ready to enjoy your music and home movies!

I created a guide some time ago based on several different sources, but +Matt DeVillier has an excellent guide that is a much better resource than my dated post. 

+Matt DeVillier provides a simple installation script for running, after you have prepared the hardware, and the guide also recommends settings and covers some known issues.

The Extras
Personally, since I run three of these boxes in my house I like to have a synchronized library, providing watched/un-watched/resume status throughout the house. I wrote a post some time ago about synchronizing with a centralized SQL database, it's worth a read. Kodi is certainly moving towards a shared library implementation using UPNP - but I'm not sure it is quite there yet.