Ghost: inštalácia v Digital Ocean
Článok o inštalácií Ghost u cloudového providera Digital Ocean
Prerekvivizity
- Doména, napríklad cez Websupport
- Účet u Digital Ocean
Vytvorenie virtuálnej mašiny a.k.a Droplet
- Vytvoríme nový projekt + New project
- V dashboarde projektu klikneme na Create > Droplets
- V Marketplace vyhľadáme Ghost on Ubuntu
- CPU options volíme Regular Intel with SSD a najlacnejší plán
- Región zvolíme Frankfurt
- Zašktneme IPv6 a Monitoring
- Pridáme SSH kľúč
- Droplet pomenujeme ako názov našej domény, v mojom prípade jozefjuris.sk
- Zaškrtneme Create backups
- Nazáver klikneme na Create Droplet
Update DNS
Nové IPv4 a IPv6 adresy zanesieme do DNSka. Vytvoríme A, AAAA a CNAME pre subdomény. Počkáme kým sa nové záznamy dostanú do sveta.
watch host jozefjuris.sk
Prvé pripojenie na Droplet
ssh root@jozefjuris.sk
Po prvom prihlásení sa spustí skript, ktorý naštartuje MySQL, stiahne ghost-cli a na záver spustí inštaláciu Ghosta. Budete vyzvaní na vyplnenie domény a emailu.
-------------------------------------------------------------------------------
Configuring DigitalOcean 1-Click Ghost installation.
Please wait a minute while your 1-Click is configured.
Once complete, you are encouraged to run mysql_secure_installation to ready
your server for production. Passwords have been saved to:
root/.digitalocean_password
-------------------------------------------------------------------------------
mysqld is alive
Ensuring Ghost-CLI is up-to-date...
+ sudo npm i -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ ghost-cli@1.18.1
removed 1 package and updated 7 packages in 18.534s
Ghost will prompt you for two details:
1. Your domain
- Add an A Record -> 138.68.73.130 & ensure the DNS has fully propagated
- Or alternatively enter http://138.68.73.130
2. Your email address (only used for SSL)
Press enter when you're ready to get started!
✔ Checking system Node.js version - found v14.18.1
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v4.32.0
✔ Finishing install process
? Enter your blog URL: https://jozefjuris.sk
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
ℹ Setting up "ghost" mysql user [skipped]
+ sudo mv /tmp/jozefjuris-sk/jozefjuris.sk.conf /etc/nginx/sites-available/jozefjuris.sk.conf
+ sudo ln -sf /etc/nginx/sites-available/jozefjuris.sk.conf /etc/nginx/sites-enabled/jozefjuris.sk.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Enter your email (For SSL Certificate) jjuris@gmail.com
+ sudo mkdir -p /etc/letsencrypt
+ sudo ./acme.sh --install --home /etc/letsencrypt
+ sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --server letsencrypt --domain jozefjuris.sk --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail jjuris@gmail.com
+ sudo openssl dhparam -dsaparam -out /etc/nginx/snippets/dhparam.pem 2048
+ sudo mv /tmp/ssl-params.conf /etc/nginx/snippets/ssl-params.conf
+ sudo mv /tmp/jozefjuris-sk/jozefjuris.sk-ssl.conf /etc/nginx/sites-available/jozefjuris.sk-ssl.conf
+ sudo ln -sf /etc/nginx/sites-available/jozefjuris.sk-ssl.conf /etc/nginx/sites-enabled/jozefjuris.sk-ssl.conf
+ sudo nginx -s reload
✔ Setting up SSL
+ sudo mv /tmp/jozefjuris-sk/ghost_jozefjuris-sk.service /lib/systemd/system/ghost_jozefjuris-sk.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_jozefjuris-sk
+ sudo systemctl start ghost_jozefjuris-sk
+ sudo systemctl is-enabled ghost_jozefjuris-sk
+ sudo systemctl enable ghost_jozefjuris-sk --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:
https://jozefjuris.sk/ghost/
------------------------------------------------------------------------------
For any further commands, please switch to the ghost-mgr user to manage Ghost.
sudo -i -u ghost-mgr
------------------------------------------------------------------------------
Základné nastavenie
Na čerstvom systéme urobíme update balíkov a reštartujeme mašinu.
apt-get update
apt-get upgrade
reboot now
Registrácia do redakčného rozhrania
Na adrese https://jozefjuris.sk/ghost/.
Blog je pripravený.
Pár poznámok na záver
v systéme existujú dvaja užívatelia:
ghost
: beží pod ním aplikačný serverghost-mgr
: bežný užívateľ, ktorý má možnost ovládať aplikáciu pomocou ghost-clisudo -i -u ghost-mgr
zo systemd nás zaujímajú tieto služby:
systemctl status ghost_jozefjuris-sk.service
systemctl status nginx.service
systemctl status mysql.service
ghost je nainštalovaný v ceste:
ls -l /var/www/ghost/
total 16
-rw-rw-r-- 1 ghost-mgr ghost-mgr 529 Dec 23 16:19 config.production.json
drwxrwxr-x 11 ghost ghost 4096 Dec 23 16:15 content
lrwxrwxrwx 1 ghost-mgr ghost-mgr 30 Dec 23 16:17 current -> /var/www/ghost/versions/4.32.0
drwxr-xr-x 3 root root 4096 Dec 23 16:18 system
drwxrwxr-x 3 ghost-mgr ghost-mgr 4096 Dec 23 16:15 versions
nginx má konfiguráciu v ceste:
ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 49 Dec 23 16:18 jozefjuris.sk-ssl.conf -> /etc/nginx/sites-available/jozefjuris.sk-ssl.conf
lrwxrwxrwx 1 root root 45 Dec 23 16:17 jozefjuris.sk.conf -> /etc/nginx/sites-available/jozefjuris.sk.conf
letsencrypt ukladá certifikáty sem:
ls -l /etc/letsencrypt/jozefjuris.sk/
total 36
drwxr-xr-x 2 root root 4096 Dec 23 16:18 backup
-rw-r--r-- 1 root root 3751 Dec 23 16:18 ca.cer
-rw-r--r-- 1 root root 5589 Dec 23 16:18 fullchain.cer
-rw-r--r-- 1 root root 1838 Dec 23 16:18 jozefjuris.sk.cer
-rw-r--r-- 1 root root 798 Dec 23 16:18 jozefjuris.sk.conf
-rw-r--r-- 1 root root 956 Dec 23 16:18 jozefjuris.sk.csr
-rw-r--r-- 1 root root 148 Dec 23 16:18 jozefjuris.sk.csr.conf
-rw-r--r-- 1 root root 1679 Dec 23 16:18 jozefjuris.sk.key