Laziest Method to Install GDrive in Linux Terminal Only
š Google Drive Backup-Upload via Terminal & Installing rclone on Debian (Bookworm Latest)
Go to bottom instantly and read the last paragraph, if you are a nerd and want to know how this setup goes.
sudo -v ; curl https://rclone.org/install.sh | sudo bash
Okay, so it’s done. Now, time to do the main setup.
rclone config
- Press
n
(of course, create new) - Give any name to your remote. I named it
gdrive:
(it’s my lucky name, so you can use it too) - Enter
20
(well, Drive was at number 20, so I entered 20. It might be different in your case, so stay alert and vigilant.- (Shoot, I donāt know what vigilant means, so whatever it means, I don’t care.)
Setting Up Client ID & Secret
Now, we come to the hardest part: the client ID and secret. Before this, you need to do one thing:
- Sign in to Google Cloud Console with the account you’ll use for Drive storage.
- Create a new project (I mean, why clutter other projects if you have many? Just create a new one).
- After creation, find “ENABLE APIS AND SERVICES” and search for “Drive” and enable it. Yes, do it right now.
- Click “Credentials” in the left-side panel (not “Create credentials”).
- If you haven’t configured the OAuth screen yet, do it now.
- Click on “CONFIGURE CONSENT SCREEN” (top right corner of the right panel).
- Select External and click CREATE.
- Enter an Application Name (“rclone” is fine), User Support Email, and Developer Contact Email (your own email is fine).
- Click Save (all other data is optional).
- Now, add scopes (this is needed so Rclone gets full access):
https://www.googleapis.com/auth/docs,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/drive.metadata.readonly
- Save and continue.
- Add usersāadd your own account under “Test Users”.
- (If you’re a GSuite user, you could select “Internal” instead of “External”, but this restricts API use to Google Workspace users in your organization.)
- Click "+ CREATE CREDENTIALS" ā “OAuth Client ID”.
- Download the JSON file (this is your client ID & secretāsave it, it’s useful for the future).
- Choose Desktop app as the application type and click Create.
- If you chose “External,” publish the app. If “Internal,” no need to do anything.
Back to Rclone Setup
Go back to the terminal and:
- Enter
drive
as the default option. - Press
Enter
multiple times (most settings are fine by default). - If you donāt have an RDP client attached, you can use this method:
socat TCP-LISTEN:8082,fork,reuseaddr TCP:127.0.0.1:53682
- Replace
127.0.0.1
with your serverās public IP. - Open the given link in your browser and complete the Google login.
- If redirected to
localhost
, change it to your serverās public IP and the port you used. - Done! Enter
Y
in the terminal. Weāre good.
Alternative (Hostless Option):
ssh -L 53682:127.0.0.1:53682 headless-host
Verifying Setup
rclone ls gdrive:
Boom! Your drives and files are listed. š
Mounting the Storage (Optional)
rclone mount --daemon gdrive:/your_directory
Check with:
df -h
Well, what magic? Itās just your drive added here. š
Backing Up to Google Drive (100% Success Rate ā )
Tested Environment: Debian Bookworm (Latest as of March 9, 2025)
Installing tmux
(for Background Uploads)
apt install tmux -y
Starting a New Session
tmux new -s rclone_upload
A new screen should openāpaste your command there.
rclone copy /var/lib/vz/dump gdrive:8Mar2025 --progress
gdrive:
is my drive name (yours may vary),8Mar2025
is my backup folder, and--progress
helps track uploads.
Running in Background
Ctrl + B, then D
Ctrl+B
puts the session in the background.D
confirms detachment.
Reattaching to Session
tmux attach -t rclone_upload
Spoiler Alert: I noticed single files don’t go above 45MBps, while multiple files exceed 100MBps. Weird. Ask the Rclone community about it. Maybe try AI chat or something? š¤·āāļø
Thatās it! Youāre all set up with Rclone for Google Drive backups. but if you want to read some facts about the steps then read below
-
I chose Debian OS because there weren’t any guides available for it, and I was already using Debian, so I made this guide.
-
Why no detailed steps? I just wanted to create a setup so lazy that anyone who doesn’t want to read lengthy paragraphs (not like you, since you’re here reading this) will find it useful, and their work won’t stop.
-
Why was setting up the client ID and secret the hardest part? Honestly, I messed this up multiple times, so I consider it the hardest (mainly because I don’t want to carefully read and follow all the steps). This time, I thought of creating a blog so that even if no one else uses it, it will help me in my specific machine environment.
-
Yeah, follow that “add scopes” step because it’s important to allow Rclone to access the directory. In this case, Rclone is you.
-
This whole guide is a mix of multiple sourcesāYouTube, Reddit, and even official docs. I carefully picked the laziest steps.
-
Why use headless mode? I didnāt have XRDP or any RDP client installed, and neither do many others. Rcloneās default support for headless mode was kinda hard (maybe it just takes time to get used to), so I didnāt follow it. The SSH method? I didnāt try it, but it worked for my friend, and he said it’s good. So, good luck.
-
If you face issues with mounting, just donāt mount. It’s mostly for syncing and checking storage space in Drive. If you just want to back up a few folders like me, skip it and follow the rest of the guide.
-
I used both
screen
andtmux
, and I found thattmux
was the best for processing the bigger file upload in the background. Sure, you can do it directly, but in my case, it was over 2TB, so I had to run it in the background. Otherwise, just skiptmux
and paste the command. -
IDK why there was a speed limit on a single fileāmight be something technical. If you find a solution, write me a well-documented guide and email me at im@surajmishra.co.in.
-
I find it super lazy to attach screenshots, broāhope you understand š«°š». You actually read all of this? Congrats, bro, youāre a real nerd with a great attention span. LOL!