Install Rclone And Setup With Google Drive

Below are easy, step-by-step bullet points to install, configure, and connect Google Drive to your VPS using rclone (recommended & safest).


🔹 Step 1: Install rclone on VPS

  • SSH into your VPS

  • Run official installer:

    curl https://rclone.org/install.sh | sudo bash
  • Verify installation:

    rclone version

🔹 Step 2: Start rclone Configuration

  • Run:

    rclone config
  • Choose:

    • n → New remote
    • Name: gdrive (recommended)

🔹 Step 3: Select Google Drive

  • When prompted for storage type:

    • Enter number for Google Drive
  • Client ID:

    • Press Enter (use default)
  • Client Secret:

    • Press Enter (use default)

🔹 Step 4: OAuth & Permission Setup

  • Scope:

    • Choose Full access
  • Root folder:

    • Leave blank
  • Advanced config:

    • Choose No
  • Auto config:

    • Choose No (because VPS has no browser)

🔹 Step 5: Authorize via Browser

  • rclone will show a URL
  • Copy the URL
  • Open it in your local browser
  • Login to Google account
  • Allow access
  • Copy the authorization code
  • Paste it back into VPS terminal

🔹 Step 6: Confirm Remote

  • Confirm remote settings
  • Choose Yes
  • Exit config

🔹 Step 7: Verify Google Drive Connection

  • List Drive root:

    rclone ls gdrive:
  • Create test folder:

    rclone mkdir gdrive:test-backup
  • Check Google Drive → folder should appear


🔹 Step 8: (Optional but Recommended) Restrict to Backup Folder

  • Create a dedicated folder:

    rclone mkdir gdrive:gitlab-backups
  • Always use:

    gdrive:gitlab-backups
  • Prevents accidental overwrite of other Drive data


🔹 Step 9: Test Upload & Download

  • Upload test file:

    echo "ok" > test.txt
    rclone copy test.txt gdrive:gitlab-backups
  • Download test:

    rclone copy gdrive:gitlab-backups/test.txt .

🔹 Step 10: Secure rclone Config

  • Config file location:

    ~/.config/rclone/rclone.conf
  • Restrict permissions:

    chmod 600 ~/.config/rclone/rclone.conf

🟢 Final Result

  • VPS securely connected to Google Drive

  • Ready for:

    • Daily incremental backups
    • Weekly/monthly full backups
    • Disaster recovery restores

0%