PHP upgrade to 8.1 for LibreNMS

I've been putting off updating PHP on my LibreNMS box for a while, but I finally figured I'd take a crack at it. I was on 7.4 and needed to get to 8.1.

 

echo "Upgrading system and installing required packages for PHP repository..."
sudo apt update && sudo apt upgrade -y
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2

#Add Sury PHP repository
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg

echo "Updating package list..."
sudo apt update
sudo apt upgrade -y

echo "Installing required PHP packages for LibreNMS..."
sudo apt install php8.1-cli php8.1-common php8.1-curl php8.1-fpm php8.1-gd php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-snmp php8.1-xml php8.1-zip -y

echo "Installing required packages for LibreNMS..."
sudo apt install acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap rrdtool snmp snmpd whois unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip -y


echo "Setting timezone to CST for PHP..."
sudo sed -i "s/;date.timezone =/date.timezone = America\/Chicago/" /etc/php/8.1/cli/php.ini
sudo sed -i "s/;date.timezone =/date.timezone = America\/Chicago/" /etc/php/8.1/fpm/php.ini

echo "Copying LibreNMS configuration file..."
sudo cp /etc/php/7.4/fpm/pool.d/librenms.conf /etc/php/8.1/fpm/pool.d/librenms.conf

sudo apt-get purge php7.* -y

echo "Restarting PHP-FPM..."
sudo systemctl restart php8.1-fpm

sudo pip3 install -r /opt/librenms/requirements.txt
  • librenms, ubuntu, php, upgrade
  • 0 Users Found This Useful
Was this answer helpful?