Install ghost on ubuntu 22.04

Install ghost on ubuntu 22.04

$sudo apt update -y && sudo apt upgrade -y
$sudo apt install nginx -y
$sudo apt install mysql-server -y
$systemctl start mysql.service && systemctl enable mysql.service
$mysql

CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
CREATE DATABASE ghost;
GRANT ALL PRIVILEGES ON ghost.* TO 'ghost'@'localhost';
FLUSH PRIVILEGES;
EXIT;

$sudo apt-get update
$sudo apt-get install -y ca-certificates curl gnupg
$sudo mkdir -p /etc/apt/keyrings
$curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

$NODE_MAJOR=18
$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

$sudo apt-get update
$sudo apt-get install nodejs -y

$node --version && npm --version

$sudo npm install -g ghost-cli@latest
$ghost -v

$adduser ghostuser
$usermod -aG sudo ghostuser
$su - ghostuser
$sudo mkdir -p /var/www/ghost
$sudo chown ghostuser:ghostuser /var/www/ghost
$sudo chmod 775 /var/www/ghost

$cd /var/www/ghost/
$ghost install

? Enter your blog URL: http://yourdomain.com
? Enter your MySQL hostname: 127.0.0.1 (not localhost, wont' work)
? Enter your MySQL username: ghost
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost

access URL/ghost to setup