This page is constantly being edited and worked on. Most of these should work but some might be broken.
Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.
My current setup:
- Emby2/20/17
- Plex1/1/17
- PlexPy
- Ombi1/1/17
- Sonarr1/1/17
- Radarr1/1/17
- Subsonic2/4/17
- Headphones
- Transmission2/26/17
- UNIFI1/1/17
- Nginx,PHP FastCGI (FMP), Muximux, Certbot
- Jackett2/17/17
Configuration:
Other Apps:
- SickRage
- Sabnzbd
- Couch Potato
- get_iplayer
- Madsonic
- Deluge1/1/17
- nzbget
- LEMP Server - FreeBSD, Nginx, MariaDB & PHP FastCGI (FMP)
- Nginx Webserver
- Baïkal
- ZoneMinder
- Alramserver
- Calibre
- TT-RSS
- NextCloud
- Crashplan
Gist is awesome, and currently this write-up is written in Markdown. Unfortunately that means you'll have to replace a bunch of references to:
- tetra: My zpool
- 192.168.1.2: My static FreeNAS ip
- 192.168.1.3: My static media jail ip
- 192.168.1.4: My static backup jail ip
Along with that be sure to keep paths consistent between your builds. It is easy to forget if you SSH'd into FreeNAS or into the jail.
Additionally, do not copy/paste entire chunks of commands. I often skip over different yes/no options for brevity in this guide. Read what the prompt says and feel free to drop a comment if answers seem ambiguous.
Create a jail using the FreeNAS web UI
Jail name: media_jail
IPv4 address: 192.168.1.3/24
autostart: checked
type: pluginjail
VIMAGE: unchecked
vanilla: checked
sysctls: allow.raw_sockets=true,allow.sysvipc=true
ssh [email protected]
jls
jexec 17 tcsh
passwd
portsnap fetch extract
portsnap fetch update
sysrc sshd_enable=YES
sysrc ftpd_enable=YES
cd /usr/ports/ports-mgmt/pkg/ && make deinstall
cd /usr/ports/ports-mgmt/pkg/ && make install clean
pkg2ng
cd /usr/ports/ports-mgmt/portmaster && make config-recursive install clean
cd /usr/ports/devel/git && make config-recursive install clean
cd /usr/ports/devel/py-cheetah && make config-recursive install clean
Create a 'media' user and create media directory
mkdir /mnt/media
adduser
Username : media
Password : <blank>
Full Name : Media
Uid : 1001
Class :
Groups : media
Home : /home/media
Home Mode :
Shell : /bin/tcsh
Locked : no
id media
Create this user in your FreeNAS with the same uid and gid (typically 1001 if you haven't made a custom account yet).
Add mounts for media + crashplan backups inside the jail (/mnt//media to /mnt/media).
pkg update && pkg upgrade
pkg install -y transmission-daemon
# did not need this one
sysrc transmission_conf_dir="/var/db/transmission"
sysrc transmission_download_dir=""
sysrc transmission_enable="YES"
# you might need to change the white list in settings.json to 0.0.0.0
restart jail use your browser and navigate to jail_ip:9091
https://github.com/Jackett/Jackett/releases https://forums.freenas.org/index.php?threads/need-help-installing-jackett-on-freenas-in-a-jail.38384/
pkg update && pkg upgrade
pkg install -y mono curl
cd /usr/local/
fetch https://github.com/Jackett/Jackett/releases/download/v0.7.923/Jackett.Binaries.Mono.tar.gz
tar -zxvf Jackett.Binaries.Mono.tar.gz
rm Jackett.Binaries.Mono.tar.gz
echo "/usr/local/bin/mono /usr/local/Jackett/JackettConsole.exe" >> /etc/rc.d/jackett
chmod 555 /etc/rc.d/jackett
restart jail
use your browser and navigate to jail_ip:9117
Update
cd /usr/local/
fetch https://github.com/Jackett/Jackett/releases/download/v0.7.923/Jackett.Binaries.Mono.tar.gz
tar -zxvf Jackett.Binaries.Mono.tar.gz
rm Jackett.Binaries.Mono.tar.gz
pkg update && pkg upgrade
pkg install -y emby-server
sysrc emby_server_enable=YES
service emby-server start
# Update FreeBSD ports tree
portsnap fetch update
# might need to run this, watch log closely
portsnap extract
# Remove default FFMpeg package
pkg delete -f ffmpeg
# Reinstall FFMpeg from ports with lame option enabled
cd /usr/ports/multimedia/ffmpeg
make config
# enable the lame option
# enable the ass subtitles option
# enable the opus subtitles option
# enable the x265 subtitles option
# last step
make install clean
use your browser and navigate to jail_ip:8096
https://github.com/Sonarr/Sonarr/wiki/Installation-FreeBSD
pkg install sonarr
sysrc sonarr_enable=YES
pkg upgrade
service sonarr start
# not the best option but works for in app updates
chmod 777 /usr/local/share/sonarr
use your browser and navigate to jail_ip:8989
Updating Sonarr
pkg upgrade sonarr or though the web interface
pkg install -y plexmediaserver
sysrc plexmediaserver_enable=YES
service plexmediaserver start
ln -s /mnt/myVol/jails/plex/usr/local/plexdata/Plex\ Media\ Server/Logs/ Plex\ Logs
use your browser and navigate to jail_ip:32400/web
Updating Plex
pkg upgrade plexmediaserver
Might be an issue:There has been new security settings added and there was a problem with the plex scanner making a request to a local agent. To fix it you should add 192.168.1.0/24
to Settings -> Server -> Network -> Enabled Advanced -> "List of IP Address and networks that are allowed without auth" add 192.168.1.0/24
. After that, click refresh all and the scanner should be able to connect to the local agent.
https://github.com/tidusjar/Ombi/releases https://forums.freenas.org/index.php?threads/plex-request-or-similar.42187/
pkg update && pkg upgrade
pkg install -y mono screen
echo 'jail_sysvipc_allow="YES"' >> /etc/rc.conf
fetch https://github.com/tidusjar/Ombi/releases/download/v2.0.1/Ombi.zip
unzip Ombi.zip
mv Release /usr/local/Ombi
rm Ombi.zip
touch /etc/rc.d/ombi
echo "/usr/local/bin/screen -d -m -S root nohup /usr/local/bin/mono /usr/local/Ombi/Ombi.exe" >> /etc/rc.d/ombi
chmod 555 /etc/rc.d/ombi
restart jail
use your browser and navigate to jail_ip:3579
https://github.com/Radarr/Radarr/releases https://github.com/Radarr/Radarr
pkg update && pkg upgrade
pkg install -y mono mediainfo sqlite3
#needed this to stop error:Could not find libgdiplus. Cannot test if image is corrupt.: Couldn't load GDIPlus library
pkg install libgdiplus
cd /usr/local/
fetch https://github.com/Radarr/Radarr/releases/download/v0.2.0.210/Radarr.develop.0.2.0.210.linux.tar.gz
tar -zxvf Radarr.develop.0.2.0.210.linux.tar.gz
rm Radarr.develop.0.2.0.210.linux.tar.gz
echo "/usr/local/bin/mono /usr/local/Radarr/Radarr.exe" > /etc/rc.d/radarr
chmod 555 /etc/rc.d/radarr
#this is needed for updates within Radarr
ln -s /usr/local/bin/mono /bin
restart your jail
use your browser and navigate to jail_ip:7878
Updating Radarr
Updating is done through the web interface
https://www.freshports.org/net-mgmt/unifi5/ https://forums.freenas.org/index.php?threads/how-i-installed-unifi-controller.40193/
pkg update && pkg upgrade
pkg install -y mongodb unifi5
sysrc mongod_enable="YES"
sysrc unifi_enable="YES"
restart your jail
use your browser and navigate to jail_ip:8443
cd /usr/local && git clone https://github.com/JonnyWong16/plexpy.git
chown -R media:media plexpy
cp /usr/local/plexpy/init-scripts/init.freebsd /usr/local/etc/rc.d/plexpy
chmod +x /usr/local/etc/rc.d/plexpy
sysrc plexpy_enable=YES
sysrc plexpy_user=media
sysrc plexpy_dir=/usr/local/plexpy
sysrc plexpy_port=8083
cd /usr/ports/news/sabnzbdplus && make config-recursive install clean
chown -R media:media sabnzbd
sysrc sabnzbd_enable=YES
sysrc sabnzbd_user=media
sysrc sabnzbd_group=media
cd /usr/local && git clone git://github.com/SickRage/SickRage.git sickrage
chown -R media:media sickrage
cp /usr/local/sickrage/runscripts/init.freebsd /usr/local/etc/rc.d/sickrage
sysrc sickrage_enable=YES
sysrc sickrage_user=media
sysrc sickrage_group=media
cd /usr/local && git clone git://github.com/RuudBurger/CouchPotatoServer.git couchpotato
chown -R media:media couchpotato
cp /usr/local/couchpotato/init/freebsd /usr/local/etc/rc.d/couchpotato
chmod +x /usr/local/etc/rc.d/couchpotato
sysrc couchpotato_enable=YES
sysrc couchpotato_user=media
sysrc couchpotato_group=media
sysrc couchpotat_dir=/usr/local/couchpotato
pkg update && pkg upgrade
pkg install py27-sqlite3 py27-cheetah
cd /usr/local && git clone git://github.com/rembo10/headphones.git
chown -R media:media headphones
cp /usr/local/headphones/init-scripts/init.freebsd /usr/local/etc/rc.d/headphones
chmod +x /usr/local/etc/rc.d/headphones
sysrc headphones_enable=YES
sysrc headphones_user=media
sysrc headphones_group=media
# edit rc.d/headphones, change python lcation to /usr/local/bin/python
use your browser and navigate to jail_ip:8181
https://project.altservice.com/issues/752
pkg update && pkg upgrade
pkg install subsonic-standalone
sysrc subsonic_enable=YES
service subsonic start
use your browser and navigate to jail_ip:4040
# edit usr/local/etc/rc.d/subsonic if you want web index /subsonic
# turn off transcoding for each player in Subsonic settings
# add storage and media folders
# change admin password and grant access to music folders
Discovered madsonic only recently (quite a surprise!). Looks like a great fork of subsonic that includes a number of features for free compared to subsonic. The port depends on jetty server and other stuff. I prefer to use openjdk and a standalone install as done below. Use the madsonic start script also attached to the gist.
pkg update && pkg upgrade
pkg install jdk8-jre
mkdir -p /usr/local/madsonic && cd /usr/local/madsonic
wget -Omadsonic.tar.gz http://madsonic.org/download/6.0/20160122_madsonic-6.0.7960-standalone.zip
tar -zxvf madsonic.tar.gz
rm madsonic.tar.gz
chown -R media:media /usr/local/madsonic
vi /usr/local/etc/rc.d/madsonic
# Use the file "madsonic" attached below
chmod a+x /usr/local/etc/rc.d/madsonic
sysrc madsonic_enable=YES
sysrc madsonic_user=media
sysrc madsonic_group=media
sysrc madsonic_bin=/usr/local/madsonic/madsonic.sh
sysrc madsonic_podcast_folder=/mnt/media/music/podcasts
sysrc madsonic_playlist_folder=/mnt/media/music/playlists
Here is the madsonic launch script to use.
https://forums.freenas.org/index.php?threads/install-deluge-in-a-jail.28778/page-3 Uncheck option for GTK during configuration.
cd /usr/ports/net-p2p/deluge-cli && make WITHOUT_X11=yes config-recursive install clean
mkdir -p /usr/local/deluge
chown -R media:media /usr/local/deluge
sysrc deluged_enable=YES
sysrc deluged_user=media
sysrc deluged_group=media
sysrc deluged_confdir=/usr/local/deluge
sysrc deluge_web_enable=YES
sysrc deluge_web_user=media
sysrc deluge_web_group=media
sysrc deluge_web_confdir=/usr/local/deluge
or try this
pkg update && pkg upgrade
pkg install deluge-cli
pw useradd -n deluge -u 1001 -c "Deluge BitTorrent Client" -s /sbin/nologin -w no
echo 'deluged_enable="YES"' >> /etc/rc.conf
echo 'deluged_user="deluge"' >> /etc/rc.conf
echo 'deluge_web_enable="YES"' >> /etc/rc.conf
echo 'deluge_web_user="deluge"' >> /etc/rc.conf
mkdir -p /home/deluge/.config/deluge
chown -R deluge:deluge /home/deluge/
ee /etc/group
in that file, add or modify the line to make the deluge user member of the media group:
media:*:1000:deluge
[Esc], [a], [a] to save and close the file
/usr/local/etc/rc.d/deluged start
Go with your web browser to: http://<your jail ip>:8112
pw is "deluge" without the quotes
#enable plugins
mkdir /.python-eggs
chmod 755 /.python-eggs
service deluge_web stop
edit the following line in /home/deluge/.config/deluge/web.conf from
Code:
"default_daemon": "",
to
Code:
"default_daemon": "127.0.0.1:58846",
service deluge_web start
pkg install calibre
sysrc calibre_enable=YES
sysrc calibre_port=8082
sysrc calibre_user=media
sysrc calibre_group=media
sysrc calibre_library=/mnt/media/books
For PHP5-extensions, include: bz2 ctype curl ftp dom exif fileinfo gd gmp iconv json ldap mbstring mcrypt mysql mysqli openssl pdo_mysql pdo_pgsql pdo_sqlite pgsql xsl zip zlib
For PHP5, include: FPM
pkg install -y nginx mysql56-server postgresql94-server php56-extensions
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
cd /usr/local/etc/nginx && cp nginx.conf-dist nginx.conf && cp mime.types-dist mime.types
sysrc nginx_enable=YES
sysrc php_fpm_enable=YES
sysrc mysql_enable=YES
sysrc postgresql_enable=YES
service postgresql initdb
service postgresql start
service mysql-server start
mysql_secure_installation
su pgsql
passwd
Modify nginx.conf similar to the attached nginx.conf file. Make sure to pay close attention to where "root" is and "location ~ .php$". You can overwrite the file with ":wq!"
Create a similar index.html as below in folder /usr/local/www.
cd /usr/ports/www/nextcloud && make config-recursive install clean
su pgsql
createdb ocdb
psql -s ocdb
create user <user> password <password>
GRAND ALL PRIVELEGES ON DATABASE ocdb TO <user>
Helpful link: http://tt-rss.org/forum/viewtopic.php?f=16&t=911
cd /usr/ports/www/tt-rss && make config-recursive && make install clean
sysrc ttrssd_enable=YES
mysql -u root -p
CREATE DATABASE ttrssdb;
GRANT ALL ON ttrssdb.* TO ttrssuser IDENTIFIED BY "pick some random long password with lots of words BLAMMY";
quit;
chown -R www:www /usr/local/www/tt-rss
rm /usr/local/www/tt-rss/config.php
Sonarr:pkg upgrade sonarr
Radarr: through the web interface
Plex: pkg upgrade plexmedia-server
Plexpy : through web interface
Important files
Sonarr: download backup through web interface or nzbdrone.db config.xml
Radarr: download backup through web interface or nzbdrone.db config.xml
Unifi: download backup through web interface
Ombi: Ombi.sqlite
Headphones: headphones.db config.ini
Plexpy
/usr/local/plexpy/config.ini
/usr/local/plexpy/plexpy.db
/usr/local/plexpy/plexpy.log
/usr/local/plexpy/backups
Emby
/var/db/emby-server/config
/var/db/emby-server/plugins
/var/db/emby-server/data/collections
/var/db/emby-server/data/playlists
/var/db/emby-server/data/displaypreferences.db
/var/db/emby-server/data/userdata_v2.db (if present)
/var/db/emby-server/data/users.db
Additionally, backup the library database file, but put it into a separate place from the others. This file will not be copied into your new Emby Server installation, but we will migrate your user data, such as watched data, favorites, etc.
/ProgramData/data/library.db
You'll need a Sqlite database editor such as DB Browser for Sqlite.
You'll need to open the old library.db file, then attach the new library.db file. You can then migrate the data using:
REPLACE INTO NewDB.userdata SELECT * FROM userdata
Install Emby on the new machine as you normally would. When the startup wizard launches in the browser, do not complete it and instead shut down the server.
Now take all of the files you backed up from the old server and copy them into the equivalent locations on the new server.
Then launch the new server, sign into the dashboard and setup your library paths. Allow the scan to complete as normal.
https://emby.media/community/index.php?/topic/10427-how-to-migrate-media-browser-server/
Sickbeard replacement: sickbeard.db and config.ini
Sabnzbd replacement: sabnzbd.ini
Couch potato replacement:
Plex: not worth it
Moving over databases and config files from plugins Log into FreeNAS
cp /mnt/tetra/plugins_1/usr/pbi/sickbeard-amd64/data/config.ini /mnt/tetra/media_jail/usr/local/sickbeard
cp /mnt/tetra/plugins_1/usr/pbi/sickbeard-amd64/data/sickbeard.db /mnt/tetra/media_jail/usr/local/sickbeard
cp /mnt/tetra/plugins_1/usr/pbi/sabnzbdplus-amd64/sabnzbd/sabnzbd.ini /mnt/tetra/media_jail/usr/local/sabnzbd
cp /mnt/tetra/plugins_1/usr/pbi/headphones-amd64/data/config.ini /mnt/tetra/media_jail/usr/local/headphones/
cp /mnt/tetra/plugins_1/usr/pbi/headphones-amd64/data/headphones.db /mnt/tetra/media_jail/usr/local/headphones/
cp /mnt/tetra/plugins_1/usr/local/CouchPotatoServer/data/settings.conf /mnt/tetra/media_jail/usr/local/CouchPotatoServer/data
cp /mnt/tetra/plugins_1/usr/local/CouchPotatoServer/data/couchpotato.db /mnt/tetra/media_jail/usr/local/CouchPotatoServer/data
Make sure your settings move across the boundary. Daemons might not start up if ip's, filepaths, etc. are different.
https://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.0/userguide-9.0/ch24s04.html
cd /directorypath : Change to directory.
chmod [options] mode filename : Change a file’s permissions.
chown [options] filename : Change who owns a file.
cp [options] :source destination : Copy files and directories.
ln -s test symlink : Creates a symbolic link named symlink that points to the file test
mkdir [options] directory : Create a new directory.
mv -i myfile yourfile : Move the file from "myfile" to "yourfile". This effectively changes the name of "myfile" to "yourfile".
mv -i /data/myfile : Move the file from "myfile" from the directory "/data" to the current working directory.
rm [options] directory : Remove (delete) file(s) and/or directories.
tar [options] filename : Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz).
touch filename : Create an empty file with the specified name.
service [name of service] start
service [name of service] stop
service [name of service] restart
pkg install python
pkg install py27-tornado py27-OpenSSL
cd /usr/local/share/
git clone https://github.com/juggie/AlarmServer
change the config example file
cd usr/local/share/AlarmServer
python alarmserver.py
http://linoxide.com/unix/freebsd-11-webserver-nginx-mysql-php-7-0-fpm/
pkg install -y php70 php70-json php70-session php70-openssl php70-zlib
pkg install -y nginx git
sysrc nginx_enable=YES
sysrc php_fpm_enable=YES
cd /usr/local/www
git clone https://github.com/mescon/Muximux Muximux
service nginx start
look on here for how to configure nginx if you don't already have an nginx.conf or else move your nginx.conf, ssl certs, .htaccess to their proper locations
cd /usr/local/etc/
nano php-fpm.conf
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock
#Just uncomment these lines
listen.owner = www
listen.group = www
listen.mode = 0660
cd /usr/local/etc/
cp php.ini-production php.ini
nano php.ini
Set cgi.fix_pathinfo=0
sysrc php_fpm_enable=YES
service php-fpm start
cd /usr/local/www/nginx/
nano info.php
=====================
<?php phpinfo(); ?>
=====================
Test at http://<JAIL IP>/info.php
https://github.com/mescon/Muximux ''' pkg -y install git cd /usr/local/www git clone https://github.com/mescon/Muximux ''' move your settings.ini.php over if you have one Your settings.ini.php will never be overwritten if you use git pull or download the ZIP-file again
Create a jail using the FreeNAS web UI
Jail name: backup_jail
IPv4 address: 192.168.1./24
autostart: checked
type: portjail
VIMAGE: unchecked
vanilla: checked
Now add the directories you want to backup and where the backups should go.
Ports and dependencies
ssh [email protected]
jls
jexec 5 tcsh
passwd
portsnap fetch && portsnap extract && portsnap update
sysrc sshd_enable=YES
vi /etc/ssh/sshd_config
# add the following to the end of the file
Match User backup
AllowTcpForwarding yes
adduser # backup with Uid 1002
Download the java runtime in order to please the CrashPlan overlords (or alternatively, modify the crashplan port scripts): http://www.oracle.com/technetwork/java/javase/downloads/index.html Scroll down to Java SE 8u111/112 and click JRE Download (third button). Accept the license and download jdk-8u112-linux-i586.tar.gz. Then scp or ftp it over:
scp ~/Downloads/jdk-8u112-linux-i586.tar.gz [email protected]:/mnt/tetra/backup_jail/usr/ports/distfiles/
This is just to appease the makefile, and instead we will use OpenJDK's JRE anyways. The following takes quite a while to install.
Install java and crashplan
cd /usr/ports/java/openjdk8-jre/ && make config-recursive && make install clean
cd /usr/ports/sysutils/linux-crashplan/ && make config-recursive && make install clean
sysrc crashplan_enable=YES
Now change the default Java binary path:
vi /usr/local/share/crashplan/install.vars
JAVACOMMON=/usr/local/bin/java
Restart the jail. Now follow this guide to modify your current crashplan install to work on the remote machine. You will need to create a port bridge over ssh, which you can do with the following command (before starting up crashplan locally):
ssh -L 4200:localhost:4243 [email protected]
And grab the file /var/lib/crashplan/.ui_info from the server and bring it to your local host where you will run the crashplan desktop client.
Mounting USB drive:
kldload fuse
mkdir /mnt/usb
ntfs-3g /dev/da1s1 /mnt/usb
ntfs-3g -o permissions /dev/da1s1 /mnt/usb
Upgrading can be a royal pain... but fear not. Typically you can just run a portmaster -ad, and if it says "conflict... blah blah" just run "pkg delete -f " then re-run the portmaster command. Eventually everything should be updated! Many times the update process comes to a grinding halt because of dependency issues. You can kick off a single app to be updated similar below. You will also want to review /usr/ports/UPDATING if you run into trouble to see if a port has changed. There is usually a command to migrate a package such as a portmaster -o oldpackage newpackage
.
less /usr/ports/UPDATING
portsnap fetch update
cd /usrports/ports-mgmt/pkg && make install clean
cd /usr/ports/ports-mgmt/portmaster && make install clean
pkg version -l '<'
portmaster -Rafd
portmaster -fd news/sabnzbdplus
Rsync files
&rsync --progress --stats --recursive --times --perms --links --dry-run /mnt/tetra /mnt/usb/tetra
nohup foo &
rsync -az -H --delete --numeric-ids --stats --progress -e ssh [email protected]:/mnt/tetra/family /media/jacob/usb/tetra
rsync -az -H --delete --numeric-ids --stats --progress -e ssh [email protected]:/mnt/tetra/media_jail/usr/local/sickbeard/data/config.ini /media/jacob/usb/tetra/backup
cp
Copy server and daemon config files and databases
mkdir /mnt/tetra/backup/server_configs
cd /mnt/tetra/backup/server_configs
rsync -aqz /mnt/tetra/media_jail/usr/local/sickbeard/config.ini /mnt/tetra/media_jail/usr/local/sickbeard/sickbeard.db sickbeard/
rsync -aqz /mnt/tetra/media_jail/usr/local/sabnzbd/sabnzbd.ini sabnzbd/
rsync -aqz /mnt/tetra/media_jail/usr/local/headphones/config.ini /mnt/tetra/media_jail/usr/local/headphones/headphones.db headphones/
rsync -aqz /mnt/tetra/media_jail/usr/local/CouchPotatoServer/data/settings.conf /mnt/tetra/media_jail/usr/local/CouchPotatoServer/data/couchpotato.db couchpotato/
rsync -aqz /mnt/tetra/media_jail/usr/local/etc/nginx/nginx.conf /mnt/tetra/media_jail/usr/local/www/home/index.html nginx/
cd /mnt/tetra/backup/server_configs
rsync -aqz sabnzbd/sabnzbd.ini /mnt/tetra/media_jail/usr/local/sabnzbd/
rsync -aqz sickbeard/config.ini sickbeard/sickbeard.db /mnt/tetra/media_jail/usr/local/sickbeard/
rsync -aqz headphones/config.ini headphones/headphones.db /mnt/tetra/media_jail/usr/local/headphones/
rsync -aqz couchpotato/settings.conf couchpotato/couchpotato.db /mnt/tetra/media_jail/usr/local/CouchPotatoServer/data/
cd /usr/local && chmod -R media:media sabnzbd sickbeard headphones CouchPotatoServer
pkg install -y nano
pkg search nginx
pkg install -y nginx-1.8.0_3,2
cd /usr/local/etc/nginx/
mv nginx.conf nginx.conf.original
nano nginx.conf
=====================
# Define user that run nginx
user www;
worker_processes 2;
# Define error log
error_log /var/log/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# Define access log
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
# Define web data
root /usr/local/www/nginx;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx;
}
# Configuration for PHP-FPM
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
}
=====================
mkdir -p /var/log/nginx/
touch /var/log/nginx/{error,access}.log
cd /usr/local/www/
rm -r nginx
mkdir nginx
cp nginx-dist/index.html nginx/index.html
sysrc nginx_enable=YES
nginx -t # check that there are no errors
service nginx start
pkg search mariadb
pkg install -y mariadb100-server-10.0.22 mariadb100-client-10.0.22
cp /usr/local/share/mysql/my-medium.cnf /usr/local/etc/my.cnf
sysrc mysql_enable=YES
service mysql-server start
mysql_secure_installation
Enter current password for root (enter for none):
#Just press Enter here
Change the root password? [Y/n] Y
#Type your password for mariadb here
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
Test your connection:
mysql -u root -p<your password>
pkg search php56
pkg install -y php56-5.6.16 php56-mysqli-5.6.16
cd /usr/local/etc/
nano php-fpm.conf
Line 164:
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock
Line 175:
#Just uncomment these lines
listen.owner = www
listen.group = www
listen.mode = 0660
cd /usr/local/etc/
cp php.ini-production php.ini
nano php.ini
Set cgi.fix_pathinfo=0
sysrc php_fpm_enable=YES
service php-fpm start
cd /usr/local/www/nginx/
nano info.php
=====================
<?php phpinfo(); ?>
=====================
Test at http://<JAIL IP>/info.php
Create a dataset called media. Create your nzbget jail. Link the dataset to your jail under /mnt/nzbget SSH into the jail.
// Create nzbget folder structure.
cd /mnt/nzbget
mkdir dst inter log nzb queue scripts tmp
// This line not only installs nano but also updates pkg.
// Just ignore all of the "pkg: Skipping unknown key
// 'messages'" messages.
pkg install -y nano ffmpeg p7zip unrar
// Make 7z available to nzbToMedia
ln -s /usr/local/bin/7z /usr/bin/7z
ln -s /usr/local/bin/7za /usr/bin/7za
ln -s /usr/local/bin/7zr /usr/bin/7zr
// Install from ports... this will take a while.
portsnap fetch update
portsnap extract
cd /usr/ports/news/nzbget && make -DBATCH install clean
// Edit config
cp /usr/local/etc/nzbget.conf /usr/local/share/nzbget/nzbget.conf.template
nano /usr/local/etc/nzbget.conf
MainDir=/mnt/nzbget # Or whatever you have mapped your storage as.
WebDir=/usr/local/share/nzbget/webui
ConfigTemplate=/usr/local/share/nzbget/nzbget.conf.template
LogFile=${MainDir}/log/nzbget.log
LockFile=${TempDir}/nzbget.lock
WriteLog=rotate
ControlUsername=
ControlPassword=
// Add config to autostart
nano /usr/local/etc/rc.d/nzbget
${command} -D -c /usr/local/etc/nzbget.conf
// Autostart
sysrc nzbget_enable=YES
service nzbget start
If you also want to a VPN within the jail you can use this script:
https://gist.github.com/MikeRatcliffe/10dbd91d88a772d2e51e.
The script uses privateinternetaccess.com but it is easy to tweak the script to work with other providers.
NZBGet will be available at http://<your jail IP>:6789 Start the web interface and configure as you wish.
pkg install -y get_iplayer ffmpeg atomicparsley id3v2
sysrc get_iplayer_enable="YES"
sysrc get_iplayer_chdir="/mnt/downloads"
sysrc get_iplayer_listen_address=0.0.0.0
service get_iplayer start
Install a LEMP server
pkg install -y baikal
touch /usr/local/www/baikal/Specific/ENABLE_INSTALL
To finish installing Baikal:
1) Set up an httpd directive
See /usr/local/share/examples/baikal
2) touch /usr/local/www/baikal/Specific/ENABLE_INSTALL
3) Browse http://baikal/admin
4) rm /usr/local/www/baikal/Specific/ENABLE_INSTALL
Install Python as explained above then:
cd /usr/local && git clone git://github.com/RuudBurger/CouchPotatoServer.git
cp /usr/local/CouchPotatoServer/init/freebsd /usr/local/etc/rc.d/couchpotato
chmod +x /usr/local/etc/rc.d/couchpotato
sysrc couchpotato_enable=YES
sysrc couchpotato_user=root
service couchpotato start
pkg install -y git
cd /usr/local && git clone git://github.com/rembo10/headphones.git
chown -R media headphones && chgrp -R media headphones
cp /usr/local/headphones/init-alt.freebsd /usr/local/etc/rc.d/headphones
chmod +x /usr/local/etc/rc.d/headphones
sysrc headphones_enable=YES
sysrc headphones_user=media
pkg install -y nano fish zoneminder
sysrc zoneminder_enable=YES
service zoneminder start
ln -s /mnt/Mediaserver-Jails-Volume/jails/plexmediaserver/usr/local/plexdata-plexpass/Plex\ Media\ Server/Logs/ Plex\ Logs