# Auto upgrade / deploy plex on debian

**URL:** <https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [June 14, 2020, 7:36pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609 "2020-06-14T19:36:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shirenzo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/shirenzo/32/194428_2.png) [@Shirenzo](https://forums.plex.tv/u/Shirenzo)\
**Post date:** [June 14, 2020, 7:36pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/1 "2020-06-14T19:36:25Z")

</div>

For Debian i created an autoinstaller based on if the file exists.  
This script wil not check plex actual version but checks the latest file downloaded.  
When there is no file or not the latest file then it will download it and deploy plex.

If you want to reinstall plex simple remove plex and remove the install file it will then perform an clean install.

And yes this is quick and dirty but i was done waiting on plex for creating an official way. (Simple check against plex DB and latest file in URL should be more than enough and doable from shell as a cron)

**Requirements:**

Run: apt-get install wget curl php-cli

**Script:**  
Save the following file as deployplex.php in a directory on the server.

\<?php $rootdir=getcwd(); $url=shell\_exec('curl -Ls -o /dev/null -w %{url\_effective} "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86\_64&distro=debian"'); $ToSplit= explode("/", $url); foreach ($ToSplit as $value) { $Installfile= $value; } $filename = $rootdir.'/'.$Installfile; if (file\_exists($filename)) { } else { shell\_exec('wget '.$url); $ToExec='dpkg -i '.$rootdir.'/'.$Installfile; shell\_exec($ToExec); } ?\>

**Cronjob:**

in crontab place the following tekst.

0 \*/1 \* \* \* php /CHANGEME/deployplex.php

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [June 14, 2020, 8:03pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/2 "2020-06-14T20:03:05Z")

</div>

Forgive me,

You do realize that if you enable the repository and automatic system updates, PMS will automatically update every time a new version is pushed to Public?

---

<div class="post-metadata">

**Author:** ![Shirenzo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/shirenzo/32/194428_2.png) [@Shirenzo](https://forums.plex.tv/u/Shirenzo)\
**Post date:** [June 14, 2020, 8:11pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/3 "2020-06-14T20:11:43Z")

</div>

The repository always is way behind, the webinterface keeps comming with alerts that there is a new version.  
This way i know 100% sure that i have the latest version.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [June 14, 2020, 8:27pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/4 "2020-06-14T20:27:06Z")

</div>

Change the selector to Public.  
You currently have it set to Beta.

---

<div class="post-metadata">

**Author:** ![frederick.grayson](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/frederick.grayson/32/14914_2.png) [@frederick.grayson](https://forums.plex.tv/u/frederick.grayson)\
**Post date:** [June 14, 2020, 9:18pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/5 "2020-06-14T21:18:30Z")

</div>

mrworf has had a widely used script that does this. It has been available for years.

---

<div class="post-metadata">

**Author:** ![Shirenzo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/shirenzo/32/194428_2.png) [@Shirenzo](https://forums.plex.tv/u/Shirenzo)\
**Post date:** [June 14, 2020, 9:20pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/6 "2020-06-14T21:20:51Z")

</div>

nope i have it on public nice try 😉 Not my first rodeo 😉

---

<div class="post-metadata">

**Author:** ![Shirenzo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/shirenzo/32/194428_2.png) [@Shirenzo](https://forums.plex.tv/u/Shirenzo)\
**Post date:** [June 14, 2020, 9:22pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/7 "2020-06-14T21:22:49Z")

</div>

> [@frederick.grayson](#):
>
> mrworf

interesting, will look into that one 😉 plex should really integrate some form of this.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [September 12, 2020, 9:23pm UTC](https://forums.plex.tv/t/auto-upgrade-deploy-plex-on-debian/603609/8 "2020-09-12T21:23:07Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
