As we wrote in previous articles, it is no more practical to keep Ubuntu 14.04 LTS running and trying to upgrade installed softwares somehow. We know that many webmaster are hesitant to upgrade for the fear of breaking website. Here Are the Detailed Steps on How To Upgrade Ubuntu Server 14.04 to 16.04 With Live WordPress With Kernel Upgrade, Debug & Fixes For Nginx. Indeed on Ubuntu 14.04 LTS, by now you’ll get prompt to run do-release-upgrade
command.
Take Full Backup to Upgrade Ubuntu Server 14.04 to 16.04 With Live WordPress
The work over SSH is actually never safe but very few ever failed. What exactly you’ll do is – spin a cloud server instance and create a live website on that clod server instance. First, reduce the TTL of your server’s IP from DNS (we use DYN – we lower down TTL to 30 seconds). Secondly, point your cloud server to your domain. Thereafter proceed to upgrade. This way keep you tension free, have a live tested working backup and avoid downtime. If you skip it and take only backup, ½ to 1 hour downtime is probably obvious. You should take backup of –
- PHP settings
- Nginx default file
- nginx.conf file
- PHP FPM configuration file
- my.cnf file
- Database
- All SSL certificates
- All FTP content
Configuration files can be send to Github secret gists. We do apply many patches, fix, upgrades and new version’s configuration slightly changes. It is obvious to get 404 error if direct command is run.
---
Steps to Upgrade Ubuntu Server 14.04 to 16.04 With Live WordPress
We can actually initiate the process by running do-release-upgrade
command. We ran such without any issue. But officially you should run :
1 2 3 4 5 | sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install update-manager-core sudo do-release-upgrade |
You’ll get this :
1 2 3 4 5 6 7 8 9 | Checking package manager Continue running under SSH? This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover. If you continue, an additional ssh daemon will be started at port '1022'. Do you want to continue? Continue [yN] y |
Hit Y. You’ll get :
1 2 3 4 | tarting additional sshd To make recovery in case of failure easier, an additional sshd will be started on port '1022'....blah blah blah |
Press [ENTER] You’ll get :
1 2 3 4 5 6 7 | Reading package lists... Done Building dependency tree ... Some third party entries in your sources.list were disabled. You can re-enable them after the upgrade with the 'software-properties' tool or your package manager. To continue please press [ENTER] |
Yes, press [ENTER]. Upgrade will continue :
1 2 3 4 5 | Get:1 http://archive.ubuntu.com denial InRelease [247 kB] ... Installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d]d |
Yes, press [Y]. Upgrade will continue :
1 2 3 4 5 6 7 | Get:1 http://archive.ubuntu.com denial InRelease [247 kB] ... Kernel version not supported │ │ │ This version of the GNU libc requires kernel version 3.2 or later. │ │ Older versions might work but are not officially supported. Please │ │ consider upgrading your kernel. |
Continue. We will upgrade kernel later. You’ll get :
1 2 3 4 | Configuration file '/etc/cron.daily/dpkg' ==> Deleted (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: |
Yes, press [Y]. Upgrade will continue :
1 2 3 4 | Configuration file '/etc/cron.daily/dpkg' ==> Deleted (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: |
Yes, press [Y]. Upgrade will continue :
1 2 3 4 | Configuration file '/etc/bash.bashrc' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: |
Yes, press [Y]. Upgrade will continue and may give a big prompt :
1 | Restart services during package upgrades without asking? |
Yes, press [Y]. Upgrade will continue :
1 | Restart services during package upgrades without asking? |
Yes, press [Y]. Upgrade will continue :
1 2 3 4 | Configuration file '/etc/cron.daily/upstart' ==> Deleted (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: |
Yes, press [Y]. Upgrade will continue :
1 | Remove obsolete packages? |
Yes, press [Y]. Copy paste what packages are removed. For us they were :
1 2 3 4 5 6 7 8 9 10 11 12 13 | libapt-pkg4.12 libgcrypt11 libgnutls26 libplymouth2 libprocps3 libssh2-php libxtables10 php5-curl php5-dev php5-gd php5-imagick php5-imap php5-intl php5-mcrypt php5-memcache php5-ming php5-mysqlnd php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xcache php5-xmlrpc php5-xsl ibgif4 libhiredis0.10 libicu52 libisl10 libjs-codemirror libjs-jquery-cookie libjs-jquery-event-drag libjs-jquery-metadata libjs-jquery-mousewheel libjs-jquery-tablesorter libjs-jquery-ui libluajit-5.1-2 libluajit-5.1-common libmagickcore5 libmagickwand5 libmysqlclient18 libonig2 libqdbm14 librtmp0 libstdc++-4.8-dev libsystemd-daemon0 nginx-common php5-json python-chardet python-debian |
Upgrade will continue and end with :
1 2 3 4 5 | System upgrade is complete. Restart required To finish the upgrade, a restart is required. If you select 'y' the system will be restarted. Continue [yN] y |
Reboot. System will prompt to run apt autoremove
. Keep a note of what removed :
1 2 3 4 5 6 7 8 9 | aspell aspell-en dh-php5 dictionaries-common emacsen-common ghostscript gsfonts imagemagick-common libaspell15 libavahi-client3 libavahi-common-data libavahi-common3 libc-client2007e libcups2 libcupsfilters1 libcupsimage2 libcurl3 libfftw3-double3 libgif7 libgs9 libgs9-common libijs-0.35 libjasper1 libjbig2dec0 liblcms2-2 liblqr-1-0 libming1 libpaper-utils libpaper1 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 librecode0 libssl-dev libssl-doc libtidy-0.99-0 libxext6 mlock pkg-php-tools poppler-data pslib1 python3-distupgrade python3-update-manager shtool ttf-dejavu-core ubuntu-release-upgrader-core update-manager-core zlib1g-dev |
Steps to Upgrade Ubuntu Server 14.04 to 16.04 : Reinstall Server Softwares
Frankly you must run :
1 2 | sudo add-apt-repository ppa:ondrej/php apt install nginx-extras php-fpm |
Then, modify the version number of the list of removed packages, like from :
1 | libprocps3 libssh2-php libxtables10 php5-curl php5-dev php5-gd |
to :
1 | libprocps3 libssh2-php libxtables10 php-curl php-dev php-gd |
and run :
1 | apt install libprocps3 libssh2-php libxtables10 php-curl php-dev php-gd |
Otherwise WordPress will have missing packages. Apt will understand what is needed to install. We are avoiding 100% work, you have to do some cheating. Run this to check whether more stuffs missing :
1 | apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext |
There is another thing :
1 | apt-get -y install php-apcu |
Officially it does not need to installed. But, installing it make it easier to use OpCache.
Changes in Nginx Configuration to Upgrade Ubuntu Server 14.04 to 16.04 With Live WordPress
One sided change is for Nginx, another is for PHP7.0-fpm.
1 2 3 | server { listen 443 ssl spy default; listen [::]:443 ssl spdy; |
need to become :
1 2 3 | server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; |
this :
1 2 3 | location ~ .php$ { try_files $uri /index.php; include fastcgi_params; |
need to become :
1 2 3 4 | location ~ .php$ { try_files $uri $uri/ /index.php$is_args$args; include snippets/fastcgi-php.conf; include fastcgi.conf; |
socket :
1 | fastcgi_pass unix:/var/run/php5-fpm.sock; |
need to become :
1 | fastcgi_pass unix:/run/php/php7.0-fpm.sock; |
Kindly check your WordPress Feed. Restore all PHP, my.cnf related settings. Check all the headers for 301 or 200 response :
1 2 3 4 | curl -I https://www.thecustomizewindows.com curl -I http://www.thecustomizewindows.com curl -I http://thecustomizewindows.com curl -I https://thecustomizewindows.com |
Check with your domain, we gave example.
Steps to Upgrade Kernel of Ubuntu Server 16.04
For 64 bit Ubuntu, at this moment you need to run :
1 2 3 4 | cd /tmp wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8-rc4/linux-headers-4.8.0-040800rc4_4.8.0-040800rc4.201608312129_all.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8-rc4/linux-headers-4.8.0-040800rc4-generic_4.8.0-040800rc4.201608312129_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8-rc4/linux-image-4.8.0-040800rc4-generic_4.8.0-040800rc4.201608312129_amd64.deb |
Make sure that all the above are fetched. Then run :
1 | sudo dpkg -i linux-headers-4.8.0*.deb linux-image-4.8.0*.deb |
It will take time. After completion, reboot the server. Where from I got the kernel? From here :
1 | http://kernel.ubuntu.com/~kernel-ppa/mainline/ |
Scroll to the last one. At this time, it is this –
1 | http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8-rc4/ |
I fetched 3 files under the text “Build for amd64 succeeded” – one is all.deb
and rest two are generic
.