Tutorial-9122023

How to Install NEOS CMS on Ubuntu 24.04 Server

How to Install NEOS CMS on Ubuntu 24.04 Server

Neos is a free and open-source content management system with intuitive editing, complete internationalization, maximum flexibility, and ease of integration with 3rd party systems.

Neos is an enterprise content management built-in with custom content modeling that provides an effective way to edit and manage content, SEO optimization such as automatic redirects and SEO metadata, and powerful roles and user management.

In this guide, we will walk you through the installation of Neos CMS on the Ubuntu 24.04 server. You will install Neos CMS with the LAMP Stack, Composer, and ImageMagick. You will be utilizing the flow Utility for installing and managing Neos CMS.

Prerequisites

To start with this guide, make sure you have:

  • An Ubuntu 24.04 server.
  • A non-root user with administrator privileges.
  • A domain name pointed to your server IP address.

Installing Dependencies

Before installing Neos CMS, you need to install dependencies such as LAMP Stack (Linux, Apache, MySQL/MariaDB, and PHP), Composer, Git, and ImageMagick. Those packages are available by default on the Ubuntu repository, and you can install them through APT.

First, update your Ubuntu package index with the following command:

sudo apt update

Now install dependencies for Neos CMS with the command below. In the following, you will be installing LAMP Stack (Linux, Apache, MySQL/MariaDB, and PHP), Composer, Git, and ImageMagick packages.

sudo apt install apache2 mariadb-server composer git php php-cli php-common php-imap php-redis php-snmp php-xml php-zip php-imagick php-mbstring php-curl libapache2-mod-php php-mysql imagemagick

Input Y to confirm the installation.

After the installation, check the status of Apache and MariaDB services to ensure it is running.

Check the Apache web server with the following. You will see that the service is enabled and active(running).

sudo systemctl is-enabled apache2
sudo systemctl status apache2

Now check the MariaDB service status with the following – You will see a similar output. The MariaDB is enabled and active(running).

sudo systemctl is-enabled mariadb
sudo systemctl status mariadb

Lastly, check the PHP and Composer versions using the command below. PP 8.3 and Composer 2.7 are installed on your Ubuntu system.

php -v
sudo -u www-data composer -v

Configuring PHP

After installing dependencies, you will set up PHP installation by editing the php.ini file and then restart the Apache web server.

Open the PHP config file /etc/php/8.3/apache2/php.ini with the following nano editor command.

sudo nano /etc/php/8.3/apache2/php.ini

Change the default configuration with the following. Make sure to adjust both date.timezone and memory_limit with your server settings.date.timezone = Europe/Amsterdam
upload_max_filesize = 80M
memory_limit = 512M
max_execution_time = 360

When finished, save the file and exit the editor.

Now run the command below to restart the Apache web server and apply your PHP configuration.

sudo systemctl restart apache2

Configuring MariaDB server

In this section, you will be securing your MariaDB server installation and creating a new database and user for Neos CMS. You will utilize the mariadb-secure-installation to secure MariaDB, then you will access the MariaDB server through the mariadb client.

To secure MariaDB server installation, run the mariadb-secure-installation command below.

sudo mariadb-secure-installation

Now you will be prompted with MariaDB server configurations:

  • For the default MariaDB server installation without a root password, press ENTER when asked about the password.
  • The local authentication for MariaDB root users is secured by default, input ‘n’ when asked to change the authentication method to ‘unix_socket’.
  • Input ‘Y’ to create a new MariaDB root password. Then, input the strong password for your MariaDB root user and repeat.
  • When asked to disable remote authentication for the MariaDB root user, input ‘Y’ to agree.
  • The default MariaDB server installation comes with the database ‘test’ and allows an anonymous user to access it.
  • Input ‘Y’ for both settings to remove the default database ‘test’ and remove the anonymous privilege.
  • Lastly, input ‘Y’ to confirm reloading table privileges.

After you have secured MariaDB, you will create a new database and user through the mariadb client utility.

Run the command below to log in to the MariaDB server. Enter your MariaDB root password when asked.

sudo mariadb -u root -p

Now run the following queries to create a new database and user for Neos CMS. In this example, you will create a new database neosdb, a user neos with the password neospassword. You can adjust that information with yours.

CREATE DATABASE neosdb;
CREATE USER neos@localhost IDENTIFIED BY ‘neospassword’;
GRANT ALL PRIVILEGES ON neosdb.* TO neos@localhost IDENTIFIED BY ‘neospassword’;
FLUSH PRIVILEGES;

Next, run the query below to check privileges for the user neos. Make sure that the user neos can access the database neosdb.

SHOW GRANTS FOR neos@localhost;

Lastly, type quit to exit from the MariaDB server.

Downloading Neos CMS Source Code

Now that you have configured both PHP and MariaDB, you will be downloading Neos CMS source code and installing PHP dependencies with the Composer. You will also set up the Neos CMS installation with proper permission and ownership.

First, run the git command below to download the Neos CMS source code to the /var/www/neos directory.

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

Move to the /var/www/neos directory and install Neos CMS dependencies with the composer command below.

cd /var/www/neos
composer install

As for now, enter yes to confirm and run Composer as root.

After the process is complete, run the command below to change the permission of Neos CMS source code to the www-data user.

sudo ./flow core:setfilepermissions www-data www-data
sudo chown -R www-data:www-data /var/www/neos

Setting up Apache virtual host

In this section, you will be creating a new Apache virtual host for running Neos CMS. So make sure that you have your domain name pointed to server IP address. You can use the public domain or local domain for development.

Enable the rewrite and ssl modules for Apache with the command below.

sudo a2enmod rewrite ssl

Now create a new Apache virtual host file /etc/apache2/sites-available/neos.conf with the following nano editor.

sudo nano /etc/apache2/sites-available/neos.conf

Insert the configuration into the file and input your domain name to the ServerName option.<VirtualHost *:80>

ServerName hwdomain.io
ServerAdmin [email protected]

ErrorLog ${APACHE_LOG_DIR}/hwdomain.io.error.log
CustomLog ${APACHE_LOG_DIR}/hwdomain.io.access.log combined

#SetEnv FLOW_CONTEXT Production
DocumentRoot /var/www/neos/Web

# Add security
php_flag register_globals off

<Directory /var/www/neos/Web>
AllowOverride All
</Directory>

<Directory /var/www/neos/Web/>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L] </Directory>

</VirtualHost>

When finished, save and exit the file.

Next, run the command below to activate the virtual host file neos.conf and verify your Apache syntax. If you have correct and proper Apache syntax, you will get an output Syntax is OK.

sudo a2ensite neos.conf
sudo apachectl configtest

Lastly, run the following to restart the Apache web server and apply your changes. Once restarted, your Neos CMS should be ready.

sudo systemctl restart apache2

Securing Neos CMS with HTTPS

In this guide, you will run Neos CMS with HTTPS through Certbot and Letsencrypt. This is only possible if you’re installing Neos CMS on the public domain name. If you’re using a local domain, you can generate SSL certificates with OpenSSL and configure HTTPS manually.

Install the Certbot and Certbot Apache plugin with the following command. Type Y to confirm the installation.

sudo apt install certbot python3-certbot-apache2

Now run the certbot command below to generate SSL/TLS certificates for Neos CMS. Make sure to change the email address and domain name with your information.

sudo certbot –apache –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d hwdomain.io

After the process is finished, your SSL certificates will be available in the /etc/letsencrypt/live/domain.com directory. And your Neos CMS should be secured automatically with HTTPS.

Installing NEOS CMS from the command line

Now that you have downloaded the Neos CMS source code and configured the Apache virtual host, you will start the Neos CMS installation through the terminal. With the flow utility, you can manage and install Neos CMS from your terminal.

Go to the /var/www/neos directory with the following:

cd /var/www/neos

Run the command below to set up a database for Neos CMS. Select mysqli as the database driver and enter your details MariaDB database and user that you’ve created.

sudo ./flow setup:database

When successful, you will see an output such as Database neosdb was connected successfully.

Now run the command below to set up the default image handler for Neos CMS and select Imagick.

sudo ./flow setup:imagehandler

After configuring the database and image handler, run the command below to migrate the Neos CMS database.

sudo ./flow doctrine:migrate

You can see the following output during database migration.

Next, run the following to create an administrator user for your Neos CMS installation. Enter your username, email address, first name, last name, and your password.

sudo ./flow user:create –roles administrator

You will get an output like the following:

Now run the command below to import the Neos.Demo site to your installation. if successful, you will get an output Import of site "Neos Demo site" finished.

sudo flow:cache:flush
sudo ./flow site:import –package-key Neos.Demo

With this, the Neos CMS is complete. Visit your domain name such as https://hwdomain.io and you will get the Neos CMS home page like the following:

To access the Neos CMS login page, visit https://hwdomain.io/login and input your admin user and password that you’ve created. Click Login to confirm.

If you have proper admin credentials, you will see the Neos CMS dashboard like the following:

Conclusion

Congratulations! You have completed the Neos CMS installation on an Ubuntu 24.04 server. You have Neos CMS running with the LAMP Stack (Linux, Apache, MySQL/MariaDB, and PHP) and secured with HTTPS through Let’s Encrypt. You have also learned the basic command flow for installing and managing Neos CMS.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !