Install TYPO3 CMS Using Composer on Ubuntu

Posted on January 20th, 2020

Install TYPO3 CMS Using Composer on Ubuntu

TYPO3 is a free, open-source PHP based web content management system. This CMS can run on HTTP web servers, such as Apache or IIS, and in different operating systems, such as Microsoft Windows, Linux, FreeBSD, OS/2, and macOS. It is one of the most popular content management systems in the market. The main components of TYPO3 are its PHP, MySQL, and webserver. TYPO3 runs with all versions of PHP from 5.3 and above.


Install TYPO3 Using Composer

The use of Composer to install TYPO3 packages makes it easy to upgrade from the command-line. TYPO3 CMS has a built-in tool to upgrade the webmasters easily. But first, this tool needs to be configured for any new users. So, it is always easy to use the command-line for installing and updating the CMS. The following steps help you install or upgrade TYPO3 from Github using Composer on Ubuntu servers.


1) System Update

First, we need to update the Ubuntu server instance before updating any packages. The server should be up-to-date to install the necessary TYPO3 packages. To update the system, you need to log in to the server as a sudo user and run the following commands.

$ sudo apt-get update

$ sudo apt-get -y upgrade


2) Install Apache2 HTTP Server

Apache2 is one of the most popular web servers in use, and you can install Apache2 on your Ubuntu server using the following command.

$ sudo apt-get -y install apache2

You can use the following commands to stop, start, and enable Apache2 service. If you enable Apache2 service, then this service always starts up with the server boots.

$ sudo systemctl stop apache2.service

$ sudo systemctl start apache2.service

$ sudo systemctl enable apache2.service


3) Install MariaDB

MariaDB is an open-source database server, and you can install MariaDB using the following command.

$ sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, you can use the following commands to stop, start, and enable MariaDB service.

On Ubuntu 16.04 LTS

$ sudo systemctl stop mysql.service

$ sudo systemctl start mysql.service

$ sudo systemctl enable mysql.service

On Ubuntu 18.04 and above

$ sudo systemctl stop mariadb.service

$ sudo systemctl start mariadb.service

$ sudo systemctl enable mariadb.service

After enabling the MariaDB server on Ubuntu, you need to run the following command to secure the MariaDB server. You can create a root password and also disallow remote root access using this command.

$ sudo mysql_secure_installation

When prompted, you can answer the following questions to secure your MariaDB server.

Enter the current password for root (enter for none): <current password> or <Enter>

Set root password? [Y/n]: Y

New password: <Enter password>

Re-enter new password: <Repeat password>

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

After securing the server, you need to restart MariaDB using the following command.

$ sudo systemctl restart mariadb.service
$ sudo systemctl restart mysql.service

If you want to know is MariaDB installed in your system, then you can test it by running the following command. This command prompts for the password, and you can give the password you created during sign-on. If successful, you should see the welcome message.

$ sudo mysql -u root -p


4) Install PHP 7 and Related Modules

Install the latest version of PHP along with the related modules required by TYPO3 using the following command.

$ sudo apt-get -y install php php-json php-mysqli php-gd php-curl php-cli php-soap php-apcu php-xml php-zip php-mbstring libfreetype6 php-bcmath php-fileinfo imagemagick

After installation, you need to configure the ‘php.ini’ config file using any text editor of your choice, such as nano, vim, etc.

$ sudo nano /etc/php/<version>/apache2/php.ini

In the ‘php.ini’ configuration file, you need to make the following changes. After making the changes, save and close the file.

file_uploads = On

allow_url_fopen = On

short_open_tag = On

memory_limit = 256M

upload_max_filesize = 100M

max_execution_time = 360

max_input_vars = 1500

date.timezone = America/Chicago


5) Restart Apache2 Web Server

After installing the PHP and related modules, you need to restart the Apache2 webserver to reload the PHP configuration. To restart the Apache2 service, run the following command.

$ sudo systemctl restart apache2.service

To check the PHP settings with Apache2, you need to create a ‘phpinfo.php’ file in the Apache2 root directory. Create the file using the nano command.

$ sudo nano /var/www/html/phpinfo.php

After creating the ‘phpinfo.php’ file, you need to add the following contents in the file and save it.

<?php phpinfo(); ?>

After saving the file, browser to your server hostname or IP address followed by /phpinfo.php to see the default PHP test page.



6) Create a TYPO3 Database

Now, you have installed all the packages required for the smooth function of TYPO3 CMS. Next, you need to create a blank TYPO3 database and configure the servers by using the following process.

1) Log in to the MariaDB database server by using the following command.

$ sudo mysql -u root -p

2) Create a database with the name typo3.


3) After creating the database, the next step is to create the database user called typo3user and set a password for that user.

CREATE USER ‘typo3user’@‘localhost’ IDENTIFIED BY ‘new_password’;

4) Then, you need to grant full access to the database for the user by using the following command.

GRANT ALL ON typo3. * TO ‘typo3user’@‘localhost’ IDENTIFIED BY ‘user_password’ WITH GRANT OPTION;

5) Then you need to save your changes and exit.




7) Download the latest version of TYPO3

1) You can download the latest version of TYPO3 from the Github repository. You also need to install Composer, Curl, and other dependencies.

$ sudo apt install curl git

$ curl -sS | sudo php — –install-dir=/usr/local/bin –filename=composer

2) After installing curl and Composer, move to the Apache2 root directory and download TYPO3 packages from Github. Replace the release number with the latest version (10).

$ cd /var/www/html

$ sudo composer create-project typo3/cms-base-distribution typo3 ^10

Then create an empty file called FIRST_INSTALL and then set the correct permissions for TYPO3 to function correctly.

$ sudo touch /var/www/html/typo3/public/FIRST_INSTALL

$ sudo chown -R www-data:www-data /var/www/html/typo3/

$ sudo chmod -R 755 /var/www/html/typo3/


8) Configure Apache2 Web Server

1) The Apache 2 configuration file controls how users’ access TYPO3 contents. So, you need to configure this file for TYPO3 access. You can run the following command to create a new configuration file named ‘typo3.conf’.

$ sudo nano /etc/apache2/sites-available/typo3.conf

In the typo3.conf file, you need to add the following content and save the file.

<VirtualHost *:80>

ServerAdmin admin@<domain_name>

DocumentRoot /var/www/html/typo3/public

ServerName <domain_name>

ServerAlias <domain_alias>


<Directory /var/www/html/typo3/public/>

Options +FollowSymlinks

AllowOverride All

Require all granted



ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined




2) Next, you need to activate the configuration by running the following commands.

$ sudo a2ensite typo3.conf

$ sudo a2enmod rewrite

3) Restart the Apache2 service by using the following command.

$ sudo systemctl restart apache2.service

Now you have successfully installed TYPO3 CMS. If you want to upgrade to a newly released version in the future, then you can run the following commands.

$ cd /var/www/html

$ sudo composer install

$ sudo composer require typo3/cms: ^<new_release_version> –update-with-dependencies

$ sudo composer require typo3/minimal


If you need any further help, please do reach our support department.

2 Responses to “Install TYPO3 CMS Using Composer on Ubuntu”

  1. Doku says:

    curl -sS | php — –install-dir=/usr/local/bin –filename=composer
    instead of: curl -sS | sudo php — –install-dir=/usr/local/bin –filename=composer

Leave a Reply