# Linux requirements

{% hint style="danger" %}
**OpenSSL 3.0** is not supported!\
PHP introduced support for **OpenSSL 3.0** only in PHP 8.1, so you will not be able to compile older versions of PHP if you have **OpenSSL 3.0** in your system.\
\
Ubuntu 22.04 ships with **OpenSSL 3.0**, so ATM you will need an older release of Ubuntu of another distro that has **OpenSSL 1.1**
{% endhint %}

## 1. Install platform-specific dependencies:

{% hint style="warning" %}
Since **magento-scripts 1.4.0** CMA will also check installed dependencies before starting the application, and if they are missing will provide instructions on how to install them!
{% endhint %}

{% tabs %}
{% tab title="Ubuntu" %}

```bash
sudo apt install \
    libcurl4-openssl-dev \
    libonig-dev \
    libjpeg-dev \
    libjpeg8-dev \
    libjpeg-turbo8-dev \
    libpng-dev \
    libicu-dev \
    libfreetype6-dev \
    libzip-dev \
    libssl-dev \
    build-essential \
    libbz2-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    libxslt1-dev \
    libonig-dev \
    php-cli \
    php-bz2 \
    pkg-config \
    autoconf \
    libsodium-dev \
    cmake \
    php
```

{% endtab %}

{% tab title="Linux Mint" %}

```bash
sudo apt install \
    libjpeg-dev \
    libjpeg8-dev \
    libjpeg-turbo8-dev \
    libpng-dev \
    libicu-dev \
    libfreetype6-dev \
    libzip-dev \
    libssl-dev \
    build-essential \
    libbz2-dev \
    libreadline-dev \
    libsqlite3-dev \
    libssl-dev \
    libxml2-dev \
    libxslt1-dev \
    libonig-dev \
    php-cli \
    php-bz2 \
    pkg-config \
    autoconf \
    libcurl4-openssl-dev \
    libsodium-dev \
    cmake \
    php
```

{% endtab %}

{% tab title="CentOS" %}

```bash
sudo yum install --enablerepo=PowerTools \
    openssl-devel \
    libjpeg-turbo-devel \
    libpng-devel \
    gd-devel \
    libicu \
    libicu-devel \
    libzip-devel \
    libtool-ltdl-devel \
    oniguruma-devel \
    libsodium \
    libsodium-devel \
    libtool-ltdl-devel \
    oniguruma-devel \
    libxml2-devel \
    bzip2-devel \
    curl-devel \
    libxslt-devel \
    autoconf \
    php
```

{% endtab %}

{% tab title="Fedora" %}

```bash
sudo yum install openssl-devel \
    openssl-devel \
    libjpeg-turbo-devel \
    libpng-devel \
    gd-devel \
    libicu \
    libicu-devel \
    libzip-devel \
    libtool-ltdl-devel \
    oniguruma-devel \
    libsodium \
    libsodium-devel \
    libtool-ltdl-devel \
    oniguruma-devel \
    libxml2-devel \
    bzip2-devel \
    curl-devel \
    libxslt-devel \
    autoconf \
    php
```

{% endtab %}

{% tab title="Arch Linux" %}

```bash
sudo pacman -S freetype2 \
    openssl \
    oniguruma \
    libxslt \
    bzip2 \
    libjpeg-turbo \
    libpng \
    icu \
    libxml2 \
    autoconf \
    libzip \
    sqlite \
    readline \
    perl \
    libsodium \
    php \
    pkgconf
```

{% endtab %}
{% endtabs %}

## 2. Install Docker

You can follow the [official installation guide from Docker](https://docs.docker.com/engine/install/ubuntu/) or use commands below:

```bash
# Download installation script
curl -fsSL https://get.docker.com -o get-docker.sh

# Run installation script
sudo bash get-docker.sh

# Add your user to the “docker” group to run docker without root.
sudo usermod -aG docker $USER

# After that you'll need to logout and login to your account or,
# you can temporarily enable group changes by running command below
newgrp docker
```

## 3. Install PHPBrew

{% hint style="warning" %}
Since **magento-scripts\@1.7.0** this part will be done automatically.
{% endhint %}

To install PHPBrew on Linux you will need to follow [installation](https://github.com/phpbrew/phpbrew#installation) instructions or use commands below:

```bash
# Download PHPBrew
curl -L -O https://github.com/phpbrew/phpbrew/releases/latest/download/phpbrew.phar

# Make it executable
chmod +x phpbrew.phar

# Move PHPBrew binary to system folder.
sudo mv phpbrew.phar /usr/local/bin/phpbrew

# Initialize PHPBrew
phpbrew init
```

## 4. Prepare the environment

To work with Magento you need access keys to access the Magento repository.

1. Go to <https://marketplace.magento.com/customer/accessKeys/>
2. Generate Access Keypair

Now you have a **public key** and **private key** values.

To use them you have 2 options:

1. **Use `COMPOSER_AUTH` environmental variable**

   This option is used as a global variable on your machine.

   Replace `<public key>` and `<private key>` with your public and private key.

   ```bash
   export COMPOSER_AUTH='{
       "http-basic":{
           "repo.magento.com": {
               "username": "<public key>",
               "password": "<private key>"
           }
       }
   }'
   ```

   Add the result to your `.bashrc` or `.zshrc` and reload your terminal.
2. **Use auth.json file**

   This option is used on a per-project basis, so your credentials will be always correct no matter which project you are working on.

   Create `auth.json` file in the root of your project and inside put the following content using the same `<public key>` and `<private key>` you obtained before:

   ```
   {
       "http-basic":{
           "repo.magento.com": {
               "username": "<public key>",
               "password": "<private key>"
           }
       }
   }
   ```

## 5. Start your application

{% hint style="info" %}
Start command description can be found [here](https://docs.create-magento-app.com/v1/getting-started/available-commands/start).\
To access Magento CLI, Composer and PHP use [cli](https://docs.create-magento-app.com/v1/getting-started/available-commands/cli) command.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.create-magento-app.com/v1/getting-started/prerequisites/installation-on-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
