Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Table of Contents
minLevel1
maxLevel7

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

Code Block
$ which perl

Install commands

In order to install perl we need to fetch it in /home/ec2-user

Code Block
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.

Code Block
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

Code Block
sudo pecl install -f libsodium

check in folder that it exists

Code Block
cd /usr/local/lib

we need to navigate into /etc/php-7.3.d/ in order to make an extenstion for php to use

Code Block
cd /etc/php-7.3.d/
sudo vim 50-libsodium.ini

Inside libsodium.ini we write

Code Block
extension=sodium.so

Right after we restart php-fpm

Code Block
sudo service php-fpm restart

Check that is installed correctly by phpinfo or with the command

Code Block
php -i | grep "sodium"

phpinfo output

...

Image Added