[介紹] 在 CentOS 上使用 google-drive-ocamlfuse 掛載Google雲端硬碟

在 CentOS 上使用 google-drive-ocamlfuse 掛載Google雲端硬碟




# yum install sqlite-devel fuse fuse-devel libcurl-devel zlib-devel m4
# yum install ocaml ocamldoc ocaml-camlp4-devel
# wget -O - | sh -s /usr/local/bin/


# opam init
# opam install google-drive-ocamlfuse
# opam list
# google-drive-ocamlfuse --help

3.存取 Google Drive API

Next, we’re going to enable API access to Google Drive and create a set of credentials. These steps require a web browser on your local computer, and access to the Google account with which your Drive is associated.

(a) Visit the Google API developer’s console on your desktop at


(b) Create a project. Click Create Project, then give the project a name and click Create again:


    Google will take a moment to create the project, and when it’s complete you’ll arrive at the dashboard:


(c) Enable the Google Drive API. Click APIs & auth, then APIs when the menu expands. You’ll see a list like the one below. Click on Drive API:


    If you don’t see the Drive API on the list as pictured, you may need to search for it. After you’ve selected it, click the blue Enable button at the top of the page.


(d) Click Credentials in the menu on the left side of the page. Then click Add New Credential.


    Click Configure consent screen. Google assumes you are writing a piece of software so it wants some information about it.

    The product name field is required, but you can leave everything else blank. Then click Save at the bottom of the page.


    Now click Other for the application type. Google will ask for a name again - you may use the default or choose a name you’ll easily associate with this project. Then click Create.

    Click Credentials on the menu on the left side of the screen, and select your project from the list. You will now be able to view your Client ID and Client secret strings:

4. 授權 OCamlfuse 存取

Next, we’ll provide the credentials for your Drive API to OCamlfuse in your Linode, authorizing it to access your Google Drive.

(a) Authorize your Google Drive link, replacing client-ID and client-secret with those you received from the Google API Manager in the steps above:

# google-drive-ocamlfuse -headless -label backup -id client-ID -secret client-secret

    The output from this command will give you a long URL. Copy it and paste it for use in step 2:

    Please, open the following URL in a web browser:
    Please enter the verification code:

(b) Google will ask for permission to allow this new application (OCamlfuse) to access your Google Drive. Click Accept to receive the verification code:

(c) Copy/paste the verification code back to OCamlfuse in your VPS.


# mkdir -p /Data
# google-drive-ocamlfuse -label backup /Data

# fusermount -u /Data

6.設定開機自動掛載 google driver
首先在根目錄新增一個檔叫 gdfuse

su root -l -c "google-drive-ocamlfuse -label backup /Data”
exit 0

# chmod 700 /gdfuse

再加進去 rc.local

# vi /etc/rc.local


# Auto Mount Google Driver



附件: 您所在的用戶組無法下載或查看附件