tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

NAZverryPie - Scripting of Home NAS using best of the Web

Mon Sep 15, 2014 3:29 pm

Hi

I just published under MIT license a script for installing best of the web tools for turning your Raspberry Pi into a Home NAS. My intention is to have the RPI replace my old Synology NAS, so I have a low power and flexible always-on device. Actually, it came out of frustration of not being able to get domoticz going on the Synology. I dubbed it NAZverryPie. Just for the fun of it.

The script takes all the tools and available knowledge into a script which handles most of the installation work (including compilation if needed)

The services it can install for you (if selected) are:
- Sonos web controller using node.js (per 28-1-2015)
- Ajenti - as opposed to webmin (per 28-1-2015)
- OpenVPN and .ovpn file maker for mobile devices (per 27-1-2015)
- Owncloud
- NZBget
- Rsync
- Domoticz
- Samba, including samba shares for the installed apps (to NZB download dir, etc.)
- Setting up fstab for external HDD on the USB ports
- Youtube downloader front end (using youtube-dl) with MP3 conversion (optional)
- miniDLNA
- vsFTD
- Rsync
- PiWebAgent
- MySQL and phpMyadmin
- Setting up FTP accounts for Security Cameras
- Optional: cleaning the Pi to make it a real dedicated home NAS (gets rid of XWindows.

It will always install
- PHP
- Apache
(in my view, these are the apps I will be needing for my own NAS functions).

It also creates a small HTML website to contain these services in a web page so you do not need to bookmark them, although you still can. This website also allows to add hyperlinks to your personal servers and heavily used websites when maintaining the NAS.

Youtube video and pictures are available through sourceforge: https://sourceforge.net/projects/nazverrypie/.

Installation instructions:
- write the Raspbian (Wheezy) Debian image to the SD card (taken from raspberrrypi.org and using their instruction)
- connect any USB HDD you want to use as storage device. Make sure the partitions and formatting are right.
- log into your freshly baked Pi (user pi, password raspberry) using ssh. There are various ways to find the ip of the Pi. I just plugged the HDMI in my TV, but you can consult your router as well, or use software on a computer
- Run the following command and select "Expand File System":

Code: Select all

sudo raspi-config 
- reboot by closing the menu (or issue sudo reboot)
- SSH again to the RPI and login under user pi
- Download the installation file by running

Code: Select all

wget  https://sourceforge.net/p/nazverrypie/code/ci/master/tree/nazverrypie.sh?format=raw -O nazverrypie.sh
- Run the installer:

Code: Select all

sudo bash nazverrypie.sh

The script will prompt and ask for which modules to use. The installation can take quite a while (if you have selected all packages- >4 hours) as it will compile many packages. After installation, you may want to tweak the settings, especially security settings per application.

Tested against Raspbian Wheezy (24-12-2014) & RPI B+. with a 2Tb Seagate external drive and a 7 port hub which powers both of them.

Todo:
- option to download binaries instead of compile to speed up?
- deinstall
- sudo cleanup in scripts
- any suggestions for software to include which fit nicely on a Pi as a Home NAS (to replace Synology)

Current version: "NAZverryPie with Cream" - testing (per October 12-2014 no longer Unstable).

Enjoy you NAZverryPie and do share suggestions to change the recipe!

Rgdz

Tom
Last edited by tommertom on Wed Jan 28, 2015 7:21 pm, edited 6 times in total.

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Mon Oct 13, 2014 11:49 am

Hi all,

a small message to bump the recent edit on the top post: since yesterday I changed the status of the script from Unstable to Testing. The script is now pretty much fully functional and assist greatly in installing the best tools needed to turn your Pi into a homeserver (dedicated) NAS.

I hope the community (you) will take the opportunity to review this project and see if it is useful.

My home nas is now running on this server and I have my Synology turned off.

Some known things to do for this release:
- add instructions for configuration of ownCloud database under MySQL
- Favicon.ico small issue
- explain the duration of installation upfront (domoticz compile takes >1hr!!)

Future plans (if userbase takes up):
- making an image based installer
- html configuration through php (items, order)
- adding transmission
- google drive support via ocalfuse
- other stylesheets

Check out the summary with pictures and youtube teaser on sourceforge: https://sourceforge.net/projects/nazverrypie/

What do you think?

Regards

Tom

pdessart
Posts: 1
Joined: Mon Nov 03, 2014 12:10 am

Re: NAZverryPie - Scripting of Home NAS using best of the We

Mon Nov 03, 2014 12:51 am

Tom -

Thank you very much for making this available to the Pi community.

I found this while looking for a simple way to install NZBget. (Although I've done my share of development, I just didn't have time to devote to the build/install process.)

Since I didn't want to install Apache/PHP at the moment, I grabbed the nzbget.sh script to run directly. After a momentary hiccup (when I realized that your argument validation was done in the calling script), I made a quick change to 3 lines (41-43: see below) and was off to the races!

Code: Select all

nzbgetmaindir=${1:?Usage: $0 MainNzbgetDirectory NzbgetPassword NzbgetPort}
nzbgetpassword=${2:?Usage: $0 MainNzbgetDirectory NzbgetPassword NzbgetPort}
nzbgetport=${3:?Usage: $0 MainNzbgetDirectory NzbgetPassword NzbgetPort}
(Of course I could have consolidated the usage message into a variable, or used IF statements to create a slightly prettier error output, but this was just a quick cut/paste...)

Might I suggest that you either make Apache & PHP optional (though I get that this precludes the web front-end you're installing) or ever so slightly enhance the individual scripts along the lines of what I ended up doing.

But again, the main reason for my post is to say thanks. Your script allowed me to focus my available time on learning how to actually configure and use NZBget.

Peter

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Mon Nov 03, 2014 7:22 am

Thx Peter for taking time to respond,

I will amend all scripts to allow for stand alone executing using the defaults if no arguments are provided. This shouldnt be too difficult.

Reason for making php /apache mandatory is indeed the webui but also i didnt want to make too complicated dependency checking.

Having said that, when making the underlying scripts indepedent executable likely removes the urgent need for this anyway.

I will make php/apache optional in the end.

Thx again

Tom

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Mon Nov 03, 2014 8:33 pm

Hi

Just a quick note that I updated the source to capture running of scripts using arguments and/or defaults. So this eases somehow the installation of scripts without the full suite.

Installation scripts can be found in the code folder @ sourceforge.

Regards

Tom

vaslabs
Posts: 6
Joined: Fri Feb 01, 2013 12:21 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Fri Jan 16, 2015 5:55 pm

Hi,
Note that the installation process of the pi-web-agent has been changed. We now have an extra step (build) which does some compilations and optimisations before we set a certain commit as a release.

In order to keep things smooth with your script use setup_dev.sh reinstall

It will install pi-web-agent without the optimisations.

If you want the optimisations you have to detect the latest release from the github repository and download that one.

Cheers,
Vasilis
FOSS and Linux hobbyist and enthusiast

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sat Jan 17, 2015 4:57 pm

Hi Vasilis,

Thank you for informing me on your update. I amended the script accordingly.

Please note that the NAZpie script when is run, it assumes the Pi is a brand new and clean system which does not necessarily has the required dependencies ready to run the developer version of PiWeb Agent (git tightvncserver apache2 libapache2-mod-dnssd alsa-utils python gcc libprocps0-dev) - or even have the installer work properly (gcc, git, etc.)

But I do like recompilation instead of installation from binaries, hence I amended the script to use the developer version and doing the dependency check before that. Even though that, as you said, it won't give optimisations (which I don't fully understand - the optimisations are in your github binaries but cannot be generated through compilation?)

On a side note, maybe you want to (re)consider doing a dependency check in your this_dev_install() function like you are doing in the this_install() function as defined in your setup_common script? Just for the ease of first time developers?

Regards,

Tom

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Tue Jan 27, 2015 8:51 pm

Hi

after extensive testing and using I have added an installer for OpenVPN. The script will install and configure OpenVPN on your Pi using the Howto's found on the top listing of Google Search. I am pretty excited that this worked out well as at first this certificate-and-key stuff looked too complicated as people use all sorts of different ways to install openvpn on the raspberry pi (with various comments and explanation on why).

This one is sure to work on a clean Raspbian/Wheezy image as provided on raspberrypi.org (last tested: 2014-12-24). It makes your Raspberry Pi a VPN server for various clients. This way you can access your private network services (at least many of them) through VPN.

It also allows you to create many ovpn files to include for enrollment of clients. The certificates etc are included in the OVPN so you can mail them your your mobile device and import them using the OpenVPN client.

If you use the full nazverrypie installer, a samba entry to the ovpn files is automatically created so the files will be ready for deployment. Don't forget to delete them after use, as they contain private keys!! Next, it will configure the raspberry pi firewall to allow for internet browsing through the VPN.

If you don't want to use the full installer, don't worry as either the openvpn.sh script as well as the make_vpn_client.sh can be used seperately. For instance:

Code: Select all

sudo bash /etc/openvpn/ovpn/make_vpn_client iPhone_John 
will make a configuration file ready to import on a mobile device.

Code: Select all

sudo bash openvpn.sh MyServerName
Will install openvpn using the servername MyServerName, invoke client creation and will automatically detect the WANIP and use default port 1194.

Scripts are downloaded from sourceforge.

OpenVPN:

Code: Select all

sudo wget https://sourceforge.net/p/nazverrypie/code/ci/master/tree/openvpn.sh?format=raw -O /home/pi/openvpn.sh
OVPN client maker:

Code: Select all

wget https://sourceforge.net/p/nazverrypie/code/ci/master/tree/make_vpn_client.sh?format=raw -O /home/pi/make_vpn_client.sh


Please note:
- ta.key not yet implemented (having issue sticking ta.key to the ovpn file. Anyone have example ovpn with ta.key embedded?)
Last edited by tommertom on Sun Feb 08, 2015 5:06 pm, edited 1 time in total.

swe_toast
Posts: 25
Joined: Wed Jan 28, 2015 9:39 am

Re: NAZverryPie - Scripting of Home NAS using best of the We

Wed Jan 28, 2015 9:54 am

wanna recommend ajenti instead of webmin or just include ajenti as an option

http://support.ajenti.org/topic/436874- ... -raspbian/

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Wed Jan 28, 2015 6:59 pm

Hi

Just checked it out and Ajenti seems faster and more functions (terminal e.g.) than Webmin. Why would you prefer?

I already included it and testing. Install procedure is very simple. Example for other software packages if you ask me (and would make Nazverrypie obsolete).

Thx

Tom

Piroman
Posts: 6
Joined: Sat Feb 07, 2015 11:04 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 1:51 am

@tommertom

Here are client.conf with ta.key . if you still lookinng for it .
If is that you looking for ?!?


http://goo.gl/k1baIg

Piroman
Posts: 6
Joined: Sat Feb 07, 2015 11:04 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 12:05 pm

You can put option for dynamic IP users for ddns , just option to put ddns address ? :)

i use http://www.duckdns.org for my VPN .It work nice with RPI .

Piroman
Posts: 6
Joined: Sat Feb 07, 2015 11:04 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 1:19 pm

I just tested your script for OpenVPN . I's nice and work ! :)

I change in :

client.conf :
manualy put ta.key lines and enable tls-auth ta.key 1 in .ovpn

server.conf:
enabled
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0 # This file is secret

Work with android app OpenVPN Client Free and .ovpn file (need manualy set Authentication/Use TLS HMAC auth./Direction 1 (default is "none")

I will try to play vith your script to make ta.key work by default automata ! ;)

THX for this script . i Work with kids and RPI this is nice exemple for "sed" functions . :idea:
Last edited by Piroman on Sun Feb 08, 2015 5:13 pm, edited 1 time in total.

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 5:05 pm

Dear Piroman,

Thx for the comments and support.

I will try the ovpn again with your suggestions.

DuckDNS shouldn't be too difficult to add (just need to automatic crontab -e addition which shouldnt be a hassle either). I guess there are more ddns services (noip, etc) available, but I'll stick to the ones I can test myself anyway.

Rgdz

Tom

Piroman
Posts: 6
Joined: Sat Feb 07, 2015 11:04 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 5:17 pm

And ,is upgrade of OpenVPN delete all keys ?

if yes then you can move keys/ to another directory !?

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sun Feb 08, 2015 7:44 pm

Hi
I wouldn't use this script to upgrade an fully installed,configured and working openvpn version on your pi
Tom

SA3DX
Posts: 1
Joined: Tue Aug 05, 2014 10:58 am

Re: NAZverryPie - Scripting of Home NAS using best of the We

Sat May 02, 2015 5:12 pm

Great project, just what I was looking for. Did you happen to add Transmission in the script? ( I saw that in the 2nd post but not in OP edit ) And do you know how big these are ? like ( ?? GBs ).

And thank you very much for this work.

tommertom
Posts: 13
Joined: Mon Sep 15, 2014 1:12 pm

Re: NAZverryPie - Scripting of Home NAS using best of the We

Mon May 04, 2015 7:07 pm

Hi

Thx. But did not add Transmission. I am not a BitTorrent user and have not yet the time to work on it.

A short look at the installation routine shows it may indeed require some scripting.

Tom

Return to “Other projects”