Part 6 - Making it all come together

The original source for the following tutorial on how to setup a Plex Media Server with GSuite has gone offline, so I thought i would re-post it so it's not lost.

Everything below is simply lifted from their website (with minor tweaks) (Tech Perplexed /

Well done, after finishing Part 5 - Mounting the drive(s) you are ready to roll! But, wait, isn't there a lot more to do? No... not really. You can now visit - your brand new Plex server will be there. Bet you didn't know it would be this easy, did you?

Now I'm not going to teach you how to set up Plex, there is ample information on the Plex website for that. What you do need to know though is where to find your content.

So let's add a library and click "Browse for Media Folder".

You will see the services you created on the left hand side of your selection. If you just want to use Rclone, all you need to do is click Plex and add the folder(s) of your choice to your library.

That's all... You can stop sweating and start watching as soon as Plex has finished scanning your content!

Part 5 - Mounting the drive(s)

The original source for the following tutorial on how to setup a Plex Media Server with GSuite has gone offline, so I thought i would re-post it so it's not lost.

Everything below is simply lifted from their website (with minor tweaks) (Tech Perplexed /

You made it up to here, you finished Part 4 - Setting up Rclone and/or Plexdrive and are still with it, congratulations! The hardest parts are done, it'll be downhill from now on. Promise! We now need to mount our drive so that Plex can access it as if it is just one giant external drive.

Mounting the Google drive (Rclone)

You are probably still logged in with your plexuser account, which is exactly what we want.

Let's create the required folders first:

mkdir -p /home/plexuser/logs
mkdir -p /home/plexuser/uploads

Creating the mount script:

sudo nano /etc/systemd/system/rclone.service

Then paste (right click):

Description=Mount and cache Google drive to /media/Plex
ExecStartPre=/bin/mkdir -p ${MOUNTTO}
ExecStartPre=/bin/mkdir -p ${LOGS}
ExecStartPre=/bin/mkdir -p ${UPLOADS}
ExecStart=/usr/bin/rclone mount \
  --rc \
  --log-file ${LOGS}/rclone.log \
  --log-level INFO \
  --umask 022 \
  --allow-non-empty \
  --allow-other \
  --fuse-flag sync_read \
  --tpslimit 10 \
  --tpslimit-burst 10 \
  --dir-cache-time=160h \
  --buffer-size=64M \
  --attr-timeout=1s \
  --vfs-read-chunk-size=2M \
  --vfs-read-chunk-size-limit=2G \
  --vfs-cache-max-age=5m \
  --vfs-cache-mode=writes \
  --cache-dir ${UPLOADS} \
  --config ${RCLONEHOME}/rclone.conf \
  Gdrive: ${MOUNTTO}
ExecStop=/bin/fusermount -u -z ${MOUNTTO}
ExecStop=/bin/rmdir ${MOUNTTO}

Of course you will need to replace all instances of plexuser with your own username.

When you are done, save the file by typing Ctrl-O, Enter to save, then Ctrl-X to exit.

You will need to enable the service. Type

sudo systemctl enable rclone.service

Reload the service so it'll work:

sudo systemctl daemon-reload

You will need to reboot your server now. Type

sudo reboot

You may need to wait a few seconds for the server to be back online again... just enough time to grab another cup of coffee. You deserve a break.

Click away the PuTTY session (it has become unresponsive anyway). You are done now and you can proceed to Part 6 - Making it all come together.

Part 4 - Setting up Rclone

The original source for the following tutorial on how to setup a Plex Media Server with GSuite has gone offline, so I thought i would re-post it so it's not lost.

Everything below is simply lifted from their website (with minor tweaks) (Tech Perplexed /

Now that you finished Part 3 - Install and configure Plex, we're halfway there... keep with it! This part will discuss Rclone.

Installing Rclone

Installing Rclone itself is the easiest part. You don't even need to understand what is happening. After you have followed these steps to the letter, Rclone will be installed.

I suggest you start a new session in PuTTY (select your saved session and click "Open", then log in with plexuser (or the name you picked for yourself) so that we are no longer in local mode.

Copy and paste the following line:

curl | sudo bash 

That's all, Rclone is installed and ready to run!

Configuring Rclone with Google

You didn't think everything would be this easy, right? No, the hard part is still to come. Now we need to configure Rclone, which is a bit of a task because on our PuTTY terminal, we have no browser available. Not to worry, with a bit of work, your own local computer will come to the rescue.

In the PuTTY terminal, type

sudo rclone config

You will be presented with a choice, type the letter n for "New remote" and hit the Enter key.

This tutorial will cover Google Drive, which is by far the most popular service. If you have signed up for another cloud service, check the Rclone website how to set that up.

You are asked to give a name. For this tutorial to work properly, please make sure you type:


Notice the capital G in Gdrive - Linux is picky about these things. Again, to avoid problems, you should not deviate from this (unless you exactly know what you're doing, but then you probably wouldn't be following this guide).

Check which option mentions Google Drive "drive" in the list (in the latest version this is #11), so type 11 and Enter.

Leave client_id> blank, just Enter.
Leave client_secret> blank as well, just Enter.

Scope that Rclone should use> 1 (full access)

ID of root folder> blank, just Enter
Service account files> again leave blank, just Enter.

Type the letter n for No, you don't want to use auto config and Enter.

You'll get a message that if your browser doesn't open, you will need to copy and paste the following link. You will need to place the entire link in a block by dragging your mouse (see screenshot below). Do not hit Ctrl-C - remember, this is PuTTY - dragging the mouse and placing the link in a block means it's copied.

Go to your local browser and paste the link. You will be asked to log into Google and accept authorization. You will then be given a code to paste in PuTTY.

Paste the code (right click), hit Enter.

Next you will be asked if you want to configure it as a team drive. Unless you know exactly what this means, type n - you don't want it.

Finally type y that Yes, all is okay and then q to Quit config.

You should see both drives in your list of current remotes:

Head over to Part 5 - Mounting the drive(s).

Part 3 - Install and configure Plex

The original source for the following tutorial on how to setup a Plex Media Server with GSuite has gone offline, so I thought i would re-post it so it's not lost.

Everything below is simply lifted from their website (with minor tweaks) (Tech Perplexed /

Finished Part 2 - Configuring Ubuntu? Then you can proceed with the installation of Plex itself. Thanks to an awesome script that is available for free, this is going to be a breeze. We now need to restart PuTTY in localhost mode to set up the Plex server using our local browser.

Open a new terminal window, select your saved Plex session and click "Load".

Don't click "Open" yet, first, look for Connection in the menu on the left hand side, open up SSH and click "Tunnels".

In the field behind Source port type: 32400
In the field behind Destination type: localhost:32400
Click "Add".

Now click "Open".

You can now login as your newly created plexuser.

Installing Plex

To install Plex, type (copy/paste):

bash -c "$(wget -qO -"

All in one line (you may need to scroll horizontally). If you are asked to enter your password, then this is not your Plex password, but the password you chose for plexuser in Linux.

Type the letter y to proceed with the installation, then hit Enter to agree to the default location "/opt/plexupdate".

You will be asked if you want to install the latest PlexPass releases. Important: answer y ONLY if you own a PlexPass, otherwise type n. I have a PlexPass, so I entered y.

If you choose y you will need to provide your Plex credentials. Enter your Plex e-mail address and Plex password.

Follow the rest of the prompts. I chose y when asked if I want to install the latest updates whenever they are released and y to check if the server is in use before upgrading,

Hit the Enter key twice when presented with the DNS/IP name and server port, and 32400 are both correct.

I chose y to set up automatic daily updates for Plex.

Choose y that you wish to continue.

I chose n that I do not wish to run syslog, and n that I don't want to receive an email if an update is available.

Lastly, make sure you choose y that you want to run the Plex update right now.

Congratulations, Plex is installed!

If you ever need to make chances to this configuration, type


This will run all options again and update the configuration with your new choices. Don't click away PuTTY, we're not done yet.

Getting Plex to run

Leave the terminal open on your desktop and open your local computer browser.

Visit this link:

If all goes well, you will be presented with a Plex login screen. You're doing fantastic!

Sign in with your Plex credentials, or create a new account if you are new to Plex. Continue clicking "Next" until you get the Plex main page.

Later we'll finish setting up the server, but before we proceed there is one more thing to do. Make sure your Plex server is available at If it is, click the Settings button (top right), click "Server", then "Remote Access".

Make sure you see "Fully accessible outside your network" in green.

Perfect, Plex is installed properly and we're ready for Part 4 - Setting up Rclone and/or Plexdrive.

Part 2 - Configuring Ubuntu

The original source for the following tutorial on how to setup a Plex Media Server with GSuite has gone offline, so I thought i would re-post it so it's not lost.

Everything below is simply lifted from their website (with minor tweaks) (Tech Perplexed /

You have completed all the steps in Part 1 - Creating an infinite Plex server using a VPS and a cloud service. We're now ready to configure Ubuntu so that it will work with Plex and your mounted Google drive.

Change root password

The root password you were provided with is probably not all that strong, and for an added layer of security you should change it. I suggest you use a password generator to create a really long 20 character super difficult password. Make sure it's stored somewhere safe. You will not need during the installation of Plex, but you may need it again in the future.

Here's mine: 5ehMN&7cQY*#yJZnAaNp. Notice it is 20 characters long, completely random, contains capital letters, small letters, numbers and symbols. Now that is a strong password!

You are still logged in as root on PuTTY. In the terminal, type:


Then paste (right click) your generated password, hit Enter, and paste it a second time.

f all goes well, it will tell you that your password was updated successfully.

Again, make sure your new password is stored in a safe place!

Installing updates and some vital packages

Next, we'll perform a few necessary updates and installations. You can type these commands manually, or if you're lazy like me, just copy and paste them from the browser here (Ctrl-C) into the PuTTY terminal (right click).

First, let's update Ubuntu with all the latest patches and updates. Type (or copy/paste):

sudo apt-get update && sudo apt-get upgrade

Sit back and relax while Linux flashes by lots of yakkety yak until it pauses and asks if you accept the additional disk space used. Type y and Enter.

After much more gobbledygook it'll probably pause on a blue screen. Ignore the warning by hitting Enter.

This time it'll probably finish and you'll see the green prompt again. If at some point in the future you get the message that there are packages that can be updated, run

sudo apt full-upgrade

We shall now install Fail2ban to prevent hackers from trying to get into your system. Enter

sudo apt-get install fail2ban

Agree to the installation (y, Enter). If the above command isn't displayed in one single line (depending on your browser settings), make sure you copy everything. Each time you see a text box containing a > this will mean you'll need to enter the entire code in PuTTY.

Go have a cup of coffee, talk a bit to a friend and come back after one hour. Then type

sudo cat /var/log/fail2ban.log

This will tell you the amount of hackers that tried to get into your system... yes... I was shocked too. At least we're protected now against brute force attacks.

Now we're going to install some packages that you need later. First we need the "GNU nano" text editor:

sudo apt-get install nano

Some newer versions of Linux don't include unzip or curl out of the box, let's install those just in case:

sudo apt-get install unzip 

Follow the prompts, depending on whether it was installed already or not. Curl is needed for some scripts:

sudo apt install curl

We also need to install FUSE, the package you asked your provider to enable.

sudo apt-get install fuse

Type y to continue. If at this point you get an error, you may need to contact your provider to enable FUSE, and wait for them to get back to you that it's done. You can't complete your installation until they have enabled it.

Depending on where your VPS server is, the time might be different from your local timezone. This would throw off your planned server maintenance / Plex downtime and other cron jobs. There is an easy fix for that:

sudo dpkg-reconfigure tzdata

Then select the area and time zone where you live.

Getting the firewall ready for Plex

We want Plex to be able to talk to the world, and you to be able to talk to your VPS. All other communications (hacker attempts!) are unwelcome. For added security, we will enable the firewall and create an exception for Plex. Type (or copy/paste) the following lines:

sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 32400

Your firewall is now ready for Plex.

You can add other exceptions as needed. For example, if you plan to install later, you will need to add this line:

sudo ufw allow 33400

It's always best practise to only open the ports you will actually need. Then enable the firewall:

sudo ufw enable

Then type y to confirm the command.

Create another Linux user

Linux is very security minded, and you should perform most tasks under a separate user, not root. It is an added layer of security and also makes things easier in the long run when you need to perform maintenance. Think of a username you want to use - your own name would be great. Do not choose "plex", that name is reserved to be used by Plex itself. Other than that, you can use your imagination.


adduser plexuser

Note: make sure you substitute plexuser to your own username wherever it occurs in the tutorial... I might not remember to remind you :)

Use a strong password that you'll remember easily (this is the password you'll be needing each time you log in or make changes), but hard to crack. I chose 123456 - just kidding!

You can enter through all the fields leaving them empty if you like, and finish by typing y and Enter.

Give your new user the right permissions to install and maintain Plex:

usermod -aG sudo plexuser

In order to prepare your server for Plex, you will need to give that name some permissions for later installations. Go ahead and enter

sudo visudo

A text file will open. Use the arrow keys on your keyboard to scroll to the bottom and add on a new line:


It will look like this:

Save this file by hitting Ctrl-O, then Enter. Exit the editor by hitting Ctrl-X.

Exit the terminal now (just close the PuTTY window) and log back in with your brand new username and password. Make sure you see your newly created user before the green prompt, instead of "root".

We're ready for Part 3 - install and configure Plex!