sumarsono.com
Take it with a grain of salt


Install Ghost Blogging Platform Di Ubuntu 20.04 Focal Fossa

Posted on

Ghost is a free and open source blogging platform written in JavaScript and distributed under the MIT License, designed to simplify the process of online publishing for individual bloggers as well as online publications. Wikipedia

Aku akan memakai kontainer ubuntu 20.04 untuk dipasang Ghost. Pertama, aku bikin dulu kontainer-nya dengan nama ghost dan base image ubuntu/focal

┌─[sumar][tingpret][~]
└─▪  lxc launch images:ubuntu/focal ghost
Creating ghost
Starting ghost                              

Kemudian aku akan exec shell ke dalam kontainer ghost

┌─[sumar][tingpret][~]
└─▪  lxc exec ghost -- bash
root@ghost:~#

Dari dalam kontainer ghost, aku akan bikin user baru bernama sumar kemudian install nginx dan curl

┌─[sumar][tingpret][~]
└─▪  lxc exec ghost -- bash
root@ghost:~# apt update

root@ghost:~# adduser sumar
Adding user `sumar' ...
Adding new group `sumar' (1001) ...
Adding new user `sumar' (1001) with group `sumar' ...
Creating home directory `/home/sumar' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for sumar
Enter the new value, or press ENTER for the default
        Full Name []: Sumarsono
        Room Number []: 
        Work Phone []: 
        Home Phone []: 
        Other []: 
Is the information correct? [Y/n] Y

root@ghost:~# usermod -aG sudo sumar

root@ghost:~# su - sumar            
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

sumar@ghost:~$ sudo apt-get install nginx curl
[sudo] password for sumar: 
...
Do you want to continue? [Y/n] y

Selanjutnya, aku akan pasang nodejs versi 14 yang dibutuhkan oleh ghost, dilanjutkan dengan memasang ghost-cli pakai npm

sumar@ghost:~$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash

sumar@ghost:~$ sudo apt-get install -y nodejs

sumar@ghost:~$ sudo npm install ghost-cli@latest -g

Lanjut, saatnya bikin website pakai ghost-cli, dimulai dari menyiapkan direktori hingga setup-nya. Wizard ghost install ini sangat mudah untuk diikuti, baca aca instruksinya dan ikuti.

sumar@ghost:~$ sudo mkdir -p /var/www/ghost.sumarsono.com
sumar@ghost:~$ sudo chown sumar:sumar /var/www/ghost.sumarsono.com
sumar@ghost:~$ sudo chmod 755 /var/www/ghost.sumarsono.com        
sumar@ghost:~$ cd /var/www/ghost.sumarsono.com            
sumar@ghost:/var/www/ghost.sumarsono.com$ ghost install
✔ Checking system Node.js version - found v14.16.1
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking system compatibility
Local MySQL install was not found or is stopped. You can ignore this if you are using a remote MySQL host.
Alternatively you could:
a) install/start MySQL locally
b) run `ghost install --db=sqlite3` to use sqlite
c) run `ghost install local` to get a development install using sqlite3.
? Continue anyway? Yes
MySQL check skipped
ℹ Checking for a MySQL installation [skipped]
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v4.4.0
✔ Finishing install process
? Enter your blog URL: http://ghost.sumarsono.com
? Enter your MySQL hostname: 10.179.72.186
? Enter your MySQL username: [hidden]
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: [hidden]
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/ghost.sumarsono.com/content
✔ Setting up "ghost" system user
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes
+ sudo mv /tmp/ghost-sumarsono-com/ghost.sumarsono.com.conf /etc/nginx/sites-available/ghost.sumarsono.com.conf
+ sudo ln -sf /etc/nginx/sites-available/ghost.sumarsono.com.conf /etc/nginx/sites-enabled/ghost.sumarsono.com.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? No
ℹ Setting up SSL [skipped]
? Do you wish to set up Systemd? Yes
+ sudo mv /tmp/ghost-sumarsono-com/ghost_ghost-sumarsono-com.service /lib/systemd/system/ghost_ghost-sumarsono-com.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_ghost-sumarsono-com
? Do you want to start Ghost? Yes
+ sudo systemctl start ghost_ghost-sumarsono-com
+ sudo systemctl is-enabled ghost_ghost-sumarsono-com
+ sudo systemctl enable ghost_ghost-sumarsono-com --quiet
✔ Starting Ghost

Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/docs/config/#mail

------------------------------------------------------------------------------

Ghost was installed successfully! To complete setup of your publication, visit: 

    http://ghost.sumarsono.com/ghost/

Tinggal publish ghost.sumarsono.com via argi tunnel

┌─[sumar][tingpret][~]
└─▪  cat /etc/cloudflared/config.yml 
credentials-file: [hidden]
tunnel: [hidden]
loglevel: error

ingress:
  - hostname: ghost.sumarsono.com
    service: http://10.179.72.146:80
┌─[sumar][tingpret][~]
└─▪  cloudflared tunnel route dns [hidden] ghost.sumarsono.com 

Kalau bingung soal argo tunnel, bisa baca Expose Local Lxd Container Ke Internet Pakai Cloudflare Argo Tunnel

SELESAI, sekarang akses http://ghost.sumarsono.com/ghost/ dan selesaikan instalasi ghost-nya.