Skip to main content

Ubuntu 14.04.5LTS to 16.04.5LTS

Ubuntu 14.04.5LTS is a widely popular Linux distro for server and it still receives updates as of Feb 2019. However, the official maintenance period will soon end (April 2019) and hence it is prime time for upgrade.

Upgrading a standard LAMP from 14.04LTS to 16.04LTS is not as straight forward as it seems, especially the original server may be running for years receiving various patches to different minor versions (14.04.1, .2, .3, .4, and .5)

Below are the steps that had worked for me.

1. Ensure the 14.04 version is updated to 14.04.5LTS. This is the latest as of this writing. If you are running ISPConfig 3.1, it is recommended that you also upgrade ISPConfig prior to the distro upgrade.

2. apt-get update

3. apt-get upgrade

4. apt-get dist-upgrade

The above steps should patch the 14.04 to the latest version and with all the patches installed.

5. do-release-upgrade

This should then prompt a new version is ready for upgrade.

6. I have chosen to keep all existing "local" version of config files during the interactive upgrade process (which took about 50-60 minutes), depending on the speed of your server and internet connection etc. I am running on a Rackspace Cloud instance so the speed is quite fast.

7. A problem would occur at the end of the upgrade

(a) MySQL 5.5 to 5.7 upgrade did not work
(b) nano did not work (the binary can't be found)

7a - This is because MySQL 5.5 to 5.7 is not an official upgrade path. It should first be upgraded to 5.6 and then 5.7. Some internet articles suggest upgrading to MySQL 5.7 when you are still at 14.04LTS. I eventually solved this issue by following the steps here:

https://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server

The steps are quoted below.

These are the steps I took to correct this:
  1. Back up your my.cnf file in /etc/mysql and remove or rename it
    sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
    
  2. Remove the folder /etc/mysql/mysql.conf.d/ using
    sudo rm -r /etc/mysql/mysql.conf.d/
    
  3. Verify you don't have a my.cnf file stashed somewhere else (I did in my home dir!) or in /etc/alternatives/my.cnf use
    sudo find / -name my.cnf
    
  4. Backup and remove /etc/mysql/debian.cnf files (not sure if needed, but just in case)
    sudo mv /etc/mysql/debian.cnf /etc/mysql/debian.cnf.bak
    sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7
    sudo apt install mysql-server
    
  5. In case your syslog shows an error like "mysqld: Can't read dir of '/etc/mysql/conf.d/'" create a symbolic link:
    sudo ln -s /etc/mysql/mysql.conf.d /etc/mysql/conf.d
    
    Then the service should be able to start with sudo service mysql start.
That got it working!
Note on step 3, if you found the my.cnf (which I had 2 additional my.cnf, just delete them with rm command). There had been no need to start mysql at end of step 5 because the installation script had started it automatically.

7b) This can be resolved with a single command at shell

hash -r

8. apt-get autoremove - this should clean up the server and remove quite a number of old kernels

9. Re-configure Apache2 so that it runs in correct mode. Follow the articles here:
https://www.mobibrw.com/2017/7068

注意,此时Apache默认被切换到了Prefork MPM工作模式,我们需要手工切换回到Event MPM工作模式。
正常情况下,这个版本的Apache可能默认启用了内嵌的PHP 7.0支持,可是这些默认的模块是不能在Event MPM模块下工作的,切换后启动时候会报告如下错误:
由于我们使用Proxy的方式来调用,因此,我们实际上是不需要Apache内置PHP解析模块的,那么我们需要卸载这些模块:
这个版本(Apache 2.4.18)已经默认内置Event MPM了,因此,我们只需要简单的启用这个模块即可:
切换完成后执行
即可查询到当前启用的模型了。



Comments

Popular posts from this blog

ISPConfig / Pure-FTP / SSL (TLS) setup

ISPConfig comes with LetsEncrypt integrated in its panel for web domains. However, it does not automatically use the SSL cert for FTP service (PureFTP). This post describes the steps to enable the support. 1. We need an FQDN so that Lets Encrypt (LE) will be able to generate SSL under ISPConfig panel. 2. PureFTP TLS support requires a cert in .pem format which can be generated by leveraging the LE cert generated: cat /etc/letsencrypt/live/mydomain.com/privkey.pem /etc/letsencrypt/live/mydomain.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem 3. Restart PureFTP so that it will not use the new certificate 4. LE certificates need to be renewed regularly so it is necessary to create a cron job to keep the .pem file updated. Setup a crontab 0 6 * * * /etc/letsencrypt/certbot-auto -n renew --quiet --no-self-upgrade && cat /etc/letsencrypt/live/mydomain.com/privkey.pem /etc/letsencrypt/live/mydomain.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem && se...

ISPConfig 3 / Mail / Custom mail filter recipe

Recently trying to setup a mail re-direct (or a cc) to an external e-mail address. It is important to first determine if you are running courier or dovecot because the syntax is different. Under dovecot, it should be in sieve syntax. Therefore, under ISPConfig3 -> Email -> Email Mailbox -> Custom Rules, enter: redirect "mail@example.com"; Ensure it is double straight quotes and semi-colon at the end. Wait until the update is done (usually a few minutes) via the cron jobs of ISPConfig3 updating the /var/vmail/domain/username/.sieve

Ubuntu 16.04 and ISPConfig 3.1 - stopping ClamAV

ClamAV requires quite a bit of resources to run in the background and this usually slows down the mail delivery. In the ISPConfig 3 (Under Perfect Server setup), clamAV is run within Amavis. Therefore, typical removal of clamAV commands will not remove it. When RAM is really low, Linux kills amavis and this will cause mail not being delivered. Therefore, if we run amavis to manage anti-virus and spam, consider a minimum of 2G or 4G RAM VM/Cloud servers. The steps to disable clamav and amavisd are: (1) edit postfix conf - note amavis uses a special port 10024 and 10026. Therefore, if you are not using these ports, consider closing them in your firewall settings. nano /etc/postfix/main.cf # content_filter = amavis:[127.0.0.1]:10024 # receive_override_options = no_address_mappings (2) Under ISPConfig 3.1, comment additional 2 lines nano /etc/postfix/tag_as_foreign.re # /^/ FILTER amavis:[127.0.0.1]:10024 nano /etc/postfix/tag_as_originating.re # /^/ FILTER amavi...