OneDrive by Microsoft does not officially support Linux/Ubuntu for obvious reasons, but you have made a switch from Windows to Ubuntu, or maybe just giving it a try and need Microsoft OneDrive.
No need to worry, with just a few steps you will be able to use OneDrive on your Ubuntu.
There are a lot of ways to use OneDrive on Ubuntu unofficially, some of them are free some are paid.
If you are willing to pay for a service and not get into the hassle of installing and maintaining it yourself, then Insync is a nice client to automate everything. It can help you manage Google Drive, OneDrive, and Dropbox files straight from your Desktop.
If you decide to do it yourself then in this article we will learn how to install OneDrive on Ubuntu for free.
Table of Contents
OneDrive Ubuntu
We will be using the Abrauneeg Linus OneDrive client to run it on Ubuntu, as it is actively maintained.
Requirements to build the client
- At least 1GB of memory & 1GB of swap space
- libcurl
- Databases like SQLite 3
- Digital Mars D Compiler (DMD)
Example for installing DMD Compiler
curl -fsS https://dlang.org/install.sh | bash -s dmd
Before installing let’s update Ubuntu and its repositories.
sudo apt upgrade -y
If your machine meets the above requirement, then install the dependencies needed to build the OneDrive client.
sudo apt install build-essential
sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev
sudo apt install pkg-config
sudo apt install git
sudo apt install curl
curl -fsS https://dlang.org/install.sh | bash -s dmd
For notifications, the following is also necessary:
sudo apt install libnotify-dev
Now we need to activate DMD using the following command
source ~/dlang/dmd-2.087.0/activate
Steps To Install
Clone the GitHub repository, run configure and make, then install
git clone https://github.com/abraunegg/onedrive.git
cd onedrive
./configure
make clean; make;
sudo make install
Deactivate your DMD compiler
deactivate
Running OneDrive
The above command will install OneDrive on your system. Next, we will ask Ubuntu (Linux) to run it, so that we can authorize it (login to your OneDrive Account).
onedrive
This command will start OneDrive which will provide a URI and ask you for a URI in return. Output in your console will look something like this.
$ onedrive Authorize this app visiting:
https://login.live.com/oauth20_authorize.srf?client_id=000000004C15842F&scope=onedrive.readwrite%20offline_access&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf
Enter the response uri:
Just Click on the URI and it will open up in the tab in the browser for you to log in to your account or copy-paste the link into the browser.
Once you log in it will return a URI (web page will be blank, no need to worry). Copy the URI and paste it into the console in front of “Enter the response uri:”
If everything goes well then you will find a OneDrive directory at $HOME/OneDrive.
Commands
Now we have OneDrive up and running but it won’t sync anything as of yet. So we will go through some basic commands that will help you manage your OneDrive.
To start sync (monitor) just run the following command.
onedrive -m
To run sync
onedrive --synchronize
This command will start live sync between the local files and files on the server and then download (update) the files.
You have to run the above command every time you restart your Ubuntu.
Some other useful commands are:
-m --monitor
Keep monitoring for local and remote changes
--monitor-interval ARG
The number of seconds by which each sync operation is undertaken
when idle under monitor mode
Configuration file key: monitor_interval (default: 45)
--monitor-fullscan-frequency ARG
Number of sync runs before performing a full local scan of the
synced directory
Configuration file key: monitor_fullscan_frequency (default: 10)
--skip-dir ARG
Skip any directories that match this pattern from syncing
--skip-file
Skip any files that match this pattern from syncing
Configuration file key: skip_file (default: ~*|.~*|*.tmp)
To list all the commands run
man onedrive
If you get stuck just leave a comment and I’ll get back to you as soon as possible.
Leave a Reply