How to Install TYPO3 CMS on CentOS 7

TYPO3 is a corporate content management system. It is free and open source. TYPO3 is written in PHP and uses MySQL to store its data.

System update

It is recommended that you upgrade your system before installing any packages that are used on CentOS. Run the following commands to do this:

sudo yum -y install epel-release
sudo yum -y update
sudo shutdown -r no

After rebooting, log in again as the root user and proceed further

Install Apache Web Server

To install Apache, enter the following command:

sudo yum -y install httpd

Launch Apache and enable it to start automatically at boot time

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Install PHP 7.1

To ensure stability, TYPO requires a PHP version greater than 7. First you need to enable the Remi repository

sudo rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --enable remi-php71

Install the latest version of PHP along with the modules that are required for TYPO3

sudo yum -y install php php-gd php-json php-mysqli php-curl php-cli php-apcu php-soap php-xml php-zip php-mbstring freetype php-bcmath php-fileinfo ImageMagick

Using any text editor, configure php.ini

sudo nano /etc/php.ini

Next, find the following lines and change them as shown below:

max_execution_time = 30  // change it to 240
max_input_vars = 1000  // Uncomment and change the value to 1500

Install MariaDB

MariaDB can be installed by following the following command:

sudo yum -y install mariadb mariadb-server

To start and enable MariaDB, you must automatically enter the following:

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Before starting the database setup, you must protect MariaDB. This can be done by running the following script:

sudo mysql_secure_installation

Next, you will be asked to enter the current root password for MariaDB. Press the ENTER key, and set a strong password for the root user of your MariaDB server. Then press “Y” for all other questions that appear next.

Create Database for TYPO3

First you need to go into the MySQL shell as the root user as follows:

mysql -u root -p

Provide a password for the MariaDB root user and then run the following prompts to create a database for installing TYPO3

CREATE DATABASE typo3_data CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'typo3_user'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON typo3_data.* TO 'typo3_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install TYPO3

Switch to the Apache root web directory with the following command:

cd /var/www 

Download the TYPO3 archive

sudo wget https://get.typo3.org/8.7.3 -O typo3.tar.gz

Unpack the archive:

sudo tar xzf typo3.tar.gz

Rename the extracted directory for convenience:

sudo mv typo3*/ typo3/

Rename the .htaccess file by running the following command:

sudo mv typo3/_.htaccess typo3/.htaccess

Create an empty file with the file name FIRST_INSTALL. The web installer checks this file before starting the installation.

sudo touch /var/www/typo3/FIRST_INSTALL

Then indicate the appropriate ownership, while running:

sudo chown -R apache:apache /var/www/typo3

Allow HTTP traffic through port 80 on the firewall

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Create a virtual host

Run the following command to create a virtual host for your TYPO3 site

sudo nano /etc/httpd/conf.d/cms.example.com.conf

Fill out the file:

<VirtualHost *:80>
    ServerName cms.example.com
    DocumentRoot /var/www/typo3
    <Directory /var/www/typo3>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Restart Apache

sudo systemctl restart httpd

Complete installation

Completing the installation involves opening a web browser and navigating to the URL http://cms.example.com

Was this article helpful?

Related Articles

1 Comment