When running “ghost install” on my vps I receive this error.
webmaster@website:/var/www/site$ ghost install
Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org
A SystemError occurred.
Message: Current directory is not empty, Ghost cannot be installed here.
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v12.22.9
Ghost-CLI Version: 1.24.0
Environment: production
Command: 'ghost install'
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
webmaster@website:/var/www/site$ 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 v12.22.9
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✖ Downloading and installing Ghost v5.43.0
An error occurred.
Message: 'fs.rmSync is not a function'
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v12.22.9
Ghost-CLI Version: 1.24.0
Environment: production
Command: 'ghost install'
Additional log info available in: /home/webmaster/.ghost/logs/ghost-cli-debug-2023-04-12T20_20_58_053Z.log
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
Now I get this error after reseting my vps and starting with a fresh os.
web@website:/var/www/home$ 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 v16.19.1
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v5.43.0
✔ Finishing install process
? Enter your blog URL: https://aidan-a.me
? Enter your MySQL hostname: localhost
? Enter your MySQL username: web-root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: home_prod
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ sudo chown -R ghost:ghost /var/www/home/content
✔ Setting up "ghost" system user
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes
+ sudo mv /tmp/aidan-a-me/aidan-a.me.conf /etc/nginx/sites-available/aidan-a.me.conf
+ sudo ln -sf /etc/nginx/sites-available/aidan-a.me.conf /etc/nginx/sites-enabled/aidan-a.me.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? Yes
? Enter your email (For SSL Certificate) legotrain2008@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 aidan-a.me --webroot /var/www/home/system/nginx-root --reloadcmd "nginx -s reload" --accountemail legotrain2008@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/aidan-a-me/aidan-a.me-ssl.conf /etc/nginx/sites-available/aidan-a.me-ssl.conf
+ sudo ln -sf /etc/nginx/sites-available/aidan-a.me-ssl.conf /etc/nginx/sites-enabled/aidan-a.me-ssl.conf
+ sudo nginx -s reload
✔ Setting up SSL
? Do you wish to set up Systemd? Yes
+ sudo mv /tmp/aidan-a-me/ghost_aidan-a-me.service /lib/systemd/system/ghost_aidan-a-me.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_aidan-a-me
? Do you want to start Ghost? Yes
+ sudo systemctl start ghost_aidan-a-me
+ sudo systemctl stop ghost_aidan-a-me
✖ Starting Ghost
One or more errors occurred.
1) GhostError
Message: Ghost was able to start, but errored during boot with: Access denied for user 'web-root'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_aidan-a-me -n 50
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v16.19.1
Ghost Version: 5.43.0
Ghost-CLI Version: 1.24.0
Environment: production
Command: 'ghost install'
Additional log info available in: /home/web/.ghost/logs/ghost-cli-debug-2023-04-13T14_11_19_982Z.log
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
web@website:/var/www/home$ cd
web@website:~$ journalctl -u ghost_aidan-a-me -n 50
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- No entries --
web@website:~$ cd /var/www/home
web@website:/var/www/home$ ghost doctor
Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org
✔ Checking system Node.js version - found v16.19.1
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_aidan-a-me
+ sudo systemctl reset-failed ghost_aidan-a-me
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.19.1
web@website:/var/www/home$
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- No entries --
web@website:/var/www/home$ ```
Your MySQL user doesn’t have permission to access the Ghost database.
The following may resolve the issue, but it would be helpful if you could share the instructions you used to set up Ghost, since there may be other issues.
sudo mysql -u root -p
GRANT ALL PRIVILEGES ON home_prod.* TO 'web-root'@'localhost';
FLUSH PRIVILEGES;
QUIT;
When installing ghost im using the documentation from the docs and followed step by step.
After running to command above I get this error that seems to be the same as before.
web@website:/var/www/home$ cd
web@website:~$ sudo mysql -u root -p
[sudo] password for web:
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.32-0ubuntu0.22.04.2 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> GRANT ALL PRIVILEGES ON home_prod.* TO 'web-root'@'localhost';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> QUIT;
Bye
web@website:~$ cd /var/www/home
web@website:/var/www/home$ ghost start
Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org
+ sudo systemctl is-active ghost_aidan-a-me
+ sudo systemctl reset-failed ghost_aidan-a-me
✔ Checking system Node.js version - found v16.19.1
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_aidan-a-me
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.19.1
+ sudo systemctl start ghost_aidan-a-me
+ sudo systemctl stop ghost_aidan-a-me
✖ Starting Ghost: aidan-a-me
A GhostError occurred.
Message: Ghost was able to start, but errored during boot with: Access denied for user 'web-root'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_aidan-a-me -n 50
Debug Information:
OS: Ubuntu, v22.04.2 LTS
Node Version: v16.19.1
Ghost Version: 5.43.0
Ghost-CLI Version: 1.24.0
Environment: production
Command: 'ghost start'
Additional log info available in: /home/web/.ghost/logs/ghost-cli-debug-2023-04-13T16_33_03_385Z.log
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
web@website:/var/www/home$
when installing ghost the docs told me to add a user to my vps(web) hence web@website. Later the docs told me to setup and asked me to fill-in a db name and user. the user is web-root.
If it makes more sense, I can uninstall ghost(using “ghost uninstall” and re install ghost(using ghost install) and send a complete log file of the setup.
The Ghost user has sudo privileges, so the issue is most likely related to your database setup.
It would seem that you haven’t set up the database user. This is what I’d do.
sudo mysql -u root -p
CREATE USER 'web-root'@'localhost' IDENTIFIED BY '<password>';
CREATE DATABASE home_prod;
GRANT ALL PRIVILEGES ON home_prod.* TO 'web-root'@'localhost';
FLUSH PRIVILEGES;
QUIT;
Substitute with the same password you used when setting up Ghost. Now try restarting Ghost: ghost start.