OK, so we did some custom programming to the LibreNMS system and didn't want auto-updates to break things so that was turned off.  Now a year and 91 commits later, it's time to upgrade.  But the auto-update feature isn't working because we are too far behind.  We are also running an older versions of php(7.4) and ubuntu(20.04) so those will be upgraded as well.



sudo -i

apt install python3-pip
add-apt-repository ppa:ondrej/nginx
add-apt-repository ppa:ondrej/php
apt update

chown -R librenms:librenms /var/www/html/librenms
chmod 771 /var/www/html/librenms
setfacl -d -m g::rwx /var/www/html/librenms/rrd /var/www/html/librenms/logs /var/www/html/librenms/bootstrap/cache/ /var/www/html/librenms/storage/
setfacl -R -m g::rwx /var/www/html/librenms/rrd /var/www/html/librenms/logs /var/www/html/librenms/bootstrap/cache/ /var/www/html/librenms/storage/

apt install php8.2
apt install php-cli php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip


#set timezone in the following files to America/Denver
nano /etc/php/8.2/fpm/php.ini
nano /etc/php/8.2/cli/php.ini



cp /etc/php/8.2/fpm/pool.d/www.conf /etc/php/8.2/fpm/pool.d/librenms.conf
nano /etc/php/8.2/fpm/pool.d/librenms.conf

                #Change [www] to [librenms]:

                                [librenms]


                #Change user and group to "librenms":

                                user = librenms
                                group = librenms


                #Change listen to a unique path that must match your webserver's config:

                                listen = /run/php-fpm-librenms.sock




systemctl stop php7.4-fpm
systemctl disable php7.4-fpm

systemctl restart php8.2-fpm
systemctl restart nginx

su - librenms

./validate.php

pip3 install -r /var/www/html/librenms/requirements.txt

./validate.php

./daily.sh

git checkout master

git pull

./validate.php

/var/www/html/librenms/scripts/composer_wrapper.php install --no-dev

./validate.php

# your database is out of date!  Attempt to fix this issue? y
# .lnms migrate (YES)

# exit su - librenms
exit


sudo sh -c 'sed "s#/opt/librenms#/var/www/html/librenms#" /var/www/html/librenms/dist/librenms-scheduler.service > /etc/systemd/system/librenms-scheduler.service'
sudo sh -c 'sed "s#/opt/librenms#/var/www/html/librenms#" /var/www/html/librenms/dist/librenms-scheduler.timer > /etc/systemd/system/librenms-scheduler.timer'
sudo systemctl enable librenms-scheduler.timer
sudo systemctl start librenms-scheduler.timer


su - librenms
./validate.php
exit

apt update
apt upgrade  # KEEP THE LOCAL VERSION CURRENTLY INSTALLED!!!!

do-release-upgrade  
    # Restart services during package upgrades without asking? YES
    # KEEP THE LOCAL VERSION CURRENTLY INSTALLED!!!!
    
    
reboot

sudo -i

systemctl stop apache2
systemctl disable apache2
apt remove apache2

nano /etc/nginx/conf.d/phpmyadmin.conf

#change
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
#to
   fastcgi_pass unix:/run/php/php8.2-fpm.sock;

systemctl restart nginx


# run the following again to clear any remaining validation errors
su - librenms

./validate.php

pip3 install -r /var/www/html/librenms/requirements.txt

./validate.php

./daily.sh

exit