CMS

Easy to Install Neos CMS on Ubuntu 20.04

In this article, we’ll explain how to install Neos CMS on Ubuntu 20.04.

Neos CMS is free and open source software licensed under GPL v3 or later. Neos CMS has many valuable features that appeal to both content editors and developers, such as inline editing, full Unicode support, complete internationalization, and built-in SEO.

Prerequisites

  • An Ubuntu 20.04 installed dedicated server or KVM VPS.
  • A root user access or normal user with administrative privileges.
  • Add "A" record of you domain like example.com that point to the server.

Install Neos CMS on Ubuntu 20.04

1. Keep the server up to date

# apt update -y && apt upgrade -y

2. Install PHP

Install PHP-FPM and other required PHP extensions.

# apt install php-fpm php-mbstring php-tokenizer php-xml php-mysql php-imagick php-zip -y

3. Install MySQL

Install MySQL server using following command.

# apt install mysql-server -y

Let’s secured the installation using the following command:

# mysql_secure_installation

Once the script gets executed, it will ask multiple questions.

It will ask you to enter the current password for root (enter for none):

Then enter yes/y to the following security questions:

Set a root password? [Y/n]: y
Remove anonymous users? : y
Disallow root login remotely? : y
Remove test database and access to it? : y
Reload privilege tables now? : y

Login in to mysql

# mysql -u root -p

Run the following queries to create a MySQL database and database user for Neos CMS.

mysql> CREATE DATABASE neos;

mysql> CREATE USER 'neos’@’localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON neos.* TO 'neos’@’localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit

4. Install Nginx

Install Nginx web server using following command.

# apt install nginx -y

Disable the default configuration.

# rm /etc/nginx/sites-enabled/default

Create a new configuration for Neos CMS.

# nano /etc/nginx/sites-available/neos.conf

Paste the following contents:

server {
listen 80 default_server;
listen [::]:80 default_server;

server_name example.com;

root /var/www/neos/Web;
index index.php;

location ~ /_Resources/ {
access_log off;
log_not_found off;
expires max;

if (!-f $request_filename) {
rewrite "/_Resources/Persistent/([a-z0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
rewrite "/_Resources/Persistent(?>/[a-z0-9]{5}){8}/([a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
}
}

location / {
try_files $uri $uri/ /index.php?$args;
}

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param FLOW_REWRITEURLS 1;
fastcgi_param FLOW_CONTEXT Production;
fastcgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
fastcgi_param X-Forwarded-Port $proxy_port;
fastcgi_param SERVER_NAME $http_host;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}

Save the configuration file and exit. Then enable the new configuration.

# ln -s /etc/nginx/sites-available/neos.conf /etc/nginx/sites-enabled/neos.conf

Check the new configuration.

# nginx -t

Reload Nginx for the changes to take effect.

# systemctl reload nginx.service

5. Install Neos CMS

Install Composer, the PHP dependency manager.

# curl -sS https://getcomposer.org/installer | php

Make the composer command globally available.

# mv composer.phar /usr/local/bin/composer

Create a folder to store the Neos CMS source code.

# mkdir -p /var/www/neos

Set neos as the owner of the source code folder.

# chown www-data:www-data /var/www/neos

Fetch the Neos CMS source code using Composer. Be patient because this process may take a while.

# cd /var/www/neos && composer create-project --no-dev neos/neos-base-distribution .

If you see the Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? message, press ENTER.

Generate all required libraries such as jQuery, Bootstrap, CKEditor.

# ./flow resource:publish

Output similar like:

Publishing resources of collection "static"
Publishing resources of collection "persistent"

6. Secure Domain with HTTPS

Install certbot’s nginx package

# apt install certbot python3-certbot-nginx -y

Obtain a certificate using certbot command. The Nginx plugin will take care of reconfiguring Nginx and reloading the config.

# certbot --nginx -d example.com -d www.example.com

Follow the wizard and deploy the SSL. It will add HTTPS redirection code in neos.conf configuration file.

7. Configure Neos CMS

Open the http://example.com/setup link in your browser. Wait a while for Neos CMS to initialize the setup tool. Then you will see the login screen.

Install Neos CMS

To get the setup password, run following command to display the password.

# cat /var/www/neos/Data/SetupPassword.txt

It will display the password. Once you get the password, login in the Neos CMS to follow the setup wizard.

In the Configure database screen:

  • Select the MySQL/MariaDB via PDO option for DB Driver.
  • Enter neos for DB Username.
  • Enter the database password you created in step 2 for DB Password
  • Enter 127.0.0.1 for DB Host.
  • Select the neos option for DB Name.

Follow the rest setup process and add the one admin user to login and build the website.

Once you complete with the setup wizard, login into the dashboard using this link: http://example.com/neos. You can use server IP to visit the dashboard.

That’s it. The installation processor has been completed successfully.

In this article, we have seen how to install Neos CMS on Ubuntu 20.04.

Related Articles