This Article is Under Construction!

FreeNAS/Installation

From SETV Springfield Technical Wiki
Revision as of 02:06, 16 September 2016 by Setvadmin (talk | contribs) (NextCloud Install)

Jump to: navigation, search

This guide is how to install the FreeNAS OS on the Archive Server.

These are, at first, notes from a VirtualBox test setup, and then confirmed in the production environment.

Install FreeNAS on USB using Win32USB or Unetbootin

Set BiOS to read USB drive FIRST. Keep USB Key forever in the same slot to make things easy.

Engadget HOW-TO

Getting Started/Downloading

Fig.1 GRUB Installer Screen
(Fig. 2) FreeNAS Installer Main Screen

Download the latest version

Using either unetbootin, or iso2usb copy the ISO to a bootable flashdrive

Insert flash drive PLUS a secondary flash drive 8GB or higher into the Server (FreeNAS will run off a USB flash drive because the OS does not utilize the drive it runs on.)

Fig. 3 Drive Selection in FreeNAS Installer Note: This was taken using a virtualBox, drive letters and info will differ!
Fig. 4 Confirm Drive Selection

Set BiOS to see USB FIRST

Boot to USB and Follow Instructions

Select FreeNAS Installer (Fig.1)

Select Install/Upgrade (Fig. 2)

Select the USB Drive from the selection screen. (Fig. 3)

YOU MUST SELECT THE RIGHT DRIVE! SELECT THE 8GB/16GB USB FLASH DRIVE!

Fig. 5 Enter in new Root Password
Fig. 6 End

Confirm the Drive you selected (Fig. 4)

Enter in Root Password (Fig. 5)

ENTER IN A REALLY REALLY STRONG PASSWORD!

Let the installation go and follow the rest of the prompts.





Run FreeNAS for the First Time

Console Setup Screen when you first boot. (Note http://IP will be different)

Console Screen

Let everything load and you'll be greeted with the Console Screen.

We have to manually set the IP Address. Our network will probably give you the right IP address to use, but we need to make it static.

Select 1

It will list available network interfaces. The Archive/Nextcloud Server has 2 available network ports. You should find and connect to the eth0 port.

Since we're using eth0, type 1 and hit Enter

IPV4Setup.jpg

Delete Interface: N

Reset network configuration: N

Configure interface for DHCP? N

Configure IPv4? Y

Interface name: eth0

Configure IPv4

After making note of the IP address given at the beginning, reassign it with that same IP address. Set the NetMask to 255.255.255.0 (the same as any regular machine on the network)

Configure DNS

Set up DNS as below:








Logging In for the First Time

If you did everything right, and navigate to the IP Address listed on the console, you should be greeted with the below screen:

Create root password

You need to create the root password.

Make it strong, this is the root account, meaning it has God-like control over the computer and is accessible from the internet!

MAKE THE PASSWORD STRONG!

Once you set the password, you'll be taken to the the FreeNAS main screen.

System Information

Change the Hostname from freenas.local to SETV-005-CLOUD.ssdcougars.org

Insert steps on adding it to school's domain

Setting up ZFS Drives













NextCloud Install

Check Setting Up Owncloud on FreeNAS

NOTES FROM TEST:

NSTALLATION

FreeNAS WebUI

Storage > Create ZFS Dataset

  • Dataset Name = files
  • Compression level = lz4
  • Enable atime = Off
  • Dataset Name = db
  • Compression level = zle
  • Enable atime = Off
  • Record Size = 16K

Jails > Add Jails

Add a standard ("----------") jail. Name it "nextcloud"

Select nextcloud jail

FreeNAS WebUI

Add Storage

  • Source = /mnt/Cloud/files
  • Destination = /mnt/files
  • Source = /mnt/Cloud/db
  • Destination = /var/db/mysql

Console in FreeNAS's userland

$ zfs set primarycache=metadata SETV_Cloud/db

Console in NextCloud jail

Code:

pkg upgrade
pkg install nginx mariadb101-server redis php70-bz2 php70-ctype php70-curl php70-dom php70-exif php70-fileinfo php70-filter php70-gd php70-hash php70-iconv php70-intl php70-json php70-mbstring php70-mcrypt php70-pdo_mysql php70-openssl php70-posix php70-session php70-simplexml  php70-xml php70-xmlreader php70-xmlwriter php70-xsl php70-wddx php70-zip php70-zlib php70-APCu php70-redis
sysrc 'nginx_enable=YES' 'php_fpm_enable=YES' 'mysql_enable=YES' 'redis_enable=YES'
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Install NextCloud [1][2]

Code:

http {
   include      mime.types;
   default_type  application/octet-stream;
   sendfile        off;
   keepalive_timeout  65;
   gzip off;
server {
       root /usr/local/www;
       location = /robots.txt { allow all; access_log off; log_not_found off; }
       location = /favicon.ico { access_log off; log_not_found off; }
       location ^~ /nextcloud {
           client_max_body_size 512M;
           error_page 403 /nextcloud/core/templates/403.php;
           error_page 404 /nextcloud/core/templates/404.php;
           location /nextcloud {
               rewrite ^ /nextcloud/index.php$uri;
           }
           location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
               deny all;
           }
           location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
               deny all;
           }
           location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
               fastcgi_split_path_info ^(.+\.php)(/.*)$;
               include fastcgi_params;
               fastcgi_pass unix:/var/run/php-fpm.sock;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param front_controller_active true;
               fastcgi_intercept_errors on;
           }
           location ~* \.(?:css|js)$ {
               try_files $uri /nextcloud/index.php$uri$is_args$args;
               add_header Cache-Control "public, max-age=7200";
           }
           location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
               try_files $uri /nextcloud/index.php$uri$is_args$args;
           }
       }
   }
}

/usr/local/etc/php.ini

Code:

cgi.fix_pathinfo=0 
date.timezone = America/New_York

Jails[3][4]:

Create Debian Jail; leave checkboxes alone

Within standard jail, need to update pkg:

              $ portsnap fetch extract
              $ cd /usr/ports
              $ make deinstall; 
              $ cd /usr/ports/ports-mgmt/pkg 
              $ make deinstall 
              $ maek reinstall
              $ cd /../.. 
              $ make reinstall
              $ pkg update
             
  1. https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
  2. https://www.howtoforge.com/tutorial/owncloud_9-installation-on-debian_8/
  3. http://www.freebsdonline.com/content/view/1052/528/
  4. https://blog.jon.im/2015/10/02/you-must-upgrade-the-ports-mgmtpkg-port-first/