Upgrade Ubuntu 14.04 to 16.04
Ubuntu 14.04 (“Trusty Tahr”) stopped receiving security updates from Ubuntu in April 2019. To continue receiving updates from Ubuntu, you must upgrade Ubuntu.
::: Operating system upgrades are risky. If the upgrade fails, your server will become unusable. It is often better to migrate your apps to a new server running the latest version of Ubuntu. :::
:::
Do not attempt to upgrade to 16.04 if your server has less than 1GB of
memory.
If you have a server with 512MB of memory, you should resize your server
to 1GB before upgrading. You can resize back down to 512MB after the
upgrade is complete.
Attempting to upgrade a server with less than 1GB of memory may result
in database corruption.
:::
Preparing to Upgrade
It is critical that you take a snapshot of your server before upgrading Ubuntu.
You can take a snapshot of your server through your server provider’s control panel.
::: Do not proceed with the upgrade until you’ve taken a snapshot of your server. :::
Ensure Enough Memory is Available
If your server has 1GB of memory or less, you should increase the server’s memory before starting the upgrade or else the upgrade may fail. After the upgrade is complete, you can decrease the server’s memory.
Apply available updates and reboot
Once you’ve taken a snapshot of your server and made sure it has enough
memory, SSH in to your server as root
and run
the following command to make sure your server is ready to be upgraded
to a new version of Ubuntu.
sudo apt-get update && sudo apt-get -y dist-upgrade && sudo dpkg --configure -a
If the above command fails or prints an error message, do not proceed with upgrading.
Once all packages have been updated, reboot your server by running this command:
sudo reboot
Uninstall PHP packages
Uninstall all PHP packages by running the following command as root
:
sudo apt-get -y remove 'sp-php*'
Performing the Upgrade
::: All of the apps on your server will be down during the upgrade. Depending on your server’s network connection and hardware, the upgrade may take anywhere from ten minutes to two hours. :::
To upgrade your server from Ubuntu 14.04 to Ubuntu 16.04, SSH into your
server as root
and run the following command:
sudo do-release-upgrade -f DistUpgradeViewNonInteractive
If you encounter problems or the upgrade fails, take screenshots of any errors and then restore your server to the snapshot you made before you began the upgrade. Once your server has been restored from a working snapshot, please contact support and provide us the details of the errors.
After the Upgrade
Reboot your server
Once the upgrade is complete, reboot your server by running the following command:
sudo reboot
Update the package manager configuration
Run the following command to update the package manager’s configuration for ServerPilot’s repositories:
sudo bash -c "echo 'deb [signed-by=/usr/share/keyrings/serverpilot.gpg] https://download.serverpilot.io/ubuntu xenial main' > /etc/apt/sources.list.d/serverpilot.list"
You can verify the file is correct by running the following command:
sudo cat /etc/apt/sources.list.d/serverpilot.list
You should see the following output from the above command:
deb [signed-by=/usr/share/keyrings/serverpilot.gpg] https://download.serverpilot.io/ubuntu xenial main
Next, update the package manager’s list of available packages by running this command:
sudo apt-get update
Then run the following command to install any package updates that are now available:
sudo apt-get -y dist-upgrade
Reinstall PHP packages
Install the versions of PHP that are supported on Ubuntu 16.04 by running the following command
sudo apt-get -y install sp-php5.4 sp-php5.5 sp-php5.6 sp-php7.0 sp-php7.1 sp-php7.2 sp-php7.3 sp-php7.4 sp-php8.0 sp-php8.1 sp-php8.2
After you install these PHP packages, if you do not see any of these PHP versions available in ServerPilot when choosing the PHP version for apps on this server (that is, when editing an app’s PHP version on the app’s “Settings” page), please contact support so we can enable the missing PHP versions for you.
Update the PHP version used for the “php
” command
Update the version of PHP used for the PHP-CLI (the “php
” command) by
running the following command as root
:
sudo dpkg-reconfigure sp-php-cli
Select the version of PHP you’d like to be the default for the “php
”
command.
Regardless of which PHP version you chose as the CLI default, you can
access any PHP-CLI version by using a version-specific “php
”
command.
Recompile PECL extensions
If you’ve previously installed any PECL extensions on your server, you should now recompile them. See how to recompile PECL extensions.
Take a server snapshot
As the final step, take a snapshot of your server now that the upgrade is complete. All of your existing snapshots are for an older version of Ubuntu. If you needed to restore your server and used one of those older snapshots, you would have to perform the upgrade again.