How to Install Neos CMS on Ubuntu 22.04

Neos CMS is a free, open-source, and innovative content management system that helps you to manage websites and blogs without any coding knowledge. It is simple, secure, and designed for ease of use which helps business owners to collaborate with users across multiple devices. It offers very useful features, including full Unicode support, complete internationalization, SEO, inline editing, and more. The core idea behind the project is to allow editors to edit content as seamlessly as possible while still retaining its structure.

In this tutorial, we will show you how to install Neos CMS with Apache and Let's Encrypt SSL on Ubuntu 22.04 server.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name is pointed with your server IP.
  • A root password is configured on the server.

Getting Started

First, run the following commands to update all your system packages to the updated versions:

apt update -y
apt upgrade -y

Once you are finished, you can proceed to the next step.

Install Apache, MariaDB, and PHP

Next, you will need to install Apache, MariaDB, PHP, and other required packages to your system. Run the following command to install all of them:

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-mysql php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-bcmath php-xml php-cli php-gmagick php-zip curl unzip git -y

After installing all the packages, edit the php.ini file and make some changes:

nano /etc/php/8.1/apache2/php.ini

Change the following lines:

short_open_tag = On
memory_limit = 256M
upload_max_filesize = 150M
max_execution_time = 360
date.timezone = UTC

Save and close the file, then restart the Apache service to apply the changes:

systemctl restart apache2

Create a Database for Neos CMS

First, you will need to set a MariaDB root password and secure the installation. You can do it using the following command:

mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none):
Set root password? [Y/n]: N
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

Once you are done, log in to the MariaDB with the following command:

mysql -u root -p

Once you are logged in, create a database and user for Neos CMS using the following command:

MariaDB [(none)]> CREATE DATABASE neosdb;
MariaDB [(none)]> CREATE USER 'neos'@'localhost' IDENTIFIED BY 'mypassword';

Next, grant all the privileges to the Neos database with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON neosdb.* TO 'neos'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

Next, change the database charset to utf8mb4, flush the privileges, and exit from the MariaDB with the following command:

MariaDB [(none)]> ALTER DATABASE neosdb charset=utf8mb4;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Next, edit the MariaDB configuration file and make some changes:

nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add the following lines:

innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_file_per_table = 1
innodb_default_row_format = dynamic

Save and close the file then restart the MariaDB service to apply the changes:

systemctl restart mariadb

Once you are finished, you can proceed to the next step.

Install Neos CMS

Before starting, you will need to install the Composer to your system. Composer is a dependency manager used for installing PHP dependencies.

Run the following command to install Composer:

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

You should get the following output:

All settings correct for using Composer
Downloading...

Composer (version 2.4.1) successfully installed to: /root/composer.phar
Use it: php composer.phar

Next, move the Composer file to the system location:

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

Next, change the directory to the Apache web root and download the Neos CMS with the following command:

cd /var/www/html/
git clone https://github.com/neos/neos-base-distribution.git

Next, rename the downloaded directory, and run the composer command to install all PHP dependencies:

mv neos-base-distribution neoscms
cd neoscms
composer install

Next, set proper permission and ownership to the Neos directory:

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

Once you are finished, you can proceed to the next step.

Configure Apache for Neos CMS

Next, you will need to create an Apache virtual host configuration file to host Neos CMS. You can create it with the following command:

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

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/neoscms/Web
     ServerName neos.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>

Save and close the file, then activate the virtual host and enable the Apache rewrite module with the following command:

a2ensite neoscms.conf
a2enmod rewrite

Next, restart the Apache service to apply the changes:

systemctl restart apache2

You can also check the status of the Apache service with the following command:

systemctl status apache2

You should get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-09-04 08:07:38 UTC; 8s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22571 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22577 (apache2)
      Tasks: 6 (limit: 4579)
     Memory: 14.7M
        CPU: 128ms
     CGroup: /system.slice/apache2.service
             ??22577 /usr/sbin/apache2 -k start
             ??22578 /usr/sbin/apache2 -k start
             ??22579 /usr/sbin/apache2 -k start
             ??22580 /usr/sbin/apache2 -k start
             ??22581 /usr/sbin/apache2 -k start
             ??22582 /usr/sbin/apache2 -k start

Sep 04 08:07:38 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

At this point, the Apache web server is configured to serve Neos CMS. You can now proceed to the next step.

Access Neos CMS

Now, open your web browser and access the Neos CMS using the URL http://neos.example.com. You will be redirected to the following page:

Neos CMS

Click on the Go to setup. You should see the following page:

Login

Provide the setup password from the SetupPassword.txt file and click on the Login button. You should see the following page:

System requirements

Make sure all required PHP extensions are installed, then click on the Next button. You should see the following page:

Database settings

Provide your database name, database username, database host, password, and click on the Next button. You should see the following page:

Admin account

Provide your name, admin username, password, and click on the Next button. You should see the following page:

Create new site

Neos setup complete

Click on the Go to the backend. You should see the Neos CMS login page:

Neos admin login

Provide your admin username, password and click on the Login button. You should see the Neos CMS dashboard on the following page:

Neos dashboard

Secure Neos CMS with Let's Encrypt

It is a good idea to secure your website with Let's Encrypt Free SSL. First, install the Certbot client to install and manage the SSL. You can install it with the following command:

apt-get install python3-certbot-apache -y

Once installed, run the following command to secure your website with Let's Encrypt SSL:

certbot --apache -d neos.example.com

You will be asked to provide your email and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for neos.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/neos-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/neos-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/neos-le-ssl.conf

Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to install the Let's Encrypt SSL for your website:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/neos.conf to ssl vhost in /etc/apache2/sites-available/neos-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://neos.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=neos.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/neos.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/neos.example.com/privkey.pem
   Your cert will expire on 2022-12-07. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Conclusion

Congratulations! you have successfully installed Neos CMS with Apache and Let's Encrypt SSL on Ubuntu 22.04 server. You can now easily create and edit your website through the web browser. Feel free to ask me if you have any questions.

Share this page:

Suggested articles

0 Comment(s)

Add comment