├── .gitattributes ├── plex ├── README.md └── plex-install.sh ├── .travis.yml ├── mono ├── README.md └── mono-install.sh ├── sonarr ├── sonarr-update.sh ├── README.md └── sonarr-install.sh ├── qbittorrent ├── README.md └── qbittorrent-install.sh ├── radarr ├── README.md ├── radarr-update.sh └── radarr-install.sh ├── jackett ├── jackett-update.sh ├── README.md └── jackett-install.sh ├── Dockerfile ├── LICENSE ├── README.md └── setup.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /plex/README.md: -------------------------------------------------------------------------------- 1 | Plex 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | Plex lets you stream your media anywhere, on any device. 8 | 9 | Install 10 | ------- 11 | 12 | Just execute below code to install. 13 | 14 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/plex/plex-install.sh -O - -o /dev/null|bash` 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: shell 2 | 3 | sudo: required 4 | dist: bionic 5 | 6 | services: 7 | - docker 8 | 9 | script: 10 | - export SHELLCHECK_OPTS="-e SC2002" 11 | - find . -name "*.sh" -exec chmod +x {} \; 12 | - find . -name "*.sh" -print -exec shellcheck {} \; 13 | - docker build -t mediaserver . 14 | 15 | notifications: 16 | email: false 17 | -------------------------------------------------------------------------------- /mono/README.md: -------------------------------------------------------------------------------- 1 | Mono 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | Mono is a software platform designed to allow developers to easily create cross platform applications part of the .NET Foundation. 8 | 9 | Install 10 | ------- 11 | 12 | Just execute below code to install. 13 | 14 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/mono/mono-install.sh -O - -o /dev/null|bash` 15 | -------------------------------------------------------------------------------- /sonarr/sonarr-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sonarr-updater by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # working directory 9 | cd $installdir || exit 10 | 11 | echo "Updating sonarr. Please wait!" 12 | wget -q http://update.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz || exit 13 | # stop sonarr first 14 | service sonarr stop 15 | sleep 3 16 | tar -xzf NzbDrone.master.tar.gz 17 | rm -f NzbDrone.master.tar.gz 18 | chown -R $user:$user NzbDrone 19 | 20 | # start sonarr now 21 | service sonarr start 22 | 23 | echo "Update finished." -------------------------------------------------------------------------------- /qbittorrent/README.md: -------------------------------------------------------------------------------- 1 | qBittorrent 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | qBittorrent is a bittorrent client programmed in C++ / Qt that uses libtorrent (sometimes called libtorrent-rasterbar) by Arvid Norberg. 8 | 9 | It aims to be a good alternative to all other bittorrent clients out there. qBittorrent is fast, stable and provides unicode support as well as many features. 10 | 11 | 12 | Install 13 | ------- 14 | 15 | Just execute below code to install. 16 | 17 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/qbittorrent/qbittorrent-install.sh -O - -o /dev/null|bash` 18 | -------------------------------------------------------------------------------- /radarr/README.md: -------------------------------------------------------------------------------- 1 | Radarr 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | Radarr is an independent fork of Sonarr reworked for automatically downloading movies via Usenet and BitTorrent. 8 | 9 | 10 | Install 11 | ------- 12 | 13 | Just execute below code to install. 14 | 15 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/radarr/radarr-install.sh -O - -o /dev/null|bash` 16 | 17 | 18 | Update 19 | ------ 20 | 21 | Just execute below code to update. 22 | 23 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/radarr/radarr-update.sh -O - -o /dev/null|bash` 24 | -------------------------------------------------------------------------------- /radarr/radarr-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # radarr-updater by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # working directory 9 | cd $installdir || exit 10 | 11 | # stop radarr first 12 | service radarr stop 13 | 14 | echo "Updating radarr. Please wait!" 15 | wget -q "$( wget -qO- https://api.github.com/repos/Radarr/Radarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )" 16 | tar -xzf Radarr.develop.*.linux.tar.gz 17 | rm -f Radarr.develop.*.linux.tar.gz 18 | chown -R $user:$user Radarr 19 | 20 | # start radarr now 21 | service radarr start 22 | 23 | echo "Update finished." -------------------------------------------------------------------------------- /jackett/jackett-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # jackett-updater by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # working directory 9 | cd $installdir || exit 10 | 11 | # stop jackett first 12 | service jackett stop 13 | 14 | echo "Updating jackett. Please wait!" 15 | wget -q "$( wget -qO- https://api.github.com/repos/Jackett/Jackett/releases | grep Jackett.Binaries.Mono.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )" 16 | rm -rf Jackett 17 | tar -xzf Jackett.Binaries.Mono.tar.gz 18 | rm -f Jackett.Binaries.Mono.tar.gz 19 | chown -R $user:$user Jackett 20 | 21 | # start jackett now 22 | service jackett start 23 | 24 | echo "Update finished." -------------------------------------------------------------------------------- /sonarr/README.md: -------------------------------------------------------------------------------- 1 | Sonarr 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. 8 | 9 | 10 | Install 11 | ------- 12 | 13 | Just execute below code to install. 14 | 15 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/sonarr/sonarr-install.sh -O - -o /dev/null|bash` 16 | 17 | 18 | Update 19 | ------ 20 | 21 | Just execute below code to update. 22 | 23 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/sonarr/sonarr-update.sh -O - -o /dev/null|bash` 24 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # For testing with Travis-CI only 2 | # Build at your own risk 3 | 4 | # use latest debian 5 | FROM debian:stable-slim 6 | 7 | # install some required repo 8 | RUN apt-get update -qq 9 | RUN apt-get install sudo wget udev -qqy 10 | 11 | # set working directory 12 | WORKDIR /opt 13 | 14 | # disable swap 15 | ENV SWAP=no 16 | 17 | # copy repo to docker 18 | ADD . /opt/ 19 | 20 | # run script 21 | RUN ./mono/mono-install.sh \ 22 | && ./jackett/jackett-install.sh \ 23 | && ./jackett/jackett-update.sh \ 24 | && ./qbittorrent/qbittorrent-install.sh \ 25 | && ./sonarr/sonarr-install.sh \ 26 | && ./sonarr/sonarr-update.sh \ 27 | && ./radarr/radarr-install.sh \ 28 | && ./radarr/radarr-update.sh \ 29 | && ./plex/plex-install.sh 30 | 31 | # set default user 32 | USER mediaserver 33 | 34 | # entrypoint is bash 35 | ENTRYPOINT ["/bin/bash"] 36 | -------------------------------------------------------------------------------- /jackett/README.md: -------------------------------------------------------------------------------- 1 | Jackett 2 | ====== 3 | 4 | About 5 | ----- 6 | 7 | Jackett works as a proxy server: it translates queries from apps (Sonarr, Radarr, SickRage, CouchPotato, Mylar, DuckieTV, etc) into tracker-site-specific http queries, parses the html response, then sends results back to the requesting software. This allows for getting recent uploads (like RSS) and performing searches. Jackett is a single repository of maintained indexer scraping & translation logic - removing the burden from other apps. 8 | 9 | Install 10 | ------- 11 | 12 | Just execute below code to install. 13 | 14 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/jackett/jackett-install.sh -O - -o /dev/null|bash` 15 | 16 | 17 | Update 18 | ------ 19 | 20 | Just execute below code to update. 21 | 22 | `wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/jackett/jackett-update.sh -O - -o /dev/null|bash` 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sayem Chowdhury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pirates Mediaserver [![Build Status](https://travis-ci.org/sayem314/pirates-mediaserver.svg?branch=master)](https://travis-ci.org/sayem314/pirates-mediaserver) 2 | 3 | ## About 4 | 5 | This repository contains scripts for setting up a private media-server. This script can install Plex, Sonarr, Radarr and Jackett on the fly. 6 | 7 | ## Requirements 8 | 9 | At this moment only following distros are supported. 10 | 11 | | Debian | Ubuntu | CentOS | 12 | | :---------: | :---------: | :----------: | 13 | | Recommended | LTS Only | Experimental | 14 | | 7-9 | 12.04-16.04 | 6 & 7 | 15 | 16 | ## Install 17 | 18 | Just execute below code to install them all. 19 | 20 | `wget https://git.io/setup.sh -O - -o /dev/null|bash` 21 | 22 | To exclude certain apps follow these instructions: 23 | 24 | ### Step 1 25 | 26 | Download script: `wget https://git.io/setup.sh -O setup.sh` 27 | 28 | Make it executable: `chmod +x setup.sh` 29 | 30 | ### Step 2 31 | 32 | Now use variable like this: `PLEX=no JACKETT=No ./setup.sh` 33 | 34 | This will install everything else except Plex and Jackett. Hope this explain basic usage. 35 | 36 | _There is also specific install instruction available on each folder_ 37 | -------------------------------------------------------------------------------- /plex/plex-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # plex-installer by @sayem314 3 | 4 | echo "Installing plex. Please wait!" 5 | # Detecting apt-get/yum 6 | if hash apt-get 2>/dev/null; then 7 | # Detect architecture. We only support linux. 8 | if uname -m | grep -q 64; then 9 | wget -q https://downloads.plex.tv/plex-media-server-new/1.19.2.2737-b69929dab/debian/plexmediaserver_1.19.2.2737-b69929dab_amd64.deb 10 | elif uname -m | grep -q 86; then 11 | wget -q https://downloads.plex.tv/plex-media-server-new/1.19.2.2737-b69929dab/debian/plexmediaserver_1.19.2.2737-b69929dab_amd64.deb 12 | fi 13 | 14 | dpkg -i plexmediaserver*.deb 15 | rm -f plexmediaserver*.deb 16 | mkdir -p /var/plex/media 17 | chown plex:plex -R /var/plex/media 18 | echo "Install finished. Default port is 32400" 19 | elif hash yum 2>/dev/null; then 20 | # Detect architecture. We only support linux. 21 | if uname -m | grep -q 64; then 22 | wget -q https://downloads.plex.tv/plex-media-server-new/1.19.2.2737-b69929dab/redhat/plexmediaserver-1.19.2.2737-b69929dab.x86_64.rpm 23 | elif uname -m | grep -q 86; then 24 | wget -q https://downloads.plex.tv/plex-media-server-new/1.19.2.2737-b69929dab/redhat/plexmediaserver-1.19.2.2737-b69929dab.i686.rpm 25 | fi 26 | 27 | yum install plexmediaserver*.rpm 28 | rm -f yum install plexmediaserver*.rpm 29 | systemctl enable plexmediaserver.service 30 | systemctl start plexmediaserver.service 31 | mkdir -p /var/plex/media 32 | chown plex:plex -R /var/plex/media 33 | echo "Install finished. Default port is 32400" 34 | else 35 | echo "unsupported or unknown architecture" 36 | fi 37 | -------------------------------------------------------------------------------- /qbittorrent/qbittorrent-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # qbittorrent-installer by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | home="/opt/$user" 7 | 8 | # Creating non-root user 9 | echo "Creating user '$user'" 10 | if id -u $user >/dev/null 2>&1; then 11 | echo "User '$user' already exists. Skipped!" 12 | else 13 | useradd -r -m -s /bin/false $user 14 | fi 15 | 16 | echo "Installing qbitorrent. Please wait!" 17 | apt-get install sed sudo qbittorrent-nox -qqy 18 | 19 | sudo -u "$user" HOME="$home" /bin/bash <<'SU_END' 20 | yes | qbittorrent-nox & 21 | sleep 4 22 | pkill qbittorrent-nox 23 | SU_END 24 | 25 | clear 26 | sleep 2 27 | sed -i -e 's/Port=8080/Port=9091/g' $home/.config/qBittorrent/qBittorrent.conf 28 | mkdir -p $home/qBittorrent/Downloads $home/qBittorrent/tmp 29 | chown -R $user:$user $home/qBittorrent 30 | 31 | # Create startup service 32 | init=$(cat /proc/1/comm) 33 | if [[ "$init" == "systemd" ]]; then 34 | echo "Creating systemd service" 35 | echo "[Unit] 36 | Description=qBittorrent Daemon Service 37 | After=network.target 38 | 39 | [Service] 40 | Type=simple 41 | User=$user 42 | ExecStart=/usr/bin/qbittorrent-nox 43 | Restart=always 44 | RestartSec=2 45 | TimeoutStopSec=5 46 | 47 | [Install] 48 | WantedBy=multi-user.target 49 | "> /etc/systemd/system/qbittorrent.service 50 | chmod 0644 /etc/systemd/system/qbittorrent.service 51 | systemctl daemon-reload 52 | systemctl enable qbittorrent 53 | service qbittorrent start 54 | fi 55 | 56 | echo "Install finished. Default settings:" 57 | echo "User: admin" 58 | echo "Password: adminadmin" 59 | echo "Port: 9091" 60 | -------------------------------------------------------------------------------- /mono/mono-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # mono-installer by @sayem314 3 | 4 | # check if installed 5 | if [[ -e /usr/bin/mono ]]; then 6 | echo "Mono is already installed." 7 | exit 8 | fi 9 | 10 | echo "Installing mono. Please wait!" 11 | # Detecting apt-get/yum 12 | if hash apt-get 2>/dev/null; then 13 | apt-get install lsb-release curl dirmngr -qy 14 | CODENAME=$(cat /etc/*-release | grep "VERSION_ID=" | cut -f1 -d'.'| cut -f2 -d'"') 15 | OSNAME=$(lsb_release -i | awk 'NF{ print $NF }' | tr '[:upper:]' '[:lower:]') 16 | if [[ $CODENAME -ge 7 ]]; then 17 | RELEASENAME=$(lsb_release -c | awk 'NF{ print $NF }') 18 | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 19 | echo "deb http://download.mono-project.com/repo/$OSNAME $RELEASENAME main" | tee /etc/apt/sources.list.d/mono-official.list 20 | apt-get update 21 | apt-get install mono-devel -qy 22 | apt-get install libmono-cil-dev mediainfo sqlite3 -qy 23 | fi 24 | echo "Install finished." 25 | 26 | # CentOS is experimental 27 | elif hash yum 2>/dev/null; then 28 | yum update 29 | yum install yum-utils curl -qy 30 | MAJOR=$(lsb_release -i | awk 'NF{ print $NF }' | tr '[:upper:]' '[:lower:]') 31 | if [[ $CODENAME -ge 6 ]]; then 32 | rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" 33 | yum-config-manager --add-repo http://download.mono-project.com/repo/centos$MAJOR/ 34 | yum install mono-devel -qy 35 | yum install libmono-cil-dev mediainfo sqlite3 -qy 36 | fi 37 | echo "Install finished." 38 | else 39 | echo "unsupported or unknown architecture" 40 | fi 41 | -------------------------------------------------------------------------------- /sonarr/sonarr-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sonarr-installer by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # check if installed 9 | if [[ -e $installdir/NzbDrone/NzbDrone.exe ]]; then 10 | echo "Sonarr is already installed." 11 | echo "You should run update script." 12 | exit 13 | fi 14 | 15 | # install mono if not exist 16 | hash mono 2>/dev/null || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/mono.sh -O - -o /dev/null|bash 17 | 18 | # Creating non-root user 19 | [[ -d $installdir ]] || mkdir -p $installdir 20 | echo "Creating user '$user'" 21 | if id -u $user >/dev/null 2>&1; then 22 | echo "User '$user' already exists. Skipped!" 23 | else 24 | useradd -r -d $installdir -s /bin/false $user 25 | chown -R $user:$user $installdir 26 | fi 27 | 28 | # working directory 29 | cd $installdir || exit 30 | 31 | echo "Installing sonarr. Please wait!" 32 | wget -q http://update.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz || exit 33 | tar -xzf NzbDrone.master.tar.gz 34 | rm -f NzbDrone.master.tar.gz 35 | chown -R $user:$user NzbDrone 36 | 37 | # Create startup service 38 | init=$(cat /proc/1/comm) 39 | if [[ "$init" == "systemd" ]]; then 40 | echo "Creating systemd service" 41 | echo "[Unit] 42 | Description=Sonarr Daemon 43 | After=network.target 44 | 45 | [Service] 46 | WorkingDirectory=$installdir/NzbDrone 47 | Type=simple 48 | User=$user 49 | ExecStart=/usr/bin/mono NzbDrone.exe -nobrowser 50 | Restart=always 51 | RestartSec=2 52 | TimeoutStopSec=5 53 | 54 | [Install] 55 | WantedBy=multi-user.target 56 | "> /etc/systemd/system/sonarr.service 57 | chmod 0644 /etc/systemd/system/sonarr.service 58 | systemctl daemon-reload 59 | systemctl enable sonarr 60 | service sonarr start 61 | fi 62 | 63 | echo "Install finished. Default port is 8989" -------------------------------------------------------------------------------- /radarr/radarr-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # radarr-installer by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # check if installed 9 | if [[ -e $installdir/Radarr/Radarr.exe ]]; then 10 | echo "Radarr is already installed." 11 | echo "You should run update script." 12 | exit 13 | fi 14 | 15 | # install mono if not exist 16 | hash mono 2>/dev/null || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/mono.sh -O - -o /dev/null|bash 17 | 18 | # Creating non-root user 19 | [[ -d $installdir ]] || mkdir -p $installdir 20 | echo "Creating user '$user'" 21 | if id -u $user >/dev/null 2>&1; then 22 | echo "User '$user' already exists. Skipped!" 23 | else 24 | useradd -r -d $installdir -s /bin/false $user 25 | chown -R $user:$user $installdir 26 | fi 27 | 28 | # working directory 29 | cd $installdir || exit 30 | 31 | echo "Installing radarr. Please wait!" 32 | wget -q "$( wget -qO- https://api.github.com/repos/Radarr/Radarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )" 33 | tar -xzf Radarr.develop.*.linux.tar.gz 34 | rm -f Radarr.develop.*.linux.tar.gz 35 | chown -R $user:$user Radarr 36 | 37 | # Create startup service 38 | init=$(cat /proc/1/comm) 39 | if [[ "$init" == "systemd" ]]; then 40 | echo "Creating systemd service" 41 | echo "[Unit] 42 | Description=Radrr Daemon 43 | After=network.target 44 | 45 | [Service] 46 | WorkingDirectory=$installdir/Radarr 47 | Type=simple 48 | User=$user 49 | ExecStart=/usr/bin/mono Radarr.exe --nobrowser 50 | Restart=always 51 | RestartSec=2 52 | TimeoutStopSec=5 53 | 54 | [Install] 55 | WantedBy=multi-user.target 56 | "> /etc/systemd/system/radarr.service 57 | chmod 0644 /etc/systemd/system/radarr.service 58 | systemctl daemon-reload 59 | systemctl enable radarr 60 | service radarr start 61 | fi 62 | 63 | echo "Install finished. Default port is 7878" -------------------------------------------------------------------------------- /jackett/jackett-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # jackett-installer by @sayem314 3 | 4 | # Global value 5 | user="mediaserver" 6 | installdir="/opt/$user" 7 | 8 | # check if installed 9 | if [[ -e $installdir/Jackett/JackettConsole.exe ]]; then 10 | echo "Jackett is already installed." 11 | echo "You should run update script." 12 | exit 13 | fi 14 | 15 | # install mono if not exist 16 | hash mono 2>/dev/null || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/mono.sh -O - -o /dev/null|bash 17 | 18 | # Creating non-root user 19 | [[ -d $installdir ]] || mkdir -p $installdir 20 | echo "Creating user '$user'" 21 | if id -u $user >/dev/null 2>&1; then 22 | echo "User '$user' already exists. Skipped!" 23 | else 24 | useradd -r -d $installdir -s /bin/false $user 25 | chown -R $user:$user $installdir 26 | fi 27 | 28 | # working directory 29 | cd $installdir || exit 30 | 31 | echo "Installing jackett. Please wait!" 32 | wget -q "$( wget -qO- https://api.github.com/repos/Jackett/Jackett/releases | grep Jackett.Binaries.Mono.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )" 33 | tar -xzf Jackett.Binaries.Mono.tar.gz 34 | rm -f Jackett.Binaries.Mono.tar.gz 35 | chown -R $user:$user Jackett 36 | 37 | # Create startup service 38 | init=$(cat /proc/1/comm) 39 | if [ "$init" == "systemd" ]; then 40 | echo "Creating systemd service" 41 | echo "[Unit] 42 | Description=Jackett Daemon 43 | After=network.target 44 | 45 | [Service] 46 | WorkingDirectory=$installdir/Jackett 47 | Type=simple 48 | User=$user 49 | ExecStart=/usr/bin/mono JackettConsole.exe --NoRestart 50 | Restart=always 51 | RestartSec=2 52 | TimeoutStopSec=5 53 | 54 | [Install] 55 | WantedBy=multi-user.target 56 | "> /etc/systemd/system/jackett.service 57 | chmod 0644 /etc/systemd/system/jackett.service 58 | systemctl daemon-reload 59 | systemctl enable jackett 60 | service jackett start 61 | fi 62 | 63 | echo "Install finished. Default port is 9117" -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # mediserver-installer by @sayem314 4 | # https://github.com/sayem314/pirates-mediaserver 5 | # 6 | 7 | # Check root access 8 | if [[ "$EUID" -ne 0 ]]; then 9 | echo " Sorry, you need to run this as root" 10 | exit 11 | fi 12 | 13 | # We will calculate how much swap we would need 14 | # Create swap file to prevent out of memory errors 15 | # Do not create swap if system has 1GB or more RAM 16 | if [[ $SWAP != "no" ]]; then 17 | tram=$( free -m | grep Mem | awk 'NR=1 {print $2}' ) 18 | if [[ "$tram" -lt 950 ]]; then 19 | tswap=$( cat /proc/meminfo | grep SwapTotal | awk 'NR=1 {print $2$3}' ) 20 | if [[ "$tswap" = '0kB' ]]; then 21 | echo "We will now create 1GB swapfile!" 22 | # Do not create if OpenVZ VPS 23 | if [[ ! -f /proc/user_beancounters ]]; then 24 | echo "Creating swap file, please wait" 25 | install -o root -g root -m 0600 /dev/null /swapfile 26 | dd if=/dev/zero of=/swapfile bs=1k count=1024k 27 | mkswap /swapfile 28 | swapon /swapfile 29 | echo "/swapfile swap swap auto 0 0" | tee -a /etc/fstab 30 | else 31 | echo "Swap is not supported on OpenVZ. You might face problems." 32 | echo "Ask your provider to add swap or get higher RAM server." 33 | sleep 5 34 | fi 35 | fi 36 | fi 37 | fi 38 | 39 | # install mono if not exist 40 | hash mono 2>/dev/null || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/mono/mono-install.sh -O - -o /dev/null|bash 41 | 42 | # install directory 43 | DIR="/opt/mediaserver" 44 | 45 | # Install sonarr 46 | if [[ $SONARR != "no" ]]; then 47 | [[ -e $DIR/NzbDrone/NzbDrone.exe ]] || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/sonarr/sonarr-install.sh -O - -o /dev/null|bash 48 | else 49 | echo "Sonarr installation skipped." 50 | fi 51 | 52 | # Install radarr 53 | if [[ $RADARR != "no" ]]; then 54 | [[ -e $DIR/Radarr/Radarr.exe ]] || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/radarr/radarr-install.sh -O - -o /dev/null|bash 55 | else 56 | echo "Radarr installation skipped." 57 | fi 58 | 59 | # Install jackett 60 | if [[ $JACKETT != "no" ]]; then 61 | [[ -e $DIR/Jackett/JackettConsole.exe ]] || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/jackett/jackett-install.sh -O - -o /dev/null|bash 62 | else 63 | echo "Jackett installation skipped." 64 | fi 65 | 66 | # Install qbittorrent 67 | if [[ $QBITTORRENT != "no" ]]; then 68 | [[ -e /usr/bin/qbittorrent-nox ]] || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/qbittorrent/qbittorrent-install.sh -O - -o /dev/null|bash 69 | else 70 | echo "qBittorrent installation skipped." 71 | fi 72 | 73 | # Install plex 74 | if [[ $PLEX != "no" ]]; then 75 | [[ -d /usr/lib/plexmediaserver ]] || wget https://raw.githubusercontent.com/sayem314/pirates-mediaserver/master/plex/plex-install.sh -O - -o /dev/null|bash 76 | else 77 | echo "plex installation skipped." 78 | fi --------------------------------------------------------------------------------