Ghost install Error due to content folder has correct permissions

Problem Description:

When executing ghost install --no-stack, an error appears when starting Ghost:

Message: The content folder is not owned by the current user.
Ensure the content folder has correct permissions and try again.

The specific situation is as follows:

[kevin@cube_hk_1 ghost]$ ghost install --no-stack

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Running in development mode
┌────────────────────────────────────────────────── ────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│ Make sure your database is up to date to ensure forwards compatibility. │
└────────────────────────────────────────────────── ──────────────────────────────────────┘

You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.


✔ Checking system Node.js version - found v16.17.1
✔ Checking logged in user
✔ Checking current folder permissions
ℹ Checking system compatibility [skipped]
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v5.19.0
✔ Finishing install process
? Enter your blog URL: https://ifree.love
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_dev
✔ Configuring Ghost
✔ Setting up instance
+ sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
✔ Setting up "ghost" mysql user
Nginx configuration already found for this url. Skipping Nginx setup.
ℹ Setting up Nginx [skipped]
Nginx setup task was skipped, skipping SSL setup
ℹ Setting up SSL [skipped]
? Do you want to start Ghost? Yes
✖ Starting Ghost
One or more errors occurred.

1) SystemError

Message: The content folder is not owned by the current user.
Ensure the content folder has correct permissions and try again.

Debug Information:
    OS: CentOS Stream, v8
    Node Version: v16.17.1
    Ghost Version: 5.19.0
    Ghost-CLI Version: 1.23.0
    Environment: development
    Command: 'ghost install --no-stack'

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.

ghost doctor executes as follows:

[kevin@cube_hk_1 ghost]$ ghost doctor

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Running in development mode
┌────────────────────────────────────────────────── ────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│ Make sure your database is up to date to ensure forwards compatibility. │
└────────────────────────────────────────────────── ──────────────────────────────────────┘

✔ Checking system Node.js version - found v16.17.1
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking for a MySQL installation
✔ Validating config
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
other instructions:

Ghost directory permissions:

[kevin@cube_hk_1 ghost]$ ll -al
Total usage 24
drwxrwxr-x. 4 kevin kevin 4096 Oct 16 19:41 .
drwxr-xr-x.4 root root 4096 Sep 25 04:26 ..
-rw-rw-r--. 1 kevin kevin 493 Oct 16 19:41 config.development.json
drwxrwxr-x. 11 ghost ghost 4096 Oct 16 19:37 content
lrwxrwxrwx. 1 kevin kevin 30 Oct 16 19:38 current -> /var/www/ghost/versions/5.19.0
-rw-rw-r--. 1 kevin kevin 109 Oct 16 19:41 .ghost-cli
drwxrwxr-x. 3 kevin kevin 4096 Oct 16 19:37 versions

User permissions:

[kevin@cube_hk_1 ghost]$ groups kevin
kevin : kevin
[kevin@cube_hk_1 ghost]$ groups ghost
ghost : ghost

Granted sudo and directory permissions to kevin:

[kevin@cube_hk_1 ghost]$ sudo chown kevin:kevin /var/www/ghost
[kevin@cube_hk_1 ghost]$ sudo chmod 775 /var/www/ghost

I read this message " This install is not suitable for production use or contributing to core." from How to install Ghost locally on Mac, PC or Linux.

I install by ghost install --no-stack it occure a error “Message: The content folder is not owned by the current user.
Ensure the content folder has correct permissions and try again.”

I can install local in my Centos server, but how to view it from outside?

Environmental description:
OS: CentOS Stream, v8.
Ghost Version: 5.19.0
Ghost-CLI Version: 1.23.0

Can you try doing a fresh install and see if you get the same error? For production use, as you linked, you should use the Ubuntu guide for installation, with the caveat that you’ll need to adapt it to work with CentOS.

Are you using the --no-stack flag because you receive errors on CentOS Stream otherwise?

Thanks! I changed to install with Ubuntu system, but got the following result:

kevin@cube-hk-1:/var/www/ifree.love$ 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.17.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 v5.19.1
✔ Finishing install process
? Enter your blog URL: https://ifree.love
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ifree_love_prod
✔ Configuring Ghost
✔ Setting up instance
+ sudo chown -R ghost:ghost /var/www/ifree.love/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
✖ Setting up "ghost" mysql user
? Do you wish to set up Nginx? Yes
+ sudo mv /tmp/ifree-love/ifree.love.conf /etc/nginx/sites-available/ifree.love.conf
+ sudo ln -sf /etc/nginx/sites-available/ifree.love.conf /etc/nginx/sites-enabled/ifree.love.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? Yes
? Enter your email (For SSL Certificate) 1215894562@qq.com
+ sudo /etc/letsencrypt/acme.sh --upgrade --home /etc/letsencrypt
+ sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --server letsencrypt --domain ifree.love --webroot /var/www/ifree.love/system/nginx-root --reloadcmd "nginx -s reload" --accountemail 1215894562@qq.com
+ sudo mv /tmp/ifree-love/ifree.love-ssl.conf /etc/nginx/sites-available/ifree.love-ssl.conf
+ sudo ln -sf /etc/nginx/sites-available/ifree.love-ssl.conf /etc/nginx/sites-enabled/ifree.love-ssl.conf
+ sudo nginx -s reload
✔ Setting up SSL
? Do you wish to set up Systemd? Yes
+ sudo mv /tmp/ifree-love/ghost_ifree-love.service /lib/systemd/system/ghost_ifree-love.service
+ sudo systemctl daemon-reload
✔ Setting up Systemd
+ sudo systemctl is-active ghost_ifree-love
? Do you want to start Ghost? Yes
+ sudo systemctl start ghost_ifree-love
+ sudo systemctl stop ghost_ifree-love
✖ Starting Ghost
One or more errors occurred.

1) ConfigError

Error detected in the production configuration.

Message: connect ECONNREFUSED 127.0.0.1:3306
Configuration Key(s): database.connection.host / database.connection.port
Current Value(s): localhost / 3306

Help: Ensure that MySQL is installed and reachable. You can always re-run `ghost setup` to try again.


2) GhostError

Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED 127.0.0.1:3306
Help: Unknown database error
Suggestion: journalctl -u ghost_ifree-love -n 50

Debug Information:
    OS: Ubuntu, v20.04.5 LTS
    Node Version: v16.17.1
    Ghost Version: 5.19.1
    Ghost-CLI Version: 1.23.1
    Environment: production
    Command: 'ghost install'

Additional log info available in: /home/kevin/.ghost/logs/ghost-cli-debug-2022-10-17T15_27_31_408Z.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.

I have solved this problem, thanks!

2 Likes

how you solved the problem, can you describe here?