Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdiasriver/d91bf468fe58691badeda6f6977dcd5d to your computer and use it in GitHub Desktop.
Save abdiasriver/d91bf468fe58691badeda6f6977dcd5d to your computer and use it in GitHub Desktop.
PLEX-server-en-Ubuntu-Vps-contenedor-GCP-1Pb-Gdrive-Rclone
# ===================================================================SI ESTAS EN GCP ABRE LOS PUERTOS AGREGANDO REGLA FIREWALL
Menu firewall
crear
-
destinos todas las instancias
- ips
0.0.0.0/0
-protocolos permitir todo o 32400 o 9091
#===================================================================================# BUCKET O CONTENEDOR OPCIONAL
#CREAR BUCKET ,el nombre del bucket sera
plexcontent
#crear cuenta de servicio https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts?supportedpurview=project
#descargarla y subirla al vps en el /home/usuario
sudo mkdir /mnt/plexcontent
sudo chmod -R 777 /mnt/plexcontent
#DESCARGA GCSFUSE PARA ubuntu 21.04 https://github.com/GoogleCloudPlatform/gcsfuse/releases
curl -L -O https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.32.0/gcsfuse_0.32.0_amd64.deb
sudo dpkg --install gcsfuse_0.32.0_amd64.deb
#DESCARGA GCSFUSE PARA ANTES DE ubuntu 21.04
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcsfuse
#DESPUES DE INSTALAR GCSFUSE EDITA FUSE.CONF
sudo nano /etc/fuse.conf
#Descomenta quitandole el gato a #user_allow_other
user_allow_other
# SUBIR CLAVE JSON cuenta de servicio y cambia los datos aqui, usuario,nombre de la clave .json, nombre del bucket,carpeta montaje
gcsfuse -o allow_other --gid 0 --uid 0 --file-mode 777 --dir-mode 777 --key-file /home/abdias/vps222-327722-060a2a782fe9.json plexcontent /mnt/plexcontent
df -h
#error Transport endpoint is not connected
fusermount -u /mnt/plexcontent
gcsfuse -o allow_other --gid 0 --uid 0 --file-mode 777 --dir-mode 777 --key-file /home/abdias/vps222-327722-060a2a782fe9.json plexcontent /mnt/plexcontent
ls /mnt/plexcontent
#===================================================================================RCLONE + GDRIVE + FUSE
sudo apt install unzip
curl https://rclone.org/install.sh | sudo bash
rclone config
#Las opciones usadas son:
n
plexcloud
15
>Enter
>Enter
>Enter
1
>Enter
>Enter
>Enter
>Enter
Advance config? y
utoconfig? N
Team Drive? y
q
=============================================================
sudo apt install fuse
mkdir - P /home/abdias/plexcloud
rclone mount --allow-other --allow-non-empty -v plexcloud: /home/abdias/plexcloud &
ls /home/abdias/plexcloud
sudo apt install cron
sudo systemctl enable cron
export EDITOR=nano
crontab -e
# pegamos alli lo siguiente cambiando la direccion del direcciorio o usuario
@reboot sleep 30 && rclone mount --allow-other --allow-non-empty -v plexcloud: /home/abdias/plexcloud &
#===================================================================================
# Descarga e instala plex media server forma 1 desde el paquete .deb >>>>>>>>>>>>>>>>
#https://www.plex.tv/media-server-downloads/
wget https://downloads.plex.tv/plex-media-server-new/1.24.3.5033-757abe6b4/debian/plexmediaserver_1.24.3.5033-757abe6b4_amd64.deb
sudo dpkg -i plexmediaserver_1.24.3.5033-757abe6b4_amd64.deb
sudo systemctl enable plexmediaserver.service
sudo systemctl start plexmediaserver.service
sudo systemctl status plexmediaserver.service
exit
#Conectate desde putty para acceder a localhost:32400/web
# PPLEX MEDIA SERVER DESDE REPOSITORIOS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt update
sudo apt install plexmediaserver
sudo systemctl enable plexmediaserver.service
sudo systemctl start plexmediaserver.service
sudo systemctl status plexmediaserver.service
exit
#Conectate desde putty para acceder a localhost:32400/web
#Instale Plex Media Server con snap>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sudo apt update
sudo apt install snapd
sudo snap install plexmediaserver
#Debería recibir un resultado similar al siguiente que indique que la instalación está completa:
plexmediaserver 1.20.1.3252-a78fef9a9 from Plex, Inc. (plexinc✓) installed
#====================================================================================CONEXION SSH LOCALHOST DESDE PUTTY
#Descarga Putty https://the.earth.li/~sgtatham/putty/0.76/w64/putty-64bit-0.76-installer.msi
#Create una clave rsa
#copiala a la vm
#configura puerto 32400
#guardala
#data autologin username
#connections>ssh>auth>key
#connections>tunnels
#8888
#localhost:32400
#ve achrome localhost:32400/web
#====================================================================================== REGLA DE FIREWALL no gcp
sudo nano /etc/ufw/applications.d/plexmediaserver
#PEGA DENTRO Y GUARDA
[plexmediaserver]
title=Plex Media Server (Standard)
description=The Plex Media Server
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp
[plexmediaserver-dlna]
title=Plex Media Server (DLNA)
description=The Plex Media Server (additional DLNA capability only)
ports=1900/udp|32469/tcp
[plexmediaserver-all]
title=Plex Media Server (Standard + DLNA)
description=The Plex Media Server (with additional DLNA capability)
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp|1900/udp|32469/tcp
#GUARDA EL ARCHIVO Y EJECUTA
sudo ufw app update plexmediaserver
sudo ufw allow plexmediaserver-all
sudo ufw status verbose
#TE APARECERA ALGO ASI
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
32400/tcp (plexmediaserver-all) ALLOW IN Anywhere
3005/tcp (plexmediaserver-all) ALLOW IN Anywhere
5353/udp (plexmediaserver-all) ALLOW IN Anywhere
8324/tcp (plexmediaserver-all) ALLOW IN Anywhere
32410:32414/udp (plexmediaserver-all) ALLOW IN Anywhere
1900/udp (plexmediaserver-all) ALLOW IN Anywhere
32469/tcp (plexmediaserver-all) ALLOW IN Anywhere
#=======================================================================CREANDO FOLDER PARA PPLEX Y AGREGANDO PERMISOS(si te da error en permisos)
sudo mkdir -p /opt/plexmedia/{movies,series}
sudo chown -R plex: /opt/plexmedia
#========================================================================PARA RECIBIR ACTUALIZACIONES DESCOMENTA DEB
sudo nano /etc/apt/sources.list.d/plexmediaserver.list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment