Creating a Jail using TheBrig on Your Nas4Free

In this article we’ll go through installing ownCloud inside a jail.

In this particular example I’m going to use a script to setup our jail known as TheBrig.

Click here for video tutorial of this post.

We’ll need the following before we get started:

  • Putty – a windows application that allows us to log into our NAS remotely and run commands
  • Enable SSH on our NAS
  • Some scripts to install TheBrig from the Nas4Free forums

Putty

Before we can log into our Nas4Free using putty we need to enable ssh.

Services -> SSH

1b SSH Enable root

  • Back on our Windows Desktop run putty that we just downloaded.
  • Put in your Nas4Free IP address in the “Host Name or IP” address then click “Open”

4a Putty

  • First time it will pop up with a security alert click yes to continue

4b Putty Securty Alert

SSH (Secure SHell)

 

  • Log in using your NAS4Free password and “root” as the user4c login root

 

 

  • First we’ll navigate to our home directory to download the install scripts instead of installing into the root home path
    • cd /mnt/PoolData/cloud

4d cloud home dir root

  • Fetch the script to install TheBrig into the current location with the following
    • fetch -o thebrig_install.sh https://github.com/fsbruva/thebrig/raw/working/thebrig_install.sh

4e fetch thebrig script small

  • Make the file executable
    • chmod a+x thebrig_install.sh

4f chmod small

  • Run the script using the following commands replacing your pool and dataset name but also note the trailing number 2. It’s important otherwise it’ll most likely fail
    • /bin/sh thebrig_install.sh /mnt/your_pool_name_here/your_dataset_name_here 2
    • Installation success

4g TheBrig installed

 

Creating the Jail

Now that we’ve installed the script we need to go back to the NAS4Free GUI and create the jail from there

  • Before we can see TheBrig we need to refresh the page then you will see a new tab called “Extensions
  • On first run you’ll see lots of red alerting you that you need to confirm the installation directory so lets go ahead and do that by clicking on the blue writing which says “Rudimentary Config

5 TheBrig

  • On this page check the installation folder then click “Save” and it will automatically fill in the Advanced section

5a Rudimentary config

  • Click “Tarball Management” and click “Query”

5b Tarball Query

  • Tick “base.txz” and if you have installed your NAS on a 64bit system you’ll also need the “lib32.txz”, select the release the click “Fetch!”

5c Tarball Fetch

  • Click ok then wait a while for it to download the required files if you refresh the page you’ll see the download status

5d download status

  • Once it’s finished downloading Go back to “Current Jails” and click the “+” to create a new jail

5e Create new jail

  • Through trial and error there are a few options here that seem irrelevant but will cause you much headaches so I’ve highlighted each item that I had to use to get the jail to work trouble free for me
    • Jail number obviously you have have many jails but leave 1 if its your only one
    • Jail name – give it a short but descriptive name
    • Choose the Jail Type – click on the help button to read more about the different types – I’ve always used “Full”
    • Jail IP – choose an IP address for your jail this will also be the IP for your owncloud and for most change the “32” after the slash to “24”
    • Click “enable” for the jail to start on boot
    • Click on “Enable automount devfs”
    • In “User command 1” put in this text “/bin/sh /usr/local/etc/rc.d/lighttpd onestart
    • This script will force the webserver to autostart on boot for the jail to work properly
      • There is a bug in “User command 0” so don’t use it
    • Official FreeBSD Flavor – these must be ticked for the jail to get created and easily missed!
    • Check that everything has been ticked and then click “Add”

5f Brig Config 1

5f Brig Config 2

  • It will take a few moments then it will take you back to the jail page click “Apply changes”
  • Click the green button to activate the jail

5g Jail Created

 

 Congratulations on your first jail!

 

5h Jail running

 

 

Click here to see how to install ownCloud inside your jail.

Tags: