项目地址: https://github.com/abraunegg/onedrive
笔者系统版本: Ubuntu 20.04
本文将介绍的主要内容:在Ubuntu20.04版本下下载、安装onedrive,并完成对该软件的基本设置,包括:修改保存位置、跳过onedrive下特定文件夹、开启日志、将onedrive设为系统服务
前往页面 https://github.com/abraunegg/onedrive/blob/master/docs/ubuntu-package-install.md
查看对应指令,系统版本和我一样的同学可以直接复制下列指令完成下载与安装
wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/Release.key | sudo apt-key add -
echo 'deb https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/ ./' | sudo tee /etc/apt/sources.list.d/onedrive.list
sudo apt-get update
sudo apt install onedrive
本文主要完成以下配置
- onedrive授权
- 下载、修改配置文件
- 开始同步
- 将onedrive设置成系统服务
项目给出的配置教程文件地址如下。有需要的学生可以查看其他未提及的用途和配置。
[En]
The address of the configuration tutorial file given by the project is as follows. Students in need can view other unmentioned uses and configurations.
https://github.com/abraunegg/onedrive/blob/master/docs/USAGE.md
注意:此步骤可能无法连接,因此请再尝试几次。
[En]
Note: this step may fail to connect, so try it a few more times.
下载、编辑配置文件
mkdir -p ~/.config/onedrive
wget https://raw.githubusercontent.com/abraunegg/onedrive/master/config -O ~/.config/onedrive/config
配置文件具体内容如下:
Configuration for OneDrive Linux Client
This file contains the list of supported configuration fields
with their default values.
All values need to be enclosed in quotes
When changing a config option below, remove the '#' from the start of the line
For explanations of all config options below see docs/USAGE.md or the man page.
#
sync_dir = "~/OneDrive"
skip_file = "~*|.~*|*.tmp"
monitor_interval = "300"
skip_dir = ""
log_dir = "/var/log/onedrive/"
drive_id = ""
upload_only = "false"
check_nomount = "false"
check_nosync = "false"
download_only = "false"
disable_notifications = "false"
disable_upload_validation = "false"
enable_logging = "false"
force_http_11 = "false"
local_first = "false"
no_remote_delete = "false"
skip_symlinks = "false"
debug_https = "false"
skip_dotfiles = "false"
dry_run = "false"
min_notify_changes = "5"
monitor_log_frequency = "5"
monitor_fullscan_frequency = "12"
sync_root_files = "false"
classify_as_big_delete = "1000"
user_agent = ""
remove_source_files = "false"
skip_dir_strict_match = "false"
application_id = ""
resync = "false"
resync_auth = "false"
bypass_data_preservation = "false"
azure_ad_endpoint = ""
azure_tenant_id = "common"
sync_business_shared_folders = "false"
sync_dir_permissions = "700"
sync_file_permissions = "600"
rate_limit = "131072"
operation_timeout = "3600"
webhook_enabled = "false"
webhook_public_url = ""
webhook_listening_host = ""
webhook_listening_port = "8888"
webhook_expiration_interval = "86400"
webhook_renewal_interval = "43200"
space_reservation = "50"
在配置方面,我主要修改了:
[En]
In terms of configuration, I have mainly modified:
- 同步在linux上的存储位置
- 跳过一些在onedrive上,但不想保存在linux上的文件
- 打开日志,修改日志存储位置
[En]
Open the log and modify the log storage location*
对于其他特定设置,您可以转到以下地址寻求帮助
[En]
For other specific settings, you can go to the following address for help
https://github.com/abraunegg/onedrive/blob/master/docs/USAGE.md
开始同步
onedrive --dry-run --synchronize
命令会因为GFW而连接出错,我在配置的过程中就出现了两种错误,但在尝试了三次后就正常了
onedrive --synchronize --verbose --resync --local-first
将onedrive设置成系统服务
官方的帮助文件中给出了三种方法,我采用的是 通过systemd 以非root用户身份运行OneDrive服务
,这种方法的好处是规避了root用户创建的文件权限的问题
Configuration file successfully loaded
OneDrive - a client for OneDrive Cloud Services
Usage:
onedrive [options] --synchronize
Do a one time synchronization
onedrive [options] --monitor
Monitor filesystem and sync regularly
onedrive [options] --display-config
Display the currently used configuration
onedrive [options] --display-sync-status
Query OneDrive service and report on pending changes
onedrive -h | --help
Show this help screen
onedrive --version
Show version
Options:
--auth-files ARG
Perform authentication not via interactive dialog but via files read/writes to these files.
--auth-response ARG
Perform authentication not via interactive dialog but via providing the response url directly.
--check-for-nomount
Check for the presence of .nosync in the syncdir root. If found, do not perform sync.
--check-for-nosync
Check for the presence of .nosync in each directory. If found, skip directory from sync.
--classify-as-big-delete
Number of children in a path that is locally removed which will be classified as a 'big data delete'
--confdir ARG
Set the directory used to store the configuration files
--create-directory ARG
Create a directory on OneDrive - no sync will be performed.
--create-share-link ARG
Create a shareable link for an existing file on OneDrive
--debug-https
Debug OneDrive HTTPS communication.
--destination-directory ARG
Destination directory for renamed or move on OneDrive - no sync will be performed.
--disable-download-validation
Disable download validation when downloading from OneDrive
--disable-notifications
Do not use desktop notifications in monitor mode.
--disable-upload-validation
Disable upload validation when uploading to OneDrive
--display-config
Display what options the client will use as currently configured - no sync will be performed.
--display-sync-status
Display the sync status of the client - no sync will be performed.
--download-only
Replicate the OneDrive online state locally, by only downloading changes from OneDrive. Do not upload local changes to OneDrive.
--dry-run
Perform a trial sync with no changes made
--enable-logging
Enable client activity to a separate log file
--force
Force the deletion of data when a 'big delete' is detected
--force-http-11
Force the use of HTTP 1.1 for all operations
--force-sync
Force a synchronization of a specific folder, only when using --synchronize --single-directory and ignore all non-default skip_dir and skip_file rules
--get-O365-drive-id ARG
Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library
--get-file-link ARG
Display the file link of a synced file
--help -h
This help information.
--list-shared-folders
List OneDrive Business Shared Folders
--local-first
Synchronize from the local directory source first, before downloading changes from OneDrive.
--log-dir ARG
Directory where logging output is saved to, needs to end with a slash.
--logout
Logout the current user
--min-notify-changes ARG
Minimum number of pending incoming changes necessary to trigger a desktop notification
--modified-by ARG
Display the last modified by details of a given path
--monitor -m
Keep monitoring for local and remote changes
--monitor-fullscan-frequency ARG
Number of sync runs before performing a full local scan of the synced directory
--monitor-interval ARG
Number of seconds by which each sync operation is undertaken when idle under monitor mode.
--monitor-log-frequency ARG
Frequency of logging in monitor mode
--no-remote-delete
Do not delete local file 'deletes' from OneDrive when using --upload-only
--operation-timeout
Maximum amount of time (in seconds) an operation is allowed to take
--print-token
Print the access token, useful for debugging
--reauth
Reauthenticate the client with OneDrive
--remove-directory ARG
Remove a directory on OneDrive - no sync will be performed.
--remove-source-files
Remove source file after successful transfer to OneDrive when using --upload-only
--resync
Forget the last saved state, perform a full sync
--resync-auth
Approve the use of performing a --resync action
--single-directory ARG
Specify a single local directory within the OneDrive root to sync.
--skip-dir ARG
Skip any directories that match this pattern from syncing
--skip-dir-strict-match
When matching skip_dir directories, only match explicit matches
--skip-dot-files
Skip dot files and folders from syncing
--skip-file ARG
Skip any files that match this pattern from syncing
--skip-size ARG
Skip new files larger than this size (in MB)
--skip-symlinks
Skip syncing of symlinks
--source-directory ARG
Source directory to rename or move on OneDrive - no sync will be performed.
--space-reservation ARG
The amount of disk space to reserve (in MB) to avoid 100% disk space utilisation
--sync-root-files
Sync all files in sync_dir root when using sync_list.
--sync-shared-folders
Sync OneDrive Business Shared Folders
--syncdir ARG
Specify the local directory used for synchronization to OneDrive
--synchronize
Perform a synchronization
--upload-only
Replicate the locally configured sync_dir state to OneDrive, by only uploading local changes to OneDrive. Do not download changes from OneDrive.
--user-agent ARG
Specify a User Agent string to the http client
--verbose -v+
Print more details, useful for debugging (repeat for extra debugging)
--version
Print the version and exit
Original: https://www.cnblogs.com/dysonxxxxx/p/16546102.html
Author: dysonkkk
Title: 在ubuntu 20.04下安装配置onedrive
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/522934/
转载文章受原作者版权保护。转载请注明原作者出处!