Created
December 27, 2021 17:23
-
-
Save karthiks/1426c494bbf8115aafee54820fd324c0 to your computer and use it in GitHub Desktop.
Apache HTTP Server Upgrade Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1 : Take backup of current apache2 installation directory | |
sudo cp -r /etc/apache2 /etc/apache2_bkup | |
# Step 2 : Stop Apache2 | |
sudo service apache2 stop | |
# Step 3 : Upgrade Apache2 | |
# Warning: When prompted by the upgrade script asking if you would like to replace the existing config file with newer one, say NO!. | |
# If you in a hurry select yes, don't forget to replace it with one from the backup you took in step 1. | |
sudo apt update | |
sudo apt upgrade apache2 | |
# Step 4 : Check if config files have changed. (Optional, in our case it didn't!) | |
sudo apt install colordiff | |
colordiff /etc/apache2/apache2.conf /etc/apache2_bkup/apache2.conf | |
# Step 5 : Check if enabled sites and enabled modules still exist as it was earlier. (Optional, in our case it didn't!) | |
diff <(ls -l /etc/apache2/sites-enabled) <(ls /etc/apache2_bkup/sites-enabled) | |
diff <(ls -l /etc/apache2/mods-enabled) <(ls /etc/apache2_bkup/mods-enabled) | |
# Step 6 : Start Apache service and do sanity test post upgrade | |
sudo service apache2 start | |
# Step 7 : Check your Apache Version now | |
apache2 -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment