CentOS 7:

yum install epel-release -y
yum install libsodium -y

CentOS 6:

# Install Development tools
yum -y groupinstall "Development Tools"
# Download latest version of libsodium
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
# Decompress
tar xf LATEST.tar.gz && cd libsodium-stable
# Build & Install & Link
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

Ubuntu / Debian:

# Install Development tools
apt-get install build-essential
# Download latest version of libsodium
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
# Decompress
tar xf LATEST.tar.gz && cd libsodium-stable
# make and install
./configure && make -j2 && make install
ldconfig