How to install Ghost CMS on Debian 12
To Install Ghost CMS On Debian 12
Introduction :
Ghost is a modern, open-source content management system (CMS) designed specifically for professional publishing introduced in 2013. It emphasizes simplicity and efficiency, offering a streamlined platform for bloggers, writers, and businesses to create and manage their content. Built on Node.js, Ghost provides a robust framework that supports dynamic content while ensuring a clean and user-friendly interface.
Procedure :
Step 1 : Check OS version by using following command.
root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/
Step 2 : Add new user by using following command.
root@linuxhelp:~# adduser user
Adding user `user' ...
Adding new group `user' (1003) ...
Adding new user `user' (1003) with group `user (1003)' ...
Creating home directory `/home/user' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for user
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
Adding new user `user' to supplemental / extra groups `users' ...
Adding user `user' to group `users' ...
Step 3 : Add user to sudo group to make root privileges by using following command.
root@linuxhelp:~# usermod -aG sudo user
Step 4 : Switch over to user by using following command.
root@linuxhelp:~# su user
Step 5 : Update the system packages by using following command.
user@linuxhelp:/root$ sudo apt-get update
[sudo] password for user:
Hit:1 http://security.debian.org/debian-security bookworm-security InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Hit:4 https://download.docker.com/linux/debian bookworm InRelease
Reading package lists... Done
Step 6 : Upgrade the system packages by using following command.
user@linuxhelp:/root$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
Processing triggers for desktop-file-utils (0.26-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for initramfs-tools (0.142+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.1.0-12-amd64
Step 7 : Install Nginx by using following command.
user@linuxhelp:/root$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
nginx-common
Setting up nginx (1.22.1-9) ...
Processing triggers for man-db (2.11.2-2) ...
Step 8 : Install MySQL by using following command.
user@linuxhelp:/root$ sudo apt install default-mysql-server -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
default-mysql-server is already the newest version (1.1.0).
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Step 9 : Login to MySQL by using following command.
user@linuxhelp:/root$ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Step 10 : Change root user password by using following command.
MariaDB [(none)]> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.013 sec)
Step 11 : Refresh the privileges by using following command.
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.008 sec)
Step 12 : Exit from MySQL console by using following command.
MariaDB [(none)]> exit
Bye
Step 13 : Update the system packages by using following command.
user@linuxhelp:/root$ sudo apt-get update
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
linux-image-amd64
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Step 14 : Install required packages for ghost installation by using following command.
user@linuxhelp:/root$ sudo apt-get install -y ca-certificates curl gnupg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311).
curl is already the newest version (7.88.1-10+deb12u7).
gnupg is already the newest version (2.2.40-1.1).
gnupg set to manually installed.
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Step 15 : Create a directory for store gpg key by using following command.
user@linuxhelp:/root$ sudo mkdir -p /etc/apt/keyrings
Step 16 : Download the gpg key by using following command.
user@linuxhelp:/root$ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
Step 17 : Store node version as value to the Variable by using following command.
user@linuxhelp:/root$ NODE_MAJOR=18
Step 18 : Make the source entry by using following command.
user@linuxhelp:/root$ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main
Step 19 : Update the system packages by using following command.
user@linuxhelp:/root$ sudo apt-get update
Hit:1 https://download.docker.com/linux/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Get:4 https://deb.nodesource.com/node_18.x nodistro InRelease [12.1 kB]
Hit:5 http://security.debian.org/debian-security bookworm-security InRelease
Get:6 https://deb.nodesource.com/node_18.x nodistro/main amd64 Packages [10.2 kB]
Fetched 22.3 kB in 1s (39.4 kB/s)
Reading package lists... Done
Step 20 : Install nodejs by using following command.
user@linuxhelp:/root$ sudo apt-get install nodejs -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdbus-glib-1-2 libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 29.6 MB of archives.
After this operation, 187 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_18.x nodistro/main amd64 nodejs amd64 18.20.4-1nodesource1 [29.6 MB]
Fetched 29.6 MB in 1s (26.5 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 172121 files and directories currently installed.)
Preparing to unpack .../nodejs_18.20.4-1nodesource1_amd64.deb ...
Unpacking nodejs (18.20.4-1nodesource1) ...
Setting up nodejs (18.20.4-1nodesource1) ...
Processing triggers for man-db (2.11.2-2) ...
Step 21 : Install ghost CLI by using following command.
user@linuxhelp:/root$ sudo npm install ghost-cli@latest -g
|
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
added 596 packages in 2m
152 packages are looking for funding
run `npm fund` for details
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.9.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
npm notice To update run: npm install -g npm@10.9.0
npm notice
Step 22 : Create document root directory by using following command.
user@linuxhelp:/root$ sudo mkdir -p /var/www/sitename
Step 23 : Change ownership for the document root directory by using following command.
user@linuxhelp:/root$ sudo chown user:user /var/www/sitename
Step 24 : Change permission to the document root directory by using following command.
user@linuxhelp:/root$ sudo chmod 775 /var/www/sitename
Step 25 : Go to the document root directory by using following command.
user@linuxhelp:/root$ cd /var/www/sitename
Step 26 : Install ghost by using following command.
user@linuxhelp:/var/www/sitename$ ghost install
Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org
✔ Checking system Node.js version - found v18.20.4
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v5.96.1
✔ Finishing install process
? Enter your blog URL: http://localhost:2368
? Enter your MySQL hostname: 127.0.0.1
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: mysql
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/sitename/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
✔ Setting up "ghost" mysql user
Nginx is not installed. Skipping Nginx setup.
ℹ Setting up Nginx [skipped]
Nginx setup task was skipped, skipping SSL setup
ℹ Setting up SSL [skipped]
? Do you wish to set up Systemd? Yes
+ sudo mv /tmp/localhost/ghost_localhost.service /lib/systemd/system/ghost_localhost.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_localhost
? Do you want to start Ghost? Yes
+ sudo systemctl start ghost_localhost
+ sudo systemctl is-enabled ghost_localhost
+ sudo systemctl enable ghost_localhost --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://localhost:2368/ghost/
Step 27 : Copy URL with port number and open browser, After open browser paste and search the URL as shown in below image.
Step 28 : Create account by filling details as shown in below image.
Step 29 : The dashboard page will be shown as shown in below image.
Conclusion :
We have reached the end of this article. In this guide, we have walked you through the steps required to install Ghost CMS on Debian 12. Your feedback is much welcome.