How To Install Neos CMS on Ubuntu 20.04 LTS

Install Neos CMS on Ubuntu 20.04

In this tutorial, we will show you how to install Neos CMS on Ubuntu 20.04 LTS. For those of you who didn’t know, Neos is a modern free and open-source content management system that can be used to build and manage websites easily. It is based on its own PHP framework that allows you to build a perfectly customized experience. 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.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Neos open source content application platform on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Install Neos CMS on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing the LAMP stack.

A Ubuntu 20.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

Step 3. Configuring MariaDB for Neos CMS.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

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

Next, we will need to log in to the MariaDB console and create a database for the Neos. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Neos installation:

MariaDB [(none)]> CREATE DATABASE neosdb;
MariaDB [(none)]> CREATE USER 'neos'@'localhost' IDENTIFIED BY 'your-strong-passwd';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neosdb.* TO 'neos'@'localhost' IDENTIFIED BY 'your-strong-passwd' WITH GRANT OPTION;
MariaDB [(none)]> ALTER DATABASE neosdb charset=utf8;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 4. Installing Bolt Neos on Ubuntu 20.04.

Before installing Neos, you will need to install Composer to your system. You can install it by running the following command below:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

After that, change the directory to Apache webroot and install Neos CMS using the following command:

cd /var/www/html/
composer create-project --no-dev neos/neos-base-distribution neoscms

We will need to change some folders permissions:

chown -R www-data:www-data /var/www/html/neoscms/
chmod -R 755 /var/www/html/neoscms/

Step 5. Configure Apache.

Now we create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘neos.conf’ on your virtual server:

nano /etc/apache2/sites-available/neoscms.conf

Add the following lines:

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/neoscms/Web
     ServerName example.com
     <Directory /var/www/html/neoscms/Web/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/neos_error.log
     CustomLog ${APACHE_LOG_DIR}/neos_access.log combined
    
     <Directory /var/www/html/neoscms/Web/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]
    </Directory>
</VirtualHost>

Now, we can restart the Apache webserver so that the changes take place:

sudo a2enmod rewrite
sudo a2ensite neos.conf 
sudo systemctl restart apache2.service

Step 6. Set up HTTPS.

We should enable a secure HTTPS connection on Bold. We can obtain a free TLS certificate from Let’s Encrypt. Install Let’s Encrypt client (certbot) from Ubuntu 20.04 repository:

sudo apt install certbot python3-certbot-apache

Next, run the following command to obtain a free TLS certificate using the Apache plugin:

sudo certbot --apache --agree-tos --redirect --staple-ocsp --email you@example.com -d example.com

If the test is successful, reload Apache for the change to take effect:

sudo apache2ctl -t
sudo systemctl reload apache2

Step 7. Configure Firewall.

In case, you enabled firewall and firewall block requests of the apache web server, open a port in the firewall:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

Step 8. Accessing Neos CMS  Web Interface.

Once successfully installed, now open your web browser and type the URL https://your-domain.com. You will be redirected to the following page:

Install Neos CMS on Ubuntu 20.04

Next, enter the setup password from /var/www/html/neoscms/Data/SetupPassword.txt the file and click on the Login button.

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

Congratulations! You have successfully installed Neos. Thanks for using this tutorial for installing the Neos Content Management System (CMS) on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Neos website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!