Install Neos CMS on CentOS 7 with LAMP Stack
Neos is a cutting-edge, open-source CMS that excels at managing and editing digital content. It’s built with content authors and editors in mind, offering an intuitive user interface, a structured content system, support for multilingual websites, advanced publishing workflows, and many other powerful tools to streamline the content creation process.
Prerequisites
- A freshly launched CentOS 7 x64 server. Assume the IP is
203.0.113.1
and the hostname isneos
. - The domain
example.com
is already configured to point to the above server. - A sudo-enabled user account is required.
- The system has been updated to the latest stable release using the EPEL repository.
- For production use, it is advisable to create a swap file to enhance performance.
Step 1: Set Up a Modern LAMP Stack
To successfully run a Neos 3.2.0 site, an up-to-date LAMP stack must be in place. A suitable LAMP environment typically includes:
- CentOS 7 x64, fully updated
- Apache version 2.4
- MariaDB 10.2 with
utf8_unicode_ci
as the default collation - PHP 7.1, or a minimum of PHP 7.0
Install and Configure Apache 2.4
sudo yum install httpd -y
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
Install MariaDB 10.2
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
Secure the MariaDB Installation
sudo /usr/bin/mysql_secure_installation
When prompted during the secure installation process:
- Press Enter for the root password prompt
- Type Y to set a new root password
- Enter and confirm your new root password
- Type Y to remove anonymous users
- Type Y to disallow remote root login
- Type Y to remove the test database
- Type Y to reload privilege tables
Configure Default MariaDB Collation
cat <> /tmp/collation.conf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server=utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
EOF
sudo cp /etc/my.cnf /etc/my.cnf.bak
sudo sed -i '/\[client-server\]/r /tmp/collation.conf' /etc/my.cnf
sudo systemctl restart mariadb.service
Create a Database for Neos
mysql -u root -p
Within the MariaDB prompt, execute the following commands. Replace placeholder values like neos
, neosuser
, and yourpassword
with your custom credentials.
CREATE DATABASE neos;
CREATE USER 'neosuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON neos.* TO 'neosuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Install PHP 7.1 and Required Extensions
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y php71w php71w-mysqlnd php71w-common php71w-cli php71w-xml php71w-mbstring php71w-pecl-imagick php71w-mcrypt php71w-opcache php71w-imap php71w-process php71w-intl
sudo cp /etc/php.ini /etc/php.ini.bak
sudo sed -i 's#;date.timezone =#date.timezone = America/Los_Angeles#' /etc/php.ini
sudo sed -i "s/memory_limit = 128M/memory_limit = 250M/" /etc/php.ini
sudo sed -i '$a\xdebug.max_nesting_level = 500' /etc/php.ini
Step 2: Install Composer on CentOS 7
Neos requires Composer, the PHP package manager, to handle its dependencies. Use the following commands to install Composer version 1.5.2 on your system.
Note: To install the latest stable version of Composer in the future, refer to the official Composer website.
cd
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
Step 3: Use Composer to Install Neos CMS
Composer simplifies the installation of Neos and its associated components. Execute the following commands to download Neos into a new directory.
cd
mkdir neos
cd neos
composer create-project --no-dev neos/neos-base-distribution .
For easier management, move the Neos directory to /opt
and set proper permissions. Then, create a symbolic link from the Apache root directory to the Neos folder to serve content.
sudo mv ~/neos /opt
sudo chown -R apache:apache /opt/neos
sudo ln -s /opt/neos /var/www/html/neos
Configure Apache for Neos
Set up a new Apache virtual host file for your Neos CMS. This configuration sets /var/www/html/neos/Web
as the root directory. Be sure to update all placeholder values with your actual domain and email.
cat <
Finally, restart Apache to activate all the applied configurations.
sudo systemctl restart httpd.service
Step 4: Update Firewall Settings to Allow Web Access
To ensure that users can access your Neos CMS, update your system firewall rules with the following commands:
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload
Step 5: Complete Neos Installation via Web Wizard
To proceed with the installation, open a browser and navigate to http://example.com/setup
. This will launch the Neos graphical setup wizard.
On the initial login page, you will be asked to enter a setup password. This password is stored in the following file:
cat /var/www/html/neos/Data/SetupPassword.txt
Important: Once you successfully log in, this password file will be automatically deleted. Make sure to copy the password beforehand and store it somewhere safe.
Verify Required PHP Extensions
On the Image Manipulation screen of the requirements check, verify that either the imagick
or gmagick
PHP extension is installed and selected. Click the Next > button to continue.
Enter Database Information
When prompted to configure the database, provide the following details:
- DB Driver: MySQL/MariaDB via PDO
- DB Username: neosuser
- DB Password: yourpassword
- DB Host: 127.0.0.1
- DB Name: neos
Ensure the neos
database uses the utf8
character encoding, then click the Next > button.
Create an Administrator Account
On the admin creation screen, provide the following details:
- First name
- Last name
- Username
- Password (enter twice)
Click Next > to proceed to the final step.
Select a Site Package
To get started quickly, select the Neos.Demo
package and click Next > to complete the installation.
Note: Once you’re more familiar with Neos, you can revisit this setup wizard to generate a custom site package for your own project.
Access Your New Neos CMS
After installation, you can view and manage your website using the following URLs:
- Frontend: http://example.com
- Backend: http://example.com/neos
- Setup: http://example.com/setup
Step 6: Finalize Neos Setup for Production
When running your Neos site in a production setting, it’s crucial to switch the Flow application context from its default “Development” mode to “Production.” To do this, add the line SetEnv FLOW_CONTEXT Production
to your Apache virtual host configuration as shown below:
cat <
To apply the changes, restart Apache with this command:
sudo systemctl restart httpd.service
If you’ve deployed a site using the Neos.Demo
package, remove the “Create account” button from the Try Me page to block unauthorized access.
Step 7 (Optional): Secure Your Site with Let’s Encrypt HTTPS
To secure your Neos installation, you can enable HTTPS using a free SSL certificate from Let’s Encrypt.
Assign a Fully Qualified Domain Name (FQDN)
Use vi
to update your system’s /etc/hosts
file by adding the following line at the top:
sudo vi /etc/hosts
Insert:
203.0.113.1 neos.example.com neos
Save and exit using :wq!
. Then verify the result using:
hostname -f
You should see: neos.example.com
.
Install and Use Certbot to Deploy HTTPS
Start by installing Certbot and its dependencies:
sudo yum install -y yum-utils
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
sudo yum install -y certbot-apache
Backup your existing Apache configuration:
sudo cp /etc/httpd/conf.d/neos.conf /etc/httpd/conf.d/neos.conf.bak
Now run Certbot to acquire and apply your Let’s Encrypt certificate:
sudo certbot --apache
During setup, you’ll answer the following prompts:
- Enter your email:
admin@example.com
- Agree to the terms:
A
- Share your email (optional):
Y
- Choose domains for HTTPS:
1,2
- Enable redirect to HTTPS:
2
All HTTP traffic will now be redirected to HTTPS for security.
Automate SSL Renewal
To automatically renew your Let’s Encrypt certificate, set up a cron job:
sudo crontab -e
Press I
to enter insert mode and add:
0 1,13 * * * /usr/bin/certbot renew
Save and exit using :wq!
.
Conclusion
By following this comprehensive guide, you’ve successfully installed and configured Neos CMS on a CentOS 7 server using a LAMP stack. You’ve also secured the platform with HTTPS, adjusted system settings for production use, and completed the setup using Neos’ intuitive web-based installer.
Neos offers a powerful and flexible environment for managing modern websites. With features like multilingual content support, user-friendly editing tools, and robust extensibility, you’re now equipped to create dynamic and professional-grade digital experiences. Whether you begin with the demo package or build your own custom site, Neos provides the scalability and tools to grow alongside your project needs.
Remember to regularly update your software components, monitor server performance, and ensure your SSL certificate remains current to maintain a secure and efficient site environment.