Setup of Linux OneDrive on CentOS 7


Introduction:
Sometime, you have a huge data sets to transfer and you may not want to hold an active connection all the time. One solution is to use OneDrive especially if you or your organisation has subscribed to Office 365. You should have 1TB of online space.

Step 1: Install Dependencies

yum install libcurl-devel
yum install sqlite-devel
curl -fsS https://dlang.org/install.sh | bash -s dmd
yum install libnotify-devel

Step 2: Git Clone the OneDrive Code

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
./configure
make clean
make
sudo make install

Step 3a: Authorize Microsoft to access your account

You need to authorize onedrive with Microsoft so it can access your account. First start by typing on the console

onedrive

Step 3b: You will be prompted to visit the URL to get permission

Step 4: Log in to your OneDrive account, and grant the app permission to access your account

Step 5: You will see a blank white page. Copy the URL and paste it into the Xterm

Step 6: Copy the URL and paste it into the Xterm  “Enter the response uri”


 Configuration

By default, all files are downloaded in ~/OneDrive and hidden files are skipped.  If you want to change the defaults, you can copy and edit the included config file into your ~/.config/onedrive directory:

mkdir -p ~/.config/onedrive
cp /usr/local/onedrive/config ~/.config/onedrive/config
vim ~/.config/onedrive/config

Available options:

  • sync_dir: directory where the files will be synced
  • skip_file: any files or directories that match this pattern will be skipped during sync.

For example,

If I want to sync everything except Confidential and Personal Folders

# Directory where the files will be synced
sync_dir = "~/OneDrive/"
# Skip files and directories that match this pattern
skip_file = ".*|Confidential|Personal"

Note: after changing the sync list, you must perform a full synchronization by executing

onedrive --resync --synchronize

Step 7: Sync List

If you wish to do selective sync instead of the whole OneDrive Folder, you can create a file called sync list and put it in the “~/.config/onedrive” folder and add the relative path from the OneDrive to the folder you want to sync

% touch ~/.config/onedrive/sync_list

For example, when you place a g2o folder into ~/OneDrive and only one to sync this particular folder. Your sync_list should only contain

g2o

One Drive Service

If you want to sync your files automatically, enable and start the systemd service:

systemctl --user enable onedrive
systemctl --user start onedrive

References:

  1. How to Sync Microsoft OneDrive with Linux
  2. https://github.com/abraunegg/onedrive

One thought on “Setup of Linux OneDrive on CentOS 7

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.