You can follow microsoft's official instalation steps, however if you have multiple php instalations (I have php7.4 and 7.3 installed on my laravel forge server) you need to specify what version to build the extension with.
# make sure you have this installed:
sudo apt-get install -y unixodbc-dev
# elevate as root
sudo su
pecl -d php_suffix=7.3 install sqlsrv
pecl -d php_suffix=7.3 install pdo_sqlsrv