onedrive for ubuntu

Microsoft hasn’t released a Linux version of the OneDrive client, and this doesn’t seem to be changing anytime soon. But that’s not to say you can’t use OneDrive on Linux.

There are many third-party clients that support cloud syncing. The best of these is the OneDrive client by developer abraunegg.

It’s a free and powerful client that supports most distros including Ubuntu. It supports two-way sync and most other features found on the native OneDrive client on Windows. 

Install from Ubuntu Universe

The easiest way to download OneDrive for Ubuntu is by installing it from the universe repo.

sudo apt install -y onedrive

Afterward, launch OneDrive by entering

onedrive

Right-click the authorization URL and select Open Link.

Login to your Microsoft account and give access to the OneDrive Client for Linux.

Copy the resulting URL, paste it into the terminal, and press Enter.

After completing the authorization, you can start using the client. Use onedrive --help if you feel lost. For starters, you should initiate a one-time sync. This’ll create a OneDrive folder in your home directory and sync your drive’s contents there.

onedrive --synchronization

Note: One problem with this method is that the packages from Universe tend to be outdated. For reference, the latest version available is onedrive 2.4.23, while Jammy (22.04 LTS) is still stuck with onedrive 2.4.13.

The developer highly recommends the other two installation methods over this as older packages can be buggy. But if you just want a quick and easy install method, this is a viable option.

Use the OpenSuSE Build Service Packages

This is the recommended way to install OneDrive on Ubuntu as it lets you install and maintain the latest version through apt.

Step 1: Add OBS Repo & Release Key

Add the OpenSuSE Build Service (OBS) repository and release key with the commands shown below. Make sure to adjust the Ubuntu version in the commands if installing on something other than 22.04.

wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /usr/share/keyrings/obs-onedrive.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/obs-onedrive.gpg] https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.04/ ./" | sudo tee /etc/apt/sources.list.d/onedrive.list

Step 2: Update Package Index

Update the apt package cache with

sudo apt update

Step 3: Install and Launch OneDrive

At this point, we’ve added the OneDrive package to our sources list and updated the package index so that we have access to the latest version. All that’s left is to install. 

sudo apt install --no-install-recommends --no-install-suggests onedrive

After installing it, launch OneDrive, authorize it, initiate a sync, and get started. Check the first section for a step-by-step reference.

onedrive

Step 4: Install OneDriveGUI

This part is optional, but you can also install the GUI for the OneDrive client if you want. On Ubuntu 22.04 and newer, ensure FUSE2 is installed first.

sudo apt install libfuse2

Download the latest OneDriveGUI release and make the AppImage executable. Replace version with the actual version number before you run the command. 

chmod +x ./OneDriveGUI-version-x86_64.AppImage

Then, launch the GUI with

./OneDriveGUI-version-x86_64.AppImage

Build OneDrive from Source

For some users, the onedrive client installed with the above method may segfault on exit (crash). This happens because the package is built with the LDC package & the default distribution compiler options. The only resolution to this is to uninstall the client and build it from source instead.

Step 1: Install Required Dependencies

Start by installing the necessary dependencies which includes build-essential and the DMD compiler.

sudo apt install build-essential
sudo apt install libcurl4-openssl-dev libsqlite3-dev pkg-config git curl
curl -fsS https://dlang.org/install.sh | bash -s dmd

Follow the instructions at the bottom to activate the DMD compiler. In our case, we’re activating version 2.102.2.

source ~/dlang/dmd-2.102.2/activate

Step 2: Compile OneDrive

Now, clone the OneDrive repo, go inside the cloned directory, and compile OneDrive. 

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

Step 3: Launch OneDrive

Deactive the DMD compiler and launch OneDrive with

deactivate
onedrive

Updating / Uninstalling OneDrive

If you installed OneDrive with either of the apt-based methods, you can use apt to manage it as well.

To update OneDrive, run

sudo apt --only-upgrade install onedrive

To uninstall OneDrive, run

sudo apt remove onedrive

Alternatively, if you built OneDrive from source, the process is a bit longer. You’ll have to uninstall the existing binary and build the newer version from source again. To uninstall the client, go to the GitHub repo clone directory and run

sudo make uninstall
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.