How to Install TYPO3 CMS with Let's Encrypt SSL on Ubuntu 20.04

TYPO3 is a free and open-source content management system written in PHP. It is an enterprise-class CMS that combines open source code with reliability and true scalability. It runs on a web server and supports a lot of operating systems including, Windows, Linux, macOS, etc. It is a simple, responsive, mobile ready and secure CMS and can be easily customized and extended without writing any code. It is a very popular and great choice for getting your website up and running quickly.

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

Prerequisites

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

Getting Started

First, it is recommended to update your system packages with the latest version. You can update all packages by running the following command:

apt-get update -y

Once all the packages are up-to-date, you can proceed to the next step.

Install LAMP Server

Next, you will need to install Apache webserver, MariaDB, PHP and other PHP extensions in your server. You can install all of them with the following command:

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

After installing all packages, edit the php.ini file and change some recommended settings:

nano /etc/php/7.4/apache2/php.ini

Change the following lines:

memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360
max_input_vars = 1500
date.timezone = Asia/Kolkata

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

systemctl restart apache2

Create a Database for TYPO3

Next, you will need to create a database and user for TYPO3. First, log in to MariaDB shell with the following command:

mysql

Once login, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE typo3db;
MariaDB [(none)]> CREATE USER ''@'localhost' IDENTIFIED BY 'password';

Next, grant all the privileges to the typo3db with the following command:

MariaDB [(none)]> GRANT ALL ON typo3db.* TO 'typo3'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

Next, flush the privileges and exit from the MariaDB with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

At this point, your MariaDB database is configured.

Install TYPO3 CMS

First, you will need to download the latest version of TYPO3 from their official website. You can use curl command to download it:

curl -L -o typo3_src.tgz https://get.typo3.org/10.4.9

Once the download is completed, extract the downloaded file with the following command:

tar -xvzf typo3_src.tgz

Next, move the extracted directory to the Apache web root directory:

mv typo3_src-10.4.9 /var/www/html/typo3

Next, give proper permission and permission with the following command:

chown -R www-data:www-data /var/www/html/typo3
chmod -R 775 /var/www/html/typo3

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

Configure Apache for TYPO3

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

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

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/typo3
     ServerName typo3.example.com
     <Directory /var/www/html/typo3>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

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

</VirtualHost>

Save and close the file then enable the virtual host configuration file and rewrite module with the following command:

a2ensite typo3.conf
a2enmod rewrite

Next, restart the Apache service to apply the changes:

systemctl restart apache2

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

Access TYPO3 CMS

Now, open your web browser and access the TYPO3 using the URL http://typo3.example.com. You should see the following page:

Typo3 installation

If you are installing TYPO3 in a fresh server then you will need to create a FIRST_INSTALL file inside the TYPO3 web root directory. You can create it with the following command:

touch /var/www/html/typo3/FIRST_INSTALL

Next, refresh the web page. You should see the following page:

Environment overview

Click on the No problems detected, continue with installation, you should see the following page:

Configure the database

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

Use existing database

Select your TYPO3 database name and click on the Continue button. You should see the following page:

Create admin user

Next, provide your admin username, password, site name and click on the Continue button. You will be redirected to the TYPO3 login page:

Typo3 login

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

Typo3 admin dashboard

Secure TYPO3 with Let's Encrypt

It is recommended 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 typo3.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 typo3.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/typo3-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/typo3-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/typo3-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/typo3.conf to ssl vhost in /etc/apache2/sites-available/typo3-le-ssl.conf

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/typo3.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/typo3.example.com/privkey.pem
   Your cert will expire on 2020-10-23. 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

Now, you can access the TYPO3 CMS securely using the URL https://typo3.example.com.

Conclusion

Congratulations! you have successfully installed TYPO3 CMS and secure it with Let's Encrypt SSL on Ubuntu 20.04. You can now create your website and blog easily through the web browser. Feel free to ask me if you have any questions.

Share this page:

Suggested articles

0 Comment(s)

Add comment