How do I install PHP 7.4 FPM and CLI for Magento 2 to CentOS 7?

yum install epel-release yum-utils
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php74

yum remove php
yum remove php-common

yum install php
yum install php-bcmath
yum install php-cli
yum install php-devel
yum install php-fpm
yum install php-gd
yum install php-intl
yum install php-json
yum install php-mcrypt
yum install php-mysqlnd
yum install php-mbstring
yum install php-opcache
yum install php-pdo
yum install php-pecl-igbinary
yum install php-pecl-libsodium2
yum install php-pecl-redis
yum install php-soap
yum install php-xml
yum install gd
yum install imagick
yum install xmlrpc
yum install php-posix
yum install php-zip

systemctl restart php-fpm

How to install to ubuntu?