Install libsodium php package in AWS instances
This guide is a step-by-step procedure on how to install php libsodium package In AWS instances. Libsodium package is required for the moodle version 4 and above. Before continuing with the implementation is always a good practise to take AMIs of our instances so we can always revert if something goes wrong.
Install perl (pecl)
In case we have this already installed continue with Install libsodium
Check if perl is installed
We can check if it exists in path /usr/bin/ or by typing command
$ which perl
Install commands
In order to install perl we need to fetch it in /home/ec2-user
cd /home/ec2-user
wget http://pear.php.net/go-pear.phar
sudo php go-pear.phar
Install libsodium
In order to install libsodium we need to first compile it. It will not work if we use directly the pecl commands.
Download libsodium source, extract and compile
notice that after we extract we switch into superuser, sudo it self didn’t work.
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar -xzf LATEST.tar.gz
cd libsodium-stable/
sudo su
./configure
make && make check
make install
Install libsodium via pecl
check in folder that it exists
we need to navigate into /etc/php-7.3.d/ in order to make an extenstion for php to use
Inside libsodium.ini we write
Right after we restart php-fpm
Check that is installed correctly by phpinfo or with the command
phpinfo output