Moving Plex Server from Windows to Linux

Server Version#: 1.25.6.5577

Moving Plex Server from Windows to Linux

I set out to move my plex server from my Window’s desktop to my home server running Linux (Ubuntu 20.04), while there are several guides on moving servers(including and official plex guide) most of those guides are for moving to the same operating system, and the others that do show moving to a different operating system, those are pretty much just a copy of the official guide(which states that moving to a different operating system is not supported and may not work. ) I have a large plex collection (15 Tib) and did not want to loose all of my watch data and all the work I have done on my metadata. I set about figuring it all out, Now that I have, I wanted to post this to help out anyone else who is facing the same issue as me.

I will be referring back to the official guide for parts of this, make sure you read over it and understand the base steps.

This guide will move your Windows Plex server to a Linux Server keeping your database and metadata as well as retaining the server id for your users transparency/seamlessness.

Preparation:

This guide assumes that you have plex installed on a Window’s machine and a fresh install on a stand alone Linux server/vm.(Do not go through the set-up on the new Linux installation.)

Disable Emptying of Trash

On your Windows Plex Media Server, you’ll want to disable the Empty trash automatically after every scan preference for the Server. Move an Install to Another System | Plex Support

Make sure you are logged out of your plex account on the windows server.

Make sure plex is shut down on both servers.

Window’s:

Right click the plex icon in the system tray and select “Exit”

Linux:

sudo service plexmediaserver stop

The Problem:

The issues I encountered, while trying to follow the “Official” guide and several other guides posted, where that when just copying over the contents of the windows plex server to the Linux server I would either get database errors or the Linux server would fail to start. I transferred from Windows 10 to a Ubuntu 20.04 VM. A lot of those files are incompatible with the different versions it would just cause problems, the solution is to just copy the files that you need to retain your settings and data. That’s where most of the other guides are very vague and do not detail what is needed to copy over and how to set that up. All of the guides I have seen just say copy all the folders/files. In my case that did not work.

Windows Server (Old)

On the Widow’s server(Old):

On the Window’s machine you will need 4 main things:

  1. Plex database files
  2. Media folder from plex server
  3. Metadata folder from plex server
  4. Copy of the settings from your registry for your server ID

Preparing the files:

Create a working dir where you will copy the files out of the plex server folder to that you can prepare them to move to your other install.

The Database Files:

The database files should be located at: \AppData\Local\Plex Media Server\Plug-in Support\Databases

Where is the Plex Media Server data directory located? | Plex Support

Copy the two files to a working directory:

  1. com.plexapp.plugins.library.db
  2. com.plexapp.plugins.library.blobs.db

If you have other files with dates, those are backups that plex makes of the database depending on your settings. you do not need them.

Media and Metadata folders:

Copy these two folders to your working directory.

  1. Media
  2. Metadata

Zip these files up individually and leave in your working directory for now. I had issues with database corruption when trying to zip the databases into one big file along with the folders, so I did not zip the databases and just zipped the two folders and prepared the four files to transfer to the new server. You should be able to right click the folder and choose zip.

At the end I had 4 files(Two of them were zipped)

  1. com.plexapp.plugins.library.db
  2. com.plexapp.plugins.library.blobs.db
  3. Media.zip
  4. Metadata.zip

Registry settings:

Now we need to copy the registry settings to get your server id and copy that over to the new plex server.

In windows search type Run:

Then type regedit in the box.

When the registry editor opens navigate to the plex registry settings at:

HKEY_CURRENT_USER > SOFTWARE > Plex, Inc. > Plex Media Server

You need to double click on the following three entry’s and copy the Value Data and paste that into a notepad file for later reference, we will need these when setting up the server on Linux.

  1. AnonymousMachineIdentifier
  2. MachineIdentifier
  3. ProcessedMachineIdentifier

You can make reference of some of the other settings, like “FriendlyName” but all of these other settings are easily updated in the gui so I did not bother.

That’s it for now on Windows, the only thing left is to transfer the files and settings to the new server, which I will explain the the Linux section.

Linux Server (New)

On the Linux Server (New)

For reference I am using Ubuntu 20.04 server - command line only. with some small/no changes this should work on most Linux distro’s.

You will need to copy the files that you saved to your working directory on the windows machine over to your Linux server. I personally use SmarTTY with built in scp, as its just a drag and drop, But you can use WinSCP or what ever else floats your boat to transfer files.

Due to permissions issues you will need to copy the files into your users home folder in Linux.

Once you have the files in your home directory lets prepare them for use on the server.

If you do not have unzip installed on your Ubuntu distro run this:

sudo apt-get install unzip

Now we need to unzip the two folders that we zipped on the windows machine.

While your in your home dir with the files:

sudo unzip Media.zip
sudo unzip Metadata.zip

Now we need to copy the files to the correct location for the plex install.

In ubuntu that should be in:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server

For other installs check here:

Where is the Plex Media Server data directory located? | Plex Support

So from your home directory(You need to be in your home dir with your files) you will need to copy the two db files and the two folders over to plex:

sudo cp -a Media /var/lib/plexmediaserver/Library/Application Support/Plex Media Server
sudo cp -a Metadata /var/lib/plexmediaserver/Library/Application Support/Plex Media Server
sudo cp com.plexapp.plugins.library.db /var/lib/plexmediaserver/Library/'Application Support/Plex Media Server/Plug-in Support'/Databases
sudo cp com.plexapp.plugins.library.blobs.db /var/lib/plexmediaserver/Library/'Application Support/Plex Media Server/Plug-in Support'/Databases

After you have the plex server set up and you are sure everything is running well you can return to your home dir and delete these files.

Now navigate to your plex server dir.

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server

Now we will need to set up the correct ownership and permissions for the files:

sudo chown -R plex:plex /Media
sudo chown -R plex:plex /Metadata
sudo chmod -R 644 Media
sudo chmod -R 644 Metadata

You can now check the files and make sure they are set correctly:

ls -la

you should see the folders listed with the following permissions and owner/group of plex plex.

Permissions user group

drw-r–r-- # plex plex

Now navigate to your database directory:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases

Now lets update the database files with the proper ownership and permissions.

sudo chown plex:plex com.plexapp.plugins.library.db
sudo chown plex:plex com.plexapp.plugins.library.blobs.db
sudo chmod 644 com.plexapp.plugins.library.db
sudo chmod 644 com.plexapp.plugins.library.blobs.db

Now lets check to make sure they are set correctly:

ls -la

you should see the db files with the proper permissions.

Permissions user group

-rw-r–r-- # plex plex

Now we need to set the machine id for the server identity, navigate to your main plex install location:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server

you should have a file called:

Preferences.xml

User your favorite text editor to edit this file(I prefer nano).

sudo nano Preferences.xml

In this file we will edit the three machine id’s to match our old windows server:

  1. AnonymousMachineIdentifier
  2. MachineIdentifier
  3. ProcessedMachineIdentifier

Pull up your text file you made on the old server with these values and edit each one to match your old server.

ctrl-O and then ctrl-X save and exit nano.

Now that should be everything we need for set up on the Linux server.

Next you will will need to start the plex server up on Linux:

sudo service plexmediaserver start

Now go log on to the webpage for plex and it should allow you to sign in and claim the server.

At that point you can update the friendly name in the settings to match your old server and then finish following the official guide to complete the server move.

Make sure you Disable Emptying of Trash on the new server( You can turn it back on once the transfer is complete)

Pay particular attention to the library section as you will need to complete that exactly like the manual to get the new location paths for the media dir’s due to the change from windows to Linux.

After I completed these steps all of my clients(Windows -Web , Android - Shield, Android - Phone, Mac-phone) were able to pick right up like it was the same server and no changes needed on the client end.

Now permissions for the media files on my NAS for use with Linux and Windows was a whole other task and if people are interested I might write up a tutorial on that as well.

I removed your post from server-linux-tips.

This already exists.

If you have any suggestions, I’ll gladly work with you to improve it.

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