In this tutorial you will learn how to upgrade your system to Ubuntu 18.04 and to the latest version of PHP.
To follow all the steps below you will need a server ready to be updated and a LetsCloud account.
We will start by upgrading Ubuntu, which is more important than the rest. Don’t forget to make a complete backup of your data before starting.
Issue the command below to check if the current system is up to date:
sudo apt update && sudo apt upgrade
Also make sure that either your firewall is temporarily disabled or the TCP port 1022 is open. To do this just run the following command:
sudo ufw allow 1022/tcp comment 'Temp open port ssh tcp port 1022 for upgrade'
Now upgrade the operating system, in order to achieve the latest release from the command-line. You can use the following command for this:
In this step you may be prompted with some screen instructions. Also, while the system is upgrated you may be promoted to replace existing grub or ssh config file. Do not forget to opt by keeping the existing version to avoid problems.
When you see the message “System upgrade is complete”, press y to restart the system and load updates kernel and operating system for your cloud server.
Also, you will have to reboot your droplet.
When the server is on, close connections to the port 1022 by using the following command:
sudo ufw delete allow 1022/tcp
Now you have updated Ubuntu. The next step is to upgrade PHP to the latest version, which is 7.3. by now.
In this step you will install the latest version of PHP. To do this, you will have to add the proper repositories:
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update
Depending on the WebService - Nginx/Apache, you will have to follow different steps. If it’s Nginx, then use the following command:
sudo apt install php7.3-fpm
To check this afterwards run
If you are running Apache, follow these steps:
sudo apt install php7.3
Now that PHP is installed on its latest version, it is time to install some extensions. Do it by issuing the following:
sudo apt install php7.3-extension_name
In most cases the extensions can be installed with the command:
sudo apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y
By now you have updated your Ubuntu to the latest version and the same for PHP.