Tutorial Mount Google Drive pada Linux Server
Pada Artikel kali ini saya ingin berbagi Tutorial Mount Google Drive pada Linux Server dengan Oauth Credentials. Mari kita simak langkah langkah-nya :
Step 1 : Install Go Lang
|
1
2
3
|
[root@db ~]# wget https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
[root@db ~]# tar -C /usr/local -xf go1.13.5.linux-amd64.tar.gz
[root@db ~]# sudo nano ~/.bash_profile
|
tambahkan ini pada file .bash_profile
|
1
2
|
export GOPATH=$HOME/golang
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
|
lalu reload PATH pake ini
|
1
2
|
[root@db ~]# source ~/.bash_profile
[root@db ~]# go version
|
Step 2 : Bikin Google Credentials Sendiri
caranya gini
- klik Google API Console
- Create a new project
- Enable Google Drive API
- Configure Consent Screen
- Create credentials pilih OAuth client ID
bingung ? ini ada tutorial yg pake gambar https://ztoro.com/blog/membuat-google-credential-sendiri-step-by-step/
Step 3 : Download GDrive & Set Credentials
Asumsi install go udah lancar, lanjut download GDrive project dari GitHub dan extract project pada folder. buka file handlers_drive.go edit lines 17 & 18 isi dengan google credentials yang tadi dibuat.
|
1
2
|
const ClientId = "367116221053-7n0v**.apps.googleusercontent.com"
const ClientSecret = "1qsNodXN*****jUjmvhoO"
|
Step 4 : Build the Project
|
1
2
|
[root@db ~]# go get github.com/prasmussen/gdrive
[root@db ~]# go env
|
lihat pada GOOS=windows, jika pake linux atau macOS ganti jadi GOOS=linux. buka file yg ada di path GOENV=”/path/.config/go/env”
|
1 |
[root@db ~]# go build
|
Step 5 : Upload & Test GDrive pada Server
|
1 |
[root@db ~]# gdrive list
|
akan muncul link kaya gini https://accounts.google.com/o/oauth2/auth?client_id=123456789123-7n0vf**** copas di browser lalu pilih akun yang tadi buat creadential lalu klik allow. Akan muncul verification code
|
1 |
Enter verification code: 4/9gKYAFAJ326XIP6J42t35****
|
copas itu code ke terminal.
Step 6 : File Upload Test
|
1 |
[root@db ~]# gdrive upload /var/www/backup/app.tar.gz
|
untuk melihat fitur lain ketik gdrive help di google. Selamat mencoba ya 😉
Sekian Tutorial yang bisa saya sampaikan I hope this article will help you.
1 Response
[…] Baca juga : cara Mount Google Drive pada Linux Server dengan Oauth Credentials Sendiri […]