如何在Linux上安装和使用Google Drive?

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 Ocamlfuse

    Google云端硬碟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在线帐户,如下所示。

Gnome Control Center
侏儒控制中心

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服务。

Gnome Online Accounts Google Drive
Gnome在线帐户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应用程序集成。

Google Drive Gnome Login
Google Drive 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.

在接下来的步骤中,我们将提供先前提供的帐户的密码。 通过单击眼睛图标,我们还将以明文形式显示密码,以确保密码正确。

Google Drive Account Password
Google云端硬盘帐户密码

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按钮。

Allow Gnome Online Accounts To Access Google Drive and Other Services
允许Gnome在线帐户访问Google云端硬盘和其他服务

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服务。

Google Account Services Management For Gnome Online Accounts
Gnome在线帐户的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 Drive File Browser For Linux
适用于Linux的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
Add google-drive-ocamlfuse Repository
添加google-drive-ocamlfuse存储库

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
google-drive-ocamlsfuse Ubuntu installation
google-drive-ocamlsfuse Ubuntu安装

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

gdfuse Google Authentication
gdfuse Google身份验证

We will provide the user password with the following screen.

我们将在以下屏幕上提供用户密码。

gdfuse Google Authentication
gdfuse Google身份验证

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

gdfuse Google Allow Permission
gdfuse Google允许权限

We can also see the following screen where we need to allow the account to the Google Account.

我们还可以在以下屏幕上看到需要允许该帐户访问Google帐户的屏幕。

gdfuse Google Allow Permission
gdfuse 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提供的成功页面,如下所示。

gdfuse Successful
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/
Mount Google Drive with google-drive-ocamlfuse Command
使用google-drive-ocamlfuse命令挂载Google云端硬盘

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
List Google Drive Mounted Paths
列出Google云端硬盘的安装路径

翻译自: https://www.poftut.com/how-to-mount-and-use-google-drive-on-linux/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值