How To Mount Google Drive on Linux

Google Drive is nice cloud storage which provide document editing features. However, it does not yet provide a Linux client. I find a good third party tool that works with Google Drive on Linux very well: google-drive-ocamlfuse.

The website of google-drive-ocamlfuse provides easy to follow instructions to install it. In this tutorial, we show a more convenient method using opam.

Install opam

If you have not installed opam, you need to install opam first.

Install google-drive-ocamlfuse via opam

You may need to install some packages on your system. On Fedora, you may need to at least install:

# yum install sqlite-devel fuse-devel libcurl-devel zlib-devel m4

opam will automatically resolve dependencies and install the needed packages:

$ opam install google-drive-ocamlfuse

Configure google-drive-ocamlfuse

You need to run google-drive-ocamlfuse without parameters and it will request authorization:

$ google-drive-ocamlfuse

This command will create the default application directory (~/.gdfuse/default), containing the configuration file config and start a web browser to obtain authorization to access your Google Drive.

Mounting Google Drive

After configured google-drive-ocamlfuse, you can mount the file system:

$ google-drive-ocamlfuse mountpoint

You need to be patient and it may take some time to load your files.

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

13 comments:

  1. Thank you for the write up on how to install google-drive-ocamlfuse. After I installed opam, I try to run the opam install google-drive-ocamlfuse, but it is breaking on the install of sqlite3-ocaml.2.0.4.

    I am getting error:

    Package sqlite3 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `sqlite3.pc’
    to the PKG_CONFIG_PATH environment variable

    No package ‘sqlite3′ found

    E: Failure(“Command ”/root/.opam/4.00.1/bin/ocamlbuild’ lib/libsqlite3_stubs.a lib/dllsqlite3_stubs.so lib/sqlite3.cma lib/sqlite3.cmxa lib/sqlite3.a lib/sqlite3.cmxs -tag debug’ terminated with error code 2″)

    Can you advise?

    1. I tried it again on my system (Fedora 19 x86-64). After installing several needed packages, it works for me:

      # yum install sqlite-devel fuse-devel libcurl-devel zlib-devel

      `opam` needs some headers from the Linux system. Hope this can helps you. You may need to install more packages it `opam` reports it.

      1. Along with the dependencies listed above I also needed to install m4 on my Fedora 19 x86-64 system

        #yum install m4

        One of the opam dependencies needed it (ocamlfind).

  2. Thanks for the tutorial. In the momento of the apply the command: $ opam install google-drive-ocamlfuse, i receive a error message: The former state can be restored with opam switch import -f “/home/kingars/.opam/4.01.0/backup/state-20140020125053.export”

    ‘opam install google-drive-ocamlfuse’ failed.

  3. Hello,

    The following was prompted on Fedora 19:

    [waldyd@localhost-live ~]$ opam install google-drive-ocamlfuse
    The following actions will be performed:
    – install cryptokit.1.9 [required by gapi-ocaml]
    – install camlp4.4.02.1+system [required by extlib]
    – install sqlite3-ocaml.2.0.7 [required by google-drive-ocamlfuse]
    – install ocamlnet.3.7.6 [required by gapi-ocaml]
    – install extlib.1.6.1 [required by gapi-ocaml]
    – install gapi-ocaml.0.2.6 [required by google-drive-ocamlfuse]
    – install google-drive-ocamlfuse.0.5.10
    === 7 to install ===
    Do you want to continue ? [Y/n] Y

    =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Copying ~/.opam/repo/default/packages/camlp4/camlp4.4.02.1+system/files/install to ~/.opam/system/build/camlp4.4.02.1+system/
    Copying ~/.opam/repo/default/packages/camlp4/camlp4.4.02.1+system/files/check-camlp4.sh to ~/.opam/system/build/camlp4.4.02.1+system/
    Building camlp4.4.02.1+system:
    sh ./check-camlp4.sh
    [ERROR] The compilation of camlp4.4.02.1+system failed.
    Removing camlp4.4.02.1+system.
    Nothing to do.
    Building cryptokit.1.9:
    make
    make install
    [ERROR] The compilation of cryptokit.1.9 failed.
    Removing cryptokit.1.9.
    ocamlfind remove cryptokit
    Building sqlite3-ocaml.2.0.7:
    ocaml setup.ml -configure –prefix /home/waldyd/.opam/system
    ocaml setup.ml -build
    ocaml setup.ml -install
    [ERROR] The compilation of sqlite3-ocaml.2.0.7 failed.
    Removing sqlite3-ocaml.2.0.7.
    ocamlfind remove sqlite3

    #=== ERROR while installing camlp4.4.02.1+system ==============================#
    # opam-version 1.2.0
    # os linux
    # command sh ./check-camlp4.sh
    # path /home/waldyd/.opam/system/build/camlp4.4.02.1+system
    # compiler system (4.02.1)
    # exit-code 1
    # env-file /home/waldyd/.opam/system/build/camlp4.4.02.1+system/camlp4-14957-e7966f.env
    # stdout-file /home/waldyd/.opam/system/build/camlp4.4.02.1+system/camlp4-14957-e7966f.out
    # stderr-file /home/waldyd/.opam/system/build/camlp4.4.02.1+system/camlp4-14957-e7966f.err
    ### stdout ###
    # …[truncated]
    # 4.02 by switching to a local installation via `opam switch 4.02.1`.
    #
    # Here are some installation instructions for camlp4 if you obtained OCaml
    # via the OPAM binary packages:
    #
    # http://software.opensuse.org/download.html?project=home%3Aocaml&package=ocaml
    #
    # * Debian/Ubuntu: sudo apt-get install camlp4-extra
    # * RHEL/CentOS/Fedora: sudo yum install ocaml-camlp4
    #
    ### stderr ###
    # ./check-camlp4.sh: line 3: camlp4orf: command not found

    #=== ERROR while installing cryptokit.1.9 =====================================#
    # opam-version 1.2.0
    # os linux
    # command make
    # path /home/waldyd/.opam/system/build/cryptokit.1.9
    # compiler system (4.02.1)
    # exit-code 2
    # env-file /home/waldyd/.opam/system/build/cryptokit.1.9/cryptokit-14968-d2d111.env
    # stdout-file /home/waldyd/.opam/system/build/cryptokit.1.9/cryptokit-14968-d2d111.out
    # stderr-file /home/waldyd/.opam/system/build/cryptokit.1.9/cryptokit-14968-d2d111.err
    ### stdout ###
    # ocaml setup.ml -configure
    ### stderr ###
    # …[truncated]
    # Use Bytes.set instead.
    # File “/home/gildor/programmation/oasis/src/oasis/OASISFindlib.ml”, line 256, characters 6-24:
    # Warning 3: deprecated: Lazy.lazy_from_fun
    # Use Lazy.from_fun instead.
    # W: Field ‘ocamldoc’ is not set
    # W: Not_found
    # W: Not_found
    # E: Cannot find external tool ‘ocamldoc’
    # E: Failure(“1 configuration error”)
    # make: *** [setup.data] Error 1

    #=== ERROR while installing sqlite3-ocaml.2.0.7 ===============================#
    # opam-version 1.2.0
    # os linux
    # command ocaml setup.ml -configure –prefix /home/waldyd/.opam/system
    # path /home/waldyd/.opam/system/build/sqlite3-ocaml.2.0.7
    # compiler system (4.02.1)
    # exit-code 1
    # env-file /home/waldyd/.opam/system/build/sqlite3-ocaml.2.0.7/sqlite3-ocaml-14995-ad8886.env
    # stdout-file /home/waldyd/.opam/system/build/sqlite3-ocaml.2.0.7/sqlite3-ocaml-14995-ad8886.out
    # stderr-file /home/waldyd/.opam/system/build/sqlite3-ocaml.2.0.7/sqlite3-ocaml-14995-ad8886.err
    ### stderr ###
    # …[truncated]
    # File “setup.ml”, line 247, characters 8-26:
    # Warning 3: deprecated: String.set
    # Use Bytes.set instead.
    # File “setup.ml”, line 2502, characters 6-24:
    # Warning 3: deprecated: Lazy.lazy_from_fun
    # Use Lazy.from_fun instead.
    # W: Field ‘ocamldoc’ is not set
    # W: Not_found
    # E: Cannot find external tool ‘ocamldoc’
    # E: Failure(“1 configuration error”)

    =-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    The following failed
    – install camlp4.4.02.1+system
    – install cryptokit.1.9
    – install sqlite3-ocaml.2.0.7
    Due to the errors, the following have been cancelled
    – install extlib.1.6.1
    – install gapi-ocaml.0.2.6
    – install ocamlnet.3.7.6
    – install google-drive-ocamlfuse.0.5.10
    [waldyd@localhost-live ~]$ sudo yum install ocaml-camlp4
    Loaded plugins: langpacks, refresh-packagekit
    Package ocaml-camlp4-4.02.1-3.1.i686 already installed and latest version
    Nothing to do

Leave a Reply

Your email address will not be published. Required fields are marked *