Friday, September 08, 2017

Sync MS OneDirve with your Ubuntu 16.04.

Okay confession time, I have a Microsoft OneDrive account.  Yeah it's just the freebie basic 15gb type but I do use it from time to time.  When I needed access to it on Ubuntu (16.04) I would just use their web interface.  Well I thought why not just have it Sync on it's own.

Surprise! Microsoft doesn't make a nice Linux App for syncing but there is a little program called ONEDRIVE-D that works just fine.  You don't get a nice GUI interface or an Indicator App (like Dropbox or Insync) but once installed, just one Terminal Command will start it syncing.  It's kind of a set and forget thing.  You can read more about it here https://github.com/xybu/onedrive-d-old

To get it up and running we need to type the following commands (the ones in RED) into a Terminal Window.  Hit Enter after each command.

Step 1.  Install Git.

sudo apt install git


Step 2.  Copy the onedrive-d files from Git to your computer.

git clone https://github.com/xybu92/onedrive-d.git


Step 3.  Move to the the ondrive-d folder.

cd ~/onedrive-d


Step 4.  Install onedrive-d.

./install.sh


Step 5.  Make a folder in your home directory to sync your OneDrive files to and from.

mkdir -p ~/OneDrive


Step 6.  Configure onedrive-d to work with your online OneDrive Account ( The four (A-D) sub-steps are highlighted in yellow below).

onedrive-perf

After typing the onedrive-pref command, complete the four (4) steps (A-D) below to finish the configurations.

A.  Connect the sync client to your Microsoft account. 
In the terminal window onedrive-perf will display a link which will allow you to authorize your computer to sync with your online OneDrive account.  Just paste the displayed link (the one in the Terminal Window) into your web browser and click on "YES" to authorize onedrive-d to access to your Microsoft OneDrive Account. Don't close your browser, you'll need the URL of the page you were sent to after the authorization process.

B.  Getting the CallBack URL
In your browser select and copy the URL of the Blank webpage you were sent to after authorizing onedrive-d.  Do not copy the "https://" part, copy everything past "https://".  It should have ..."code="... in it. 

C.  Pick the local folder that onedrive-d will sync (copy) all your online files to.
Any files you put in this folder will be uploaded to your Microsoft OneDrive and any files in your Microsoft OneDrive online folder will be downloaded to this folder. This should be the folder we created in Step 5. Use the full path: /home/username/OneDrive/
NOTE: change “username” to your Home Directory or logon name. The default should be right if you did Step 5 correct, but be sure to check it.

D.  The last two settings are the Numeric Settings and the Ignore File List. I entered “n” for no for both of these settings. If you feel you need to edit these settings, choose Y change what you need.


Step 7. Start the onedrive-d deamon.

onedrive-d start

NOTE:  It will continue running in the background, syncing your files.  If you have a lot of files in your OneDrive account give it time to finish the sync on it's first run.


Step 8. 
Start onedrive-d every time we log-in.

Launch the program STARTUP APPLICATIONS  (search for it in your Unity Launcher).  Once it starts, click on the ADD Button and fill in the fields with the following:

NAME: OneDrive
COMMAND: onedrive-d start
COMMENT: Starts OneDrive Sync app


Click on the SAVE Button to finish it.

NOTE: You can put anything you want for NAME and COMMENTS but COMMAND has to be exactly like I have it.


That's it your done!!!  Your computer and your Microsoft OneDrive files should be syncing


--------------------------------------------------------------------------------------------------
Other useful onedrive-d commands:

 onedrive-d start    Start the daemon.
 onedrive-d stop     Stop the daemon.
 onedrive-d restart  Stop then start the daemon.
 onedrive-d status   Get the status of the daemon.