Installing OneDrive and Microsoft Office365 on Linux - DanaResearchGroup/wiki GitHub Wiki

Installing OneDrive and Microsoft Office on Linux

Currently, there are no solutions provided by Microsoft for installing OneDrive and Microsoft Office on Linux. Therefore, we will need to use third party open source solutions.

Important: If you are to go with Solution 1 for Microsoft Office 365 installation, then ensure you have completed the OneDrive set up as this is required!

OneDrive

The current open source solution is to use a Command-Line Interface (CLI) of OneDrive in combination with another open source project that provides a GUI.

The CLI will be the backbone of connecting and syncing with your OneDrive account. The GUI will provide you with visual information of what is being synced (and other advanced options).

OneDrive CLI

The CLI is provided from this repository here. Now, there are multiple ways to install the CLI, depending on which OS you are using. I will provide information for:

  • Ubuntu 20.04
  • Ubuntu 22.04

General Instructions

Step 1: Remove any configured PPA and associated 'onedrive' package

While you may have never installed OneDrive before on your linux machine, it is best to run this as a precaution

If you are an undergraduate, ignore this step!

sudo apt remove onedrive
sudo add-apt-repository --remove ppa:yann1ck/onedrive

Step 2: Ensure system is up to date

Save the following code as a script, and then run it in 'root' by using sudo su

If you are an undergraduate, ignore this step!

#!/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

Then:

reboot

Step 3: Determine which OS you are using

To determine which instructions to follow, determine your OS:

lsb_release -a

Example

alex@ubuntu-system:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

Option 1: Ubuntu 20.04 OneDrive

Step 1: Add the OpenSUSE Build Service repository release key

wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/Release.key | sudo apt-key add -

Step 2: Add the OpenSUSE Build Service repository

echo 'deb https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/ ./' | sudo tee /etc/apt/sources.list.d/onedrive.list

Step 3: Update your apt package cache

sudo apt-get update

Step 4: Install OneDrive

sudo apt install onedrive

Option 2: Ubuntu 22.04 OneDrive

Step 1: Add the OpenSUSE Build Service repository release key

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

Step 2: Add the OpenSUSE Build Service repository

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 3: Update your apt package cache

sudo apt-get update

Step 4: Install OneDrive

sudo apt install onedrive

OneDrive GUI

This will provide the GUI for OneDrive on Linux - It provides multi-account support.

ondedriveGUI

Step 1: Installing FUSE2

sudo apt install libfuse2

Step 2: Download OneDriveGUI Image

cd ~/Documents
wget https://github.com/bpozdena/OneDriveGUI/releases/download/v1.0.3/OneDriveGUI-1.0.3_fix116-x86_64.AppImage

Step 3: Make AppImage Executable

chmod +x ./OneDriveGUI-1.0.3_fix116-x86_64.AppImage

Step 4: Execute AppImage

You will need to run the OneDriveGUI AppImage - this can be either done by double clicking the icon or right clicking the icon and selecting run.

  1. You will be met with the 'OneDriveGUID Setup Wizard'

    Imgur

    Select: 'Create new OneDrive profile'

  2. You will then to fill in your details and then click 'Create new profile':

    Imgur

    Press 'Next'

  3. You will be presenting with a OneDrive login request.

    Imgur

    Click the link in the 1) step. This will open a browser asking you to login.

    Once logged in, you will get a 'Permissions requested' prompt. Click Accept.

    You will then be presented with a blank screen. You will need to copy the URL!

    Imgur

    Paste the URL in the OneDrive login profile screen from point 3. Then click Login.

You are now all set!

Microsoft Office

Microsoft Office apps cannot be natively installed on Linux. There are only two solutions to this problem.

  1. The first solution is to use an electron wrapped Office 365 application. This means it you are still technically interfacing with the online Word/Powerpoint etc. applications.

  2. The second solution is tediuous but is arguably better. This requires the installation of a Virtual Windows Machine and then running Office 365 in the VM. This will be the full Office 365 experience as if you had a windows machine.

Solution 1 - Electron Wrapped Office 365

Solution adapted from here

image

The current applications supported are:

Microsoft Excel 365 Microsoft OneNote 365
Microsoft Outlook 365 Microsoft PowerPoint 365
Microsoft Project 365 Microsoft Word 365

Installation

sudo apt install zenity imagemagick

Then once those are installed...

cd ~/Documents
curl -s https://raw.githubusercontent.com/adil192/loffice-365/main/installer.sh | bash -s

Solution 2 - Virtual Machine Windows

This is a much more involved solution. The solution is adapted from here

1. Installation - Creating a virtual machine in KVM

Install KVM
sudo apt-get install -y virt-manager
Download Windows Professional 10 and KVM VirtIO driver

You will need to download Windows Pro 10 and the KVM VirtIO drivers to allow for best performance.

Windows 10 ISO: https://www.microsoft.com/en-us/software-download/windows10ISO

KVM VirtIO drivers (for all distros): https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso

Create your virtual machine

The following guide will take you through the setup

To set up the standard way, open virt-manager (Virtual Machines).

alt

Next, go to Edit->Preferences, and check Enable XML editing, then click the Close button.

alt

Now it is time to add a new VM by clicking the + button.

alt

Choose Local install media and click Forward.

alt

Now select the location of your Windows 10 ISO, and Automatically detect the installation.

alt

Set your memory and CPUs. We recommend 2 CPUs and 4096MB for memory. We will be using a Memory Ballooning service, meaning 4096 is the maximum amount of memory the VM will ever use, but will not use this amount except when it is needed.

alt

Choose your virtual disk size, keep in mind this is the maximum size the disk will grow to, but it will not take up this space until it needs it.

alt

Next, name your machine RDPWindows so that WinApps can detect it, and choose to Customize configuration before install.

alt

After clicking Finish, ensure under CPU that Copy host CPU configuration is selected, and Apply.

NOTE: Sometimes this gets turned off after Windows is installed. You should check this option after install as well.

alt

Next, go to the XML tab, and edit the <clock> section to contain:

<clock offset='localtime'>
  <timer name='hpet' present='yes'/>
  <timer name='hypervclock' present='yes'/>
</clock>

Then Apply. This will drastically reduce idle CPU usage (from ~25% to ~3%).

alt

Next, under Memory, lower the Current allocation to the minimum memory the VM should use. We recommend 1024MB.

alt

Under Boot options, check Start virtual machine on host boot up.

alt

For SATA Disk 1, set the Disk bus to VirtIO.

alt

For the NIC, set the Device model to virtio.

alt

Click the Add Hardware button in the lower right, and choose Storage. For Device type, select CDROM device and choose the VirtIO driver ISO you downloaded earlier. This will give the Windows 10 Installer access to drivers during the install process. Now click Finish to add the new CDROM device.

alt

You are now ready to click Begin Installation

alt

Now move on to installing the virtual machine.

Install the virtual machine

From here out you will install Windows 10 Professional as you would on any other machine.

alt

Once you get to the point of selecting the location for installation, you will see there are no disks available. This is because we need to load the VirtIO driver. Select Load driver.

alt

The installer will then ask you to specify where the driver is located. Select the E:\ drive or whichever drive the VirtIO driver ISO is located on.

alt

Choose the appropriate driver for the OS you have selected, which is most likely the w10 driver for Windows 10.

alt

You will now see a disk you can select for the installation.

alt

Windows will begin to install, and you will likely need to reboot the VM a number times during this process.

Note: Remember to set a password for the user. If you don't set a password, you won't be able to connect via RDP later. If you forgot to set a password during the installation step, you can still set a password from Windows once the installation is complete.

alt

At some point, you will come to a network screen. This is because the VirtIO drivers for the network have not yet been loaded. Simply click I don't have internet.

alt

It will confirm your choice, so just choose Continue with limited setup.

alt

After you get into Windows and login with the user you created during the install. Open up Explorer and navigate the E:\ drive or wherever the VirtIO driver ISO is mounted. Double click the virt-win-gt-64.exe file to launch the VirtIO driver installer.

alt

Leave everything as default and click Next through the installer. This will install device drivers as well as the Memory Ballooning service.

alt

Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the RDPApps.reg file from the WinApps repo by visiting https://github.com/Fmstrat/winapps/blob/main/install/RDPApps.reg, right clicking on the Raw button, and clicking on Save target as.

alt

Once you have downloaded the registry file, right click on it, and choose Merge, then accept any confirmations along the way.

alt

Next up, we need to rename the VM so that WinApps can locate it. Go to the start menu and type About to bring up the About your PC settings.

alt

Scroll down and click on Rename this PC

alt

Rename to RDPWindows, and then Next, but do not restart.

alt

Lastly, scroll down to Remote Desktop, and toggle Enable Remote Desktop on, and Confirm.

alt

At this point you will need to restart and you have completed your setup.

You may also wish to install the Spice Guest Tools inside the VM which enables features like auto-desktop resize and cut-and-paste when using virt-manager. As WinApps uses RDP, this is not necessary if you do not plan to access the machine via virt-manager.

Once you are finished, restart the VM, but do not log in. Simply close the VM viewer, and close the Virtual Machine Manager.

2. Installation - Installing Microsoft Office

Start VM

You will need to start your VM of Windows

Imgur

Once it has started, you will then need to open it (Click 'Open')

Download and Install Office365

Download the image of MS Office365 here in your Virtual Windows Machine!

Imgur

Once the download has completed, click on the O365ProPlusRetail.img file. This will mount the drive. Then double Setup to begin installing.

Imgur

Then, open an application like Word or Excel. This will prompt you with a 'Product Key'. Click the prompt that says you do not have a product key. It will then prompt you to sign in on your Microsoft Account.

COMPLETE.

Tip: If for some reason you need to activate your Windows - Click this link

⚠️ **GitHub.com Fallback** ⚠️