how to install symfony 6 in ubuntu 21.04

In this section we will install & setup Symfony 6 in Ubuntu. Before we start you need to install & setup composer 2+, PHP 8.1 and Apache2 HTTP Server.


Step 1 : Install & Setup Symfony 6 Requirements

Symfony 6 Requirements

Composer Version 2+

Apache2 HTTP Server

PHP 8.1+


Step 2 :Install Debian/Ubuntu — Symfony CLI.

curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | sudo -E bash
$ sudo apt install symfony-cli


Step 3:. Create New Symfony 6 Applications

Use the symfony binary provided by the Symfony CLI to create new applications:

If you are building a traditional web application:

symfony new --webapp symfony_6

Move to project

cd symfony_6


Step 4: Run Symfony server

symfony server:start


templates/base.html.twig

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{% block title %}Welcome!{% endblock %}</title>
        <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
        {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
        {% block stylesheets %}
            {{ encore_entry_link_tags('app') }}
        {% endblock %}

        {% block javascripts %}
            {{ encore_entry_script_tags('app') }}
        {% endblock %}
    </head>
    <body>
        {% block body %}{% endblock %}
    </body>
</html>

http://127.0.0.1:8000

install symfony 6 in ubuntu