Part of the modern computing experience is synchronizing files to cloud storage, such as OneDrive. This way, your files are not at risk of vanishing if your local disk goes kaput. Also, switching computers would no longer involve dragging along an external drive to transfer files.
If your daily driver is a Linux computer, the lack of an official OneDrive client from Microsoft can be off-putting. But don’t worry; there’s a solution, and that’s what this post will teach you.
Table of Contents
Requirements
A computer with Ubuntu 20.04 Desktop or newer. This post will be using an Ubuntu 22.04 Desktop.
Step 1: Update the System
First, let’s ensure that the system is up to date. Open a terminal and run the below command to create a script called update-os.sh on the current directory.
sudo tee -a update-os.sh << EOM #!/bin/bash rm -rf /var/lib/dpkg/lock-frontend rm -rf /var/lib/dpkg/lock apt-get update apt-get upgrade -y apt-get dist-upgrade -y apt-get autoremove -y apt-get autoclean -y EOM
Next, make the script executable and run it:
sudo chmod +x update-os.sh sudo ./update-os.sh
Since we can assume that there are many changes to the system, let’s reboot it before going any further:
sudo reboot
Step 2: Install OneDrive for Ubuntu
The OneDrive for Linux client has specific installation sources matching the Ubuntu version.
If installing on a distribution other than Ubuntu, refer to the official OneDrive Client for Linux repository.
First, let’s get the current Ubuntu version of your computer and store it in the os_version variable so that the subsequent commands can use it.
os_version=$(cat /etc/os-release | grep VERSION_ID | tr -d \VERSION_ID=\")
As you can see, this computer is running Ubuntu 22.04.
Next, run this command to add the OpenSuSE Build Service repository release key to your computer’s keyring.
wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_$os_version/Release.key | gpg --dearmor | sudo tee /usr/share/keyrings/obs-onedrive.gpg > /dev/null
Now, run this command to add the OneDrive repository to your package source list.
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_$os_version/ ./" | sudo tee /etc/apt/sources.list.d/onedrive.list
Since you’ve added the OneDrive repository, let’s update the package cache.
sudo apt-get update
According to this output, the OneDrive repository is now added and working.
Finally, install the OneDrive for Ubuntu client:
sudo apt install -y --no-install-recommends --no-install-suggests onedrive
After installing the Ubuntu OneDrive client, run the below command to check and confirm its version.
onedrive --version
As of this writing, the latest Ubuntu OneDrive client is v2.4.23, as shown below.
Step 3: Install the Ubuntu OneDrive Client GUI
So you’ve installed the Ubuntu OneDrive Client. But how do you use it? Well, the OneDrive Client you just installed is command-line based. Meaning you have to run commands to use it. Did this revelation crush your hopes and dreams for this Ubuntu OneDrive Client? What a bummer.
Note. Learn how to enable Ubuntu screen sharing using Vino VNC.
But don’t worry, there’s an excellent GUI frontend to use OneDrive for Ubuntu more akin to how it works on a Windows client. It’s called, OneDriveGUI.
First, let’s download the latest release from the GitHub repository. You can go to the OneDriveGUI releases page, download the latest AppImage file, or run this command instead.
curl -s https://api.github.com/repos/bpozdena/OneDriveGUI/releases/latest \ | grep "browser_download_url.*x86_64.AppImage" \ | head -1 \ | cut -d : -f 2,3 \ | tr -d \" \ | wget -qi -
After running the command, the AppImage file should be downloaded to the current directory.
Let’s move this file to a location where you’re less likely to accidentally delete it. And while we’re at it, let’s rename the file to OneDrive.AppImage.
sudo mv OneDrive*.AppImage /opt/OneDrive.AppImage ls -l /opt/OneDrive.AppImage
Lastly, we have to make OneDrive.AppImage file executable.
chmod +x /opt/OneDrive.AppImage ls -l /opt/OneDrive.AppImage
On Ubuntu 22.04 and above, make sure to install FUSE2. If you skip this step, OneDriveGUI will not launch.
sudo apt install -y libfuse2
Step 4: Create the OneDrive Shortcut (Dash and Desktop)
At this point, you can start using the Ubuntu OneDrive Client GUI from where you saved it.
But let’s take it up a notch and create a shortcut on the dash and the desktop.
Note. Check our tutorial on how to install Remmina Remote Desktop Client on Ubuntu.
Run the command below in the terminal to save the OneDrive logo to OneDrive.png.
echo -n iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFy0lEQVR4nO2ca4hVVRSAj2YvKm3m7jWjYklggfUniIgs6AFlZfWjkF6Czdy1jjppIFHSc4TeLxIqiu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XBmhOPfTYgB2kru/LXIDtt1jY1xYe+mYQdnHy2h8m1vEyNbojuTlVxfQn8QeKKt4HM0XC/wRXEqzp8ubjSODlf7klbwdVJMC0x5U/w2TSa5bTNUoCF6cONBTaXn7pyq1pIyxPMcsrmBj/Z9UP7zeIogxvPCY+0yPuyYQDZb3UTu/6B5L4GV/77lSZqqHCZIXm3qipYE0rsqY0wfx72XdY7Sf5ssLNzp1+4qNTTmb4SG5EcBlfGagAbkjew8g/+78w8c+VxgPxcfBGuJCt+cHWsBih1H9dpAJJnyp9WHGWI30ldaeRUHq1Ub3BjAOQd9U2MD0U3XSDpaQKFFZ1LWNCR92LJF9ko1UVuxzY92VND6sqiuHNLPN+tAervzewpNyTPT1tBkJgh+GmHBuAD9U2ivK7qsLe/mAUxPqMbAxB/W88EJt7Vl4sYYNeIMgDKHicJO4P8dj0TiDZR2cJ42kqBpAVlkQsDXF/P4NH0cq09otAKghw0bAAbONkiRK2DR5tcq+3NhBZzQ40bIGyGKlxSqYus2vquQV6XtkIgaUE+7MQAJSNwVy3pg+gpwLaRp64QSlbsnQdnBgiViIXpgPxzdRPgFcf+bZu/6cxE7ntREwnyNi+WwgzyEnuZYZjBD0Rb/gzJK6krhZIUXuzFhW0ftE1MtrxYeYMtD8ttB11YFRsZq/9wU/YSlbqbR0JQxs1738y6MYPyceuuflnZ0G2exC7x+cHsIdsCMyf2P7XwQ4nUiZ0W/P3CDFuoKV2oyOSK32lQnqjl8qCiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKF7L8h+Wc/oOnxc0XwAAAABJRU5ErkJggg== | base64 --decode > OneDrive.png
Next, let’s move the logo to /opt, where the OneDrive app is located.
sudo mv OneDrive.png /opt/OneDrive.png
Now, both the OneDriveGUI app and logo are in the same location.
Next, in the text editor, let’s create a file called /usr/share/applications/OneDrive.desktop.
sudo nano /usr/share/applications/OneDrive.desktop
Once the file is in the editor, copy the below code and paste it.
[Desktop Entry] Name=OneDrive Exec=/opt/OneDrive.AppImage Icon=/opt/OneDrive.png comment=OneDrive Client Type=Application Terminal=false Encoding=UTF-8 Categories=Utility;
The file should look like this. Press CTRL+S and CTRL+X to save the file and close the editor.
And you now have a OneDrive shortcut in the dash.
If you want the same shortcut on the desktop, run the below commands in the terminal.
cp -r /usr/share/applications/OneDrive.desktop ~/Desktop/ chmod 775 ~/Desktop/OneDrive.desktop chmod +x ~/Desktop/OneDrive.desktop sudo chown $USER:$USER ~/Desktop/OneDrive.desktop sudo chmod 775 ~/Desktop/OneDrive.desktop sudo chmod +x ~/Desktop/OneDrive.desktop
As you can see, the OneDrive client shortcut was created on the desktop but is blocked from launching.
Right-click on the OneDrive icon and click Allow Launching.
And the OneDrive shortcut becomes enabled.
Step 5: Launch and Configure the Ubuntu OneDrive Client
If you’ve followed the previous steps correctly, you should be able to launch the OneDriveGUI app now.
Double-click the OneDrive icon on the desktop or the dash, and the setup wizard appears. Click Next.
The next page checks if the installed OneDrive Client for Linux is a supported version. If the version check passed, click Next.
On the next page, select Create new OneDrive profile and click Next.
Enter the profile name, preferably your OneDrive username. The sync directory automatically populates. You can change or leave it as is. Now, click Create new profile.
Once the profile is created, click Next.
Click Finish to exit the setup wizard.
Step 6: Authenticate with OneDrive and Start Synching
Remember that in the previous step, you only created a profile for your OneDrive account on the local computer. The synch is not yet running because you haven’t logged in to your account.
Click the start icon on the OneDriveGUI window.
A pop-up window appears, giving your instructions on how to log in. Click the link on the first step to open a browser that leads to the login page.
Login to your account as instructed.
After logging in, copy the response URL from the browser address bar.
Paste the URL you copied into the step 3 box and click Login.
You should get a confirmation box like the one below. Click OK to close it.
Go back to the OneDriveGUI window, and click the play button to start synchronizing.
Your files are now synching between your device and the OneDrive cloud.
Conclusion
Even without the official app for Linux, the free Ubuntu OneDrive client does the job well. It is at par with the OneDrive Client on Windows, although you can add more accounts in OneDrive for Linux.
You can customize the sync options to enable auto sync when the GUI starts or exclude files and folders you do not want to synchronize. You can also limit the bandwidth and adjust the monitoring interval on the networking side.
Give the Ubuntu OneDrive client a try. Take it for a spin. You might find that it’s the answer to your OneDrive sync dilemma on Ubuntu.
2 comments
hello
i have get to line say ” Launch and Configure the Ubuntu OneDrive Client”
but i dont have any options to launch
Be sure to follow Step 4: Create the OneDrive Shortcut (Dash and Desktop). Then you can launch from the shortcut.