Installing the mcrypt extension depends on the Linux distribution as well. Here is how you can install it on Ubuntu:
To install the required libraries and PHP modules that are needed by mcrypt, you need to run the following commands:
```bash
sudo apt-get update
sudo apt-get install -y libmcrypt-dev
sudo apt-get install php-dev libmcrypt-dev php-pear
```
Then you need to install mcrypt itself using PECL, which is a repository for PHP Extensions.
```bash
sudo pecl channel-update pecl.php.net
sudo pecl install mcrypt-1.0.4
```
After successful installation, we have to add the extension to PHP configuration using:
```bash
echo "extension=mcrypt.so" | sudo tee /etc/php/8.0/mods-available/mcrypt.ini
```
Enable the mcrypt extension with the command:
```bash
sudo phpenmod mcrypt
```
Finally, restart the PHP-FPM service:
```bash
sudo service php8.0-fpm restart
```
The numbers "8.0" in the commands should be replaced with the version of PHP you're currently running.
This tutorial assumes that you have a Ubuntu Linux OS with PHP8-fpm installed.
**Note**: As of PHP 7.2, the mcrypt extension was moved to the PECL repository and is no longer bundled with PHP. This means that it's no longer updated by the PHP team and might be removed from future versions of PHP.