Google Drive is a very popular cloud-based drive and storage service. Google Drive can be used in different ways from Web, Android, iPhone, Windows, macOS, and Linux. But as today Google does not provide native Google Drive client for Linux distributions like Ubuntu, Debian, Centos, Mint, etc. Even Google advises Web Browser in order to work with Google Drive for Linux users there are some 3rd party applications, tools to connect Google Drive to the local Linux system.
Google云端硬盘是一种非常流行的基于云的驱动器和存储服务。 Google云端硬盘可以通过Web,Android,iPhone,Windows,macOS和Linux等多种方式使用。 但是,由于今天的Google尚未为Ubuntu,Debian,Centos,Mint等Linux发行版提供本地Google Drive客户端。即使Google建议Web浏览器,以便与Linux用户的Google Drive一起使用,也存在一些第三方应用程序,连接工具Google Drive到本地Linux系统。
Google Drive Linux客户端 (Google Drive Linux Clients)
There are a lot of different Google Drive clients for Linux operating systems but most of them are incomplete or unpractical or error-prone to use. In this tutorial, we will use the following 2 Google Drive clients that are superior to other alternatives.
Linux操作系统有很多不同的Google Drive客户端,但是大多数客户端不完整或不切实际或易于出错。 在本教程中,我们将使用以下2个优于其他替代品的Google云端硬盘客户端。
- GNOME Online Accounts GNOME在线帐户
- Google Drive OcamlfuseGoogle云端硬碟Ocamlfuse
带有GNOME在线帐户的Google云端硬盘 (Google Drive with GNOME Online Accounts)
GNOME Online Accounts is a Gnome project which is created in order to use some popular online services natively with a GNOME desktop. Google Drive is one of the supported online services by Gnome Online Accounts. Gnome Online Accounts is the most stable way to use Google Drive in a Linux operating system because of its Gnome community and support.
GNOME在线帐户是一个Gnome项目,创建该项目是为了在GNOME桌面上本地使用一些流行的在线服务。 Google云端硬盘是Gnome在线帐户支持的在线服务之一。 由于Gnome社区和支持,Gnome在线帐户是在Linux操作系统中使用Google Drive的最稳定方法。
In order to use GNOME Online Accounts first, we will install it with the following command. We can install and use the GNOME Online Accounts even we do not use the GNOME desktop environment as all dependencies will be installed automatically. So this means we can use Gnome Online Accounts with other desktop environments like KDE, XFCE, LXDE, etc.
为了首先使用GNOME在线帐户,我们将使用以下命令进行安装。 即使不使用GNOME桌面环境,我们也可以安装和使用GNOME联机帐户,因为所有依赖项都将自动安装。 因此,这意味着我们可以将Gnome在线帐户与其他桌面环境(例如KDE,XFCE,LXDE等)一起使用。
$ sudo apt install gnome-control-center gnome-online-accounts
After the installation is complete we can access the Gnome Online Accounts from the menu or dash with the GNOME Control Center
like below.
安装完成后,我们可以从菜单中访问Gnome联机帐户,也可以使用GNOME Control Center
破折号访问Gnome在线帐户,如下所示。
From the Gnome Control Center, we will click to the Online Accounts
section and the supported online services will be listed in the main screen. We will select the Google
because it is a Google service.
从Gnome控制中心,我们将单击“ Online Accounts
部分,并且受支持的在线服务将在主屏幕中列出。 我们将选择Google
因为它是Google服务。
In the following step we need to authenticate to the Google Drive accounts we want to use and sync. We will be asked for the Google Account or user name with the following screen. We will put the Google user name which is poftut
in this case. We will also be informed that this account will be integrated with the GNOME application.
在接下来的步骤中,我们需要对要使用和同步的Google云端硬盘帐户进行身份验证。 在以下屏幕上,将要求我们提供Google帐户或用户名。 在这种情况下,我们将输入Google用户名,即poftut
。 我们还将被告知该帐户将与GNOME应用程序集成。
In the following step, we will provide the password of the previously provided account. We will also display the password in clear text by clicking the eye icon in order to make sure password correctness.
在接下来的步骤中,我们将提供先前提供的帐户的密码。 通过单击眼睛图标,我们还将以明文形式显示密码,以确保密码正确。
In the following step, we will allow the Gnome to access our provided Google account and related Google services. As we can see that the account will be completely controlled with this GNOME application. We will click to Allow
button.
在接下来的步骤中,我们将允许Gnome访问我们提供的Google帐户和相关的Google服务。 如我们所见,该GNOME应用程序将完全控制该帐户。 我们将单击“ Allow
按钮。
In this step, we will allow our provided Google Account to be used with the following services. As we want to access Google Drive we will enable Documents in this case. An alternative we can enable or disable other services. For security reasons please disable the Google services you will not use.
在此步骤中,我们将允许我们提供的Google帐户与以下服务一起使用。 由于要访问Google云端硬盘,因此在这种情况下,我们将启用文档。 我们可以启用或禁用其他服务的替代方法。 出于安全原因,请禁用您将不使用的Google服务。
Now we have integrated Google Drive and use it with a native file browser like Gnome Files, Nautilus, etc. The added Google Drive account will be listed in the left location pane with the account email address as below. We can navigate Google drive files like local files and folders.
现在,我们已经集成了Google Drive,并将其与本地文件浏览器(如Gnome Files,Nautilus等)一起使用。添加的Google Drive帐户将在左侧位置窗格中列出,帐户电子邮件地址如下所示。 我们可以浏览Google驱动器文件,例如本地文件和文件夹。
带有Google云端硬盘Ocamlfuse的Google云端硬盘(Google Drive with Google Drive Ocamlfuse)
google-drive-ocamlfuse is a FUSE filesystem for Google Drive, written in OCaml. It lets you mount your Google Drive on Linux distributions. As a script or filesystem library it is managed via command line but can be used with GUI like File Browsers. It provides the following features.
google-drive-ocamlfuse是Google云端硬盘的FUSE文件系统,以OCaml编写。 它使您可以在Linux发行版上安装Google云端硬盘。 作为脚本或文件系统库,可通过命令行进行管理,但可与文件浏览器等GUI一起使用。 它提供以下功能。
- Full read/write access to ordinary files and folders 对普通文件和文件夹的完全读/写访问权限
- Read-only access to Google Docs, Sheets, and Slides (exported to configurable formats)对Google文档,表格和幻灯片的只读访问权限(导出为可配置格式)
- Multiple account support 多帐户支持
- Duplicate file handling重复文件处理
Access to trash (
.Trash
directory)访问垃圾箱(
.Trash
目录)- Unix permissions and ownership Unix权限和所有权
- Symbolic links符号链接
- Read-ahead buffers when streaming流式传输时预读缓冲区
Accessing content shared with you (requires configuration)
访问与您共享的内容(需要配置)
Team Drive Support
团队合作支持
Service Account Support
服务帐户支持
OAuth2 for Devices Support
OAuth2设备支持
Let’s start the installation. As a non-standard script, we need to add some extra repository to our Linux system. Ocamlfuse packages are created for the Ubuntu distribution so in order to use other Linux distributions the source code installation should be executed which is explained here.
让我们开始安装。 作为非标准脚本,我们需要在Linux系统中添加一些额外的存储库。 Ocamlfuse的Ubuntu发行版中创建的软件包,以便使用其他Linux发行版的源代码安装应执行该解释在这里。
$ sudo add-apt-repository ppa:alessandro-strada/ppa
Now we will install the OcamlFuse with the following command. The package name is google-drive-ocamlfuse
.
现在,我们将使用以下命令安装OcamlFuse。 软件包名称为google-drive-ocamlfuse
。
$ sudo apt-get install google-drive-ocamlfuse
Now as stated previously we will complete the Google Drive integration from the command line. First, we will create a directory where Google Drive will be mounted. In this case, we will name the directory as googledrive
.
现在,如前所述,我们将从命令行完成Google Drive集成。 首先,我们将创建一个目录,该目录将安装Google云端硬盘。 在这种情况下,我们将目录命名为googledrive
。
$ mkdir googledrive
Now we will run the google-drive-ocamlfuse
command like below.
现在,我们将运行如下所示的google-drive-ocamlfuse
命令。
$ google-drive-ocamlfuse
This command will open the web browser in order to authenticate the Google Drive user with username and password. We will provide the username poftut
like below.
此命令将打开网络浏览器,以便使用用户名和密码对Google云端硬盘用户进行身份验证。 我们将如下提供用户名poftut
。
We will provide the user password with the following screen.
我们将在以下屏幕上提供用户密码。
In the following screen, we will see that gdfuse which is the google-drive-ocamlfuse name wants to access the Google Drive files. We will simply click to Allow
.
在以下屏幕中,我们将看到gdfuse(即google-drive-ocamlfuse名称)想要访问Google云端硬盘文件。 我们只需单击Allow
。
We can also see the following screen where we need to allow the account to the Google Account.
我们还可以在以下屏幕上看到需要允许该帐户访问Google帐户的屏幕。
If everything is complete successfully we the web browser will be redirected to a success page which is like below and provided by gdfuse.
如果一切顺利完成,我们会将网络浏览器重定向到gdfuse提供的成功页面,如下所示。
Now as the last step we will mount our Google Drive to the directory we have previously created named googledrive
like below.
现在,作为最后一步,我们将Google云端硬盘安装到我们之前创建的名为googledrive
的目录,如下所示。
$ google-drive-ocamlfuse googledrive
If there is no error message everything is ok. We can list the Google Drive files from the command line or a standard file manager like below.
如果没有错误消息,则一切正常。 我们可以从命令行或如下所示的标准文件管理器中列出Google云端硬盘文件。
$ ls -l googledrive/
As an extra check, we can list already mounted file systems with the df command where Google Drive will also list. We can also get information like available size, used size, total size, and percentage information.
作为一项额外的检查,我们可以使用df命令列出已经安装的文件系统,其中Google Drive也会列出。 我们还可以获得诸如可用大小,已用大小,总大小和百分比信息之类的信息。
$ df -lh
翻译自: https://www.poftut.com/how-to-mount-and-use-google-drive-on-linux/