Updating the Webserver

From 24PinTech Wiki
Jump to navigation Jump to search


About

Our Nginx web server runs on Ubuntu 20.04 LTS as of now. Most of this documentation was written during the update from 18.04 LTS to 20.04 LTS, so take everything from this page with a grain of salt, as things in your upgrade may differ. A lot of this is written as a project plan, which may in turn help you create a project plan for yourself.

Links

Web Server Plans

  1. Backup the entire server and be sure that the restore points work.
    • During my update, we had created a new VM in VSphere to push our backups to, in case anything in the updating process had failed, this is not necessary anymore since the discovery of VM snapshots. View documentation on snapshots to learn more.
  2. Update Ubuntu
  3. Update PHP
  4. Update MySQL
  5. Update Wordpress
  6. Update Nginx
  7. Update Hesk
  8. Review Certbot Certificates
  9. Change 24pintech Wordpress Account Password on all Websites to be advanced PinTech Password.
  10. Email evit.computer and maricopaeducationfoundation.com about the pending shutdown.
  11. Backup MySQL Databases

Updating Process

FIRST email evit.computer and maricopaeducationfoundation.com about the pending shutdown.
SQL DATABASES WILL BE BACKED UP WITH OLD VERSION OF THE SERVER.

Backup Server

The server backup and restore points have been proven to work by the crash on 1/31/22. These are functional and need no more work on the Web-Masters end. Before beginning any updates we will take the working machine point and back it up --Take a snapshot--. We will put a stasis on work done on the 24PinTech websites and notify our external admins, “evit” and “MEF” that all changes made could possibly be lost. Work orders will be put on hold temporarily and we will stop accepting them until all updates are completed. Once these conditions are met, we can begin work on the server.

Updating/Verifying Functional Updates

Ubuntu

  • Updating Ubuntu is a fairly easy process and shouldn’t take too much time --LOL, I WAS SO WRONG, GL BUDDY--. To start we will make sure that we are cross-referencing information from Ubuntu's guide for the command line.
    • Run the command sudo do-release-upgrade -d‘sudo’ meaning to run command as admin/root, ‘do-release-upgrade’ checks for update and if one is available will start running it, ‘-d’ meaning “devel-release” or the latest LTS/Development Release. You will be asked a series of Y/N questions to configure the upgrade. Once all of this is completed, Ubuntu is finished upgrading.
  • After Ubuntu is finished updating, check IP, websites, and Nginx config files for discrepancies.
  • Uninstall parsoid before update and reinstall once you are updated, don't replace any files with new ones.

Nginx

  • To begin you need to verify that Nginx is actually in need of an update by running, nginx -v‘nginx’ meaning an nginx command, and ‘-v’ meaning check the version. It should be something like 1.18.x IMPORTANT: MARK DOWN YOUR CURRENT VERSION… X.XX.X
  • If an upgrade is necessary then you will run the command sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.X.XX.X.backup‘sudo’ meaning to run the command as admin/root, ‘cp’ being the command to copy file1 to a new file2 location, /etc/nginx/nginx.conf is a reference to Nginx's configuration file, /etc/nginx/nginx.conf.X.XX.X.backup is the backup files name and location.
  • Next you will install the needed dependencies using, sudo apt-get install software-properties-common python-software-properties. Afterward you will add the Nginx repository to the machine using sudo add-apt-repository ppa:nginx/stable
  • Next update all repositories, sudo apt-get update
  • Finally install Nginx again using sudo apt-get install nginx – THIS WILL UPDATE IT AS WELL AS INSTALL IT FRESH… It will ask if you want to keep your old config, select Y / yes. To complete the install verify the Nginx version using nginx -v.
  • Once Nginx completes installing, run sudo systemctl restart nginx. Check all Nginx config files and websites for discrepancies.

MariaDB

  • MARIADB IS USING THE LATEST STABLE VERSION SKIP TO NEXT STEP!
  • Once this update is discovered, add to this wiki...

PHP

  • Add the PHP repositories to the web server, sudo apt install software-properties-common followed by sudo add-apt-repository ppa:ondrej/php
  • Update the system packages, sudo apt-get update
  • Install PHP 7.4, sudo apt install php7.4. Check the PHP version sudo php -v. Install extensions, sudo apt install php7.4-common php7.4-mysql php7.4-fpm After you install edit, /etc/php/7.4/fpm/php.ini Find ‘cgi.fix_pathinfo’, uncomment it and make it equal to 0.
  • Run, sudo systemctl stop php7.2-fpm, sudo systemctl disable php7.2-fpm, sudo systemctl start php7.4-fpm, sudo systemctl enable php7.4-fpm in that order.
  • Verify PHP by making a website with the content <?php phpinfo()  ?>
  • Check all Websites for functionality.
  • PS: CHANGE SERVER BLOCK CONFIG TO BE NEW PHP VERSION
    • sudo nano /etc/nginx/sites-available/24pin.tech look for the location ~ \.php${line, and change the content from the old version to the new version. ex. x.x->x.y

HESK

  • BEFORE CONTINUING RUN ANOTHER BACKUP!!!
  • PuTTY into the web-server and place in the latest HESK install
  • Extract the files and move them into the current HESK directory with the exception of, “hesk_settings.inc.php, head.txt, header.txt, footer.txt” replacing all of the old files.
  • Navigate to service.24pin.tech/install, and select Update HESK. Once this is completed delete the install folder from the server.
  • Go to service.24pin.tech/admin and log in with the administrator account. If this does not work, reset the password.
  • Check Help desk title, and custom field settings to make sure they display correctly.
  • Submit a ticket and verify functionality.

Wordpress

  • Navigate to all wordpress websites with admin and select Update to version 5.9
  • Let the install complete and check all pages and media for discrepancies.

Review Certbot Certificates

  • Run “sudo certbot certificates” to view all certificates.
  • Delete unused certificates by running “sudo certbot delete <ID>”
  • Run “sudo certbot certificates” again and verify changes.
  • Navigate to all websites and check for HTTPS.

Backup MySQL

This step has yet to be completed, maybe you can do this one!