Cara install ghost di ubuntu cukup sederhana, mengikuti pentunjuk di situs resminya ghost.org untuk aku tak menjamin bisa berhasil. Ada beberapa kendala ketika mengikuti pentujuk resminya, terutama saat prosess ssl. Banyak issue ssl is not working. Disini aku ngasih pentunjuk supaya ghost bisa berhasil di install dan ssl dapat bekerja seperti blog ini. Ada beberapa prasyarat sebelum melakukan install ghost di server.
Prasyarat Install Ghost
- Domain Name
- Server Minimal RAM 1GB
- Ubuntu 18.04 LTS
- Nginx Stable Version
- Certbot
- MySQL
- NodeJS Version 12.x
- Ghost-CLI Latest Version
- Systemd
Domain Name
Domain name yang akan di arahkan untuk ghost sebaiknya sudah di konfigurasikan di VPS, atau sudah di arahkan ke ip server.

Server Minimal RAM 1GB
Spesifikasi minimal RAM 1 GB ini wajib banget, pernah aku nyobain ke server yang cuma punya 512MB RAM, gak ngangkat gaes aplikasi ghost nya 🤣.
Ubuntu 18.04 LTS
Operassi sistem yang di rekomendasiin sama ghost hanya Ubuntu, dan versi 18.04 tentunya lebih baik.
Nginx
Nginx yang aku rekomendasiin yang versi stable, dan blog ini pakai nginx versi 1.18.0 . Nginx versi open source (free) ada dua tipe yaitu stable dan mainline.
Certbot
Ini penting banget nih certbot, cerbot untuk nge setting ssl dari let's encrypt yang pastinya gratis. Karena kalo aku nuruti langkahnya di situs resminya yang SSL nya pake acme.sh gapernah berhasil. Jadi aku mutusin proses konfigurasi SSL nya pake certbot.
NodeJS
Ghost dibangun diatas NodeJs, jadi install NodeJS adalah hal yang wajib. NodeJS yang akan di install adalah versi 12.19.0
MySQL
Database untuk ghost versi produksi wajib pakai MySQL, aku pakai MySQL Versi 8.0.
Ghost-CLI
Ada beberapa funsi dari ghost -cli:
untuk install aplikasi ghost:
$ ghost install
menjalanlan (start) aplikasi ghost:
$ ghost start
menjalankan ulang (restart) ulang aplikasi ghost:
$ ghost restart
mematikan (stop) aplikasi ghost:
$ ghost stop
melihat status aplikasi ghost:
$ ghost status
melihat versi ghost-cli dan aplikasi ghost:
$ ghost version
Cara Instalasi Ghost Di Ubuntu Server
1. Login Server Via SSH sebagai root
#login ke server cloud melalui ssh dengan user root
$ ssh [email protected][YOUR-PUBLIC-IP-ADDRESS]
#contoh:
$ ssh [email protected]
2. Create New User For Ubuntu OS
#membuat user baru untuk ubuntu
$ adduser
#contoh:
$ adduser sanengineer
Tambahkan nama user yang baru saja dibuat ke super user atau root
, caranya
#memasukkan user baru ke root group
$ usermod -aG sudo
#contoh:
$ usermod -aG sudo sanengineer
setelah itu login ke user tersebut (user baru tadi dibuat oleh super user atau root
), cara login:
#ganti user ubuntu
$ su
#atau
$ su -
#contoh:
$ su sanengineer
3. Install Nginx
Sebelum install Nginx pastikan update package list terlebih dahulu dan install packagenya, caranya:
#update package list
$ sudo apt-get update
#install package list
$ sudo apt-get upgrade
Seteleh itu, baru nginx di install, caranya
#setting package nginx ke stable version
$ nginx=stable
$ sudo add-apt-repository ppa:nginx/$nginx
#setelah instalasi selesai, cek versi nginx:
$ nginx -v
kalau version nginx bisa dicek itu artinya sudah berhasil terinstall.
Di panduan resminya kalo ga salah disuruh aktifin ufw
nya, tapi kalo punyaku ufw
nya ga di aktifin. Cara cek ufw
atau firewall :
$ sudo ufw status
Jika muncul diactive
, berarti firewallnya masih blm active. Aku juga masih blm paham kenapa kita disuruh mengaktifkan ufw
ke NGINX FULL
di tutorialnya, padahal tanpa dibuka firewallnya ghost berhasil diinstall beserta ssl via cerbot.
4. Setup Server Block IP Address atau Domain Name di Nginx
Buat dokumen html terlebih dahulu, caranya:
#1.masuk ke diretory `/var/www/`
$ cd /var/www
#2. buat directory dengan nama yang diinginkan, contoh namanya `sanengineer.com`
$ sudo mkdir sanengineer.com
#3. masuk ke directory `sanengineer.com`
$ cd sanengineer.com
#4. buat dokumen html dengan nama `index.html`
$ sudo touch index.html
#5. edit dan simpan isi index.html
$ sudo nano index.html
contoh isi dokumen index.html
setelah dokumen html dibuat, lalu buat server block, caranya:
#1.masuk ke directry sites-available
$ cd /etc/nginx/sites-available
#2.buat file dengan extensi `.conf`, contoh:sanengineer.com.conf
$ sudo touch sanengineer.com.conf
#3.edit dan simpan file sanengineer.com.conf
$ sudo nano sanengineer.com.conf
#4.buat symlink antara ~/sites-available/sanengineer.com.conf
dengan ~/sites-enabled/sanengineer.com.conf.
$ sudo ln -s /etc/nginx/sites-available/sanengineer.com.conf /etc/nginx/sites-enabled/sanengineer.com.conf
Jangan pernah edit file yang ada di directory sites-enabled
, cukup edit file yang ada di sites-available
. Jika udah di symlink
kan pasti file yang ada di sites-enabled
ikut berubah.
isi file server block sanengineer.com.conf
:
server {
listen 80;
listen [::]:80;
server_name sanengineer.com; #ini adalah nama domain yang sudah di set di vps
root /var/www/sanengineer.com/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Masukkan alamat IP address atau url domain ke browser jika sudah tampil seperti gambar di bawah ini berarti web server Nginx sudah berhasil di seting.
5. Setup SSL Via Certbot
Sebelum setup SSL kita harus install Certbot terlebih dahulu caranya:
#1.menambahkan repository certbot ke ubuntu
$ sudo add-apt-repository ppa:certbot/certbot
#2.install certbot
$ sudo apt-get install certbot python-certbot-nginx
ada baiknya cek cerbot version di ubuntu nya :
#cek versi certbot
$ apt-cache policy certbot
#cara lain untu cek certbot version
$ apt-cache policy certbot | grep -i Installed
Setelah certbot terinstall, maka langkah selanjuntnya kita setup ssl untuk domain, caranya cukup simple :
#install ssl untuk domain
$ sudo certbot --nginx
ketika perintah command diatas, jika untuk pertama kalinya menggunakan, certbot meminta alamat email dan persetujuan kondisi. Akan tetapi jika sudah pernah ngisi email, certbot akan mengarahkan untuk memilih domain mana yang akan di setup sslnya, lihat proses dibawah ini:
#1.diminta untuk memasukkan alamat email
Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected]
#2.diminta persetujuan untuk term certbotnya
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
#3.persetujuan kondisi untuk data email
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
#4.memilih domain yang akan di setup ssl
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: yourdomain-1.com
2: sanengineer.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2
#5.Memilih akan di arahkan ulang (redirect) http ke https atau tidak
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/sanengineer.com.conf
#6.notifikasi ketika certbot berhasil setup ssl untuk domain sanengineer.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://sanengineer.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=sanengineer.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/sanengineer.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/sanengineer.com/privkey.pem
Your cert will expire on 2021-03-20. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
setelah setup ssl ke domain selesai, expired date dari ssl nya bisa dicek dengan cara:
#cek expired date ssl certbot
$ sudo certbot certificates
6. Install MySQL
$ sudo apt-get install mysql-server
setelah MySQL berhasil terinstall, diharuskan untuk setting password untuk root
. sebelum configurasi password, ganti user sebagai root terlebih dahulu stepnya:
#1.ganti user ke root
$ su root
#2.login ke MySQL server
$ sudo mysql
#3.setting password untuk username:root on MySQL. Ganti 'yourpassword ke password yang diinginkan
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
#contoh password:757hhdksieiyG
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '757hhdksieiyG';
#4.exit MySQL server
quit
#5.kembali masuk ke user ubuntu selain root (lihat step 2)
$ su sanengineer
7. Install NodeJS
Sebelum install nodeJS, package nodeJS 12 harus di tambahkan ke ubuntu, setelah itu di install nodeJS nya.
#1.menambahkan NodeSource APT repository untuk Node 12
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
#2.Install Node.js
$ sudo apt-get install -y nodejs
#3.check versi nodejs setelah selasai di install
$ node -v
8. Install Ghost-CLI
Install ghost-cli secara global, caranya:
#install ghost-cli versi terbaru
$ sudo npm install [email protected] -g
Ketika ghost-cli berhasil di install, kemudian jalankan perintah ghost help
untuk melihat daftar dari command line yang tersedia.
9. Install Aplikasi Ghost
Sebelum melakukan install ghost, buatlah directory dengan nama ghost-yourwebsite
di path ~/var/www
, lihat langkah-langkah di bawah ini:
#1.buat diretory, ganti yourwebsite dengan nama yang diinginkan
$ sudo mkdir -p /var/www/ghost-yourwebsite
contoh
$ sudo mkdir -p /var/www/ghost-sanengineer
#2.setup directory owner, ganti dengan user ubuntu
$ sudo chown : /var/www/ghost-yourwebsite
contoh
$ sudo chown sanengineer:sanengineer /var/www/ghost-sanenginer
#3.setup permission directory
$ sudo chmod 775 /var/www/ghost-yourwebsite
contoh
$ sudo chmod 775 /var/www/ghost-sanenginer
ketika directory di buat, aplikasi ghost akan di install ke directory ~/var/www/ghost-yourwebsite
, caranya:
#1.masuk ke directory ~/var/www/ghost-yourwebsite
$ cd /var/www/ghost-yourwebsite
contoh
$ cd /var/www/ghost-sanengineer
#2.install ghost
$ sudo ghost install
saat proses install ghost selesai di ubuntu server, ghost akan menanyakan beberapa konfigurasi, lihat proses di bawah:
#1.nama url blog, url blog harus http meskipun sudah di setup https nya.
Enter your blog URL: http://yourdomain.com
#2.localhost MySQL, kalo tidak ada localhost custom (tambahan), isikan saja dengan localhost
Enter your MySQL hostname: localhost
#3.username MySQL, masukkan username mysql yang sudah dibuat
Enter your MySQL username: yourusername-mysql
#4.password MySQL
Enter your MySQL password: ****
#5.masukkan nama database yang sudah di persiapkan untuk dipakai aplikasi ghost
Enter your Ghost database name: database_mysql_untuk_ghost
#6.seting ghost untuk membuat mysql user.
ghost bisa membuat mysql user secara otomatis,
jadi mysql user yang dibuat oleh ghost hanya bisa
mengedit databases mysql yang digunakan untuk aplikasi ghost
Do you wish to set up "ghost" mysql user? Yes
#7.setup systemd
Do you wish to set up Systemd? Yes
#8.menjalankan aplikasi ghost
Do you want to start Ghost? Yes
Jika ghost meminta konfigurasi SSL dan NGINX, di abaikan saja (skipped) karena SSL dan NGINX sudah diatur sebelum ghost di install.
Akan tetapi ghost sudah bisa mendeteksi secara otomatis, jika ssl dan nginx sudah di setup. Untuk melihat konfigurasi untuk aplikasi ghost bisa dilihat di file config.production.json
lokasinya ada di directory ~/var/www/ghost-yourwebsite
Langkah-langkah instalasi ghost diatas dibuat oleh username ubuntu yang sudah di masukkan dalam root group, dalam kasus ini contoh nama username adalah sanengineer
.