Skip to main content

Posts

Migration of EC2 from old to new generation (Nitro System)

Problem: During the migration of EC2 from older generation to newer generation that runs Nitro System, the system fails to boot Root Cause: We have 2 EBS attached and if the booting process involved the use of the second EBS, the booting will fail. In our case, we moved /var to another EBS. The reason is the in /etc/fstab, it refers to a /dev which no longer exists. This is due to new referencing convention used by Nitro System. Instead of /dev/xvdb1 etc, they become /dev/nvmen1p1 and so on. Solution: 1. Before switching instance to new generation, change the /etc/fstab e.g. from /dev/xvdb1 to /dev/nvme1n1p1 2. Stop the instance via AWS Console 3. Switch to the new instance, start instance Depending on how the dev is initially formatted, the change could be: e.g. from /dev/xvdb1 to /dev/nvme1n1 (i.e. without "p1") With the server upgrade to newer generation under AMD architecture, there is a cost saving of >15% and better network I/O. This upgrade exercise makes economic...

Speeding up Apache2 with Varnish; under ISPConfig 3

A virtual hosting requires Apache2 as webserver (due to the need for .htaccess). Hence can't directly replace it with NginX. Solution in brief: Setup a Varnish as cache but Varnish does not support SSL Hence we need to setup an NginX as reverse proxy to listen to port 443 and redirect the request to Varnish. The last step was to setup http to https re-direction. This could not be done directly under ISPConfig 3 http-to-https switch because this Apache2-based setting will create an infinite loop. This is resolved by creating a redirect within Varnish via its configuration language VCL. Solution step-by-step: Source: 1.  https://github.com/manoaratefy/ispconfig3-varnish When performing the steps by following Source 1, also turn off any Apache2 http to https redirect under ISPConfig after re-sync the websites. Then remove the default NginX vhost: rm /etc/nginx/sites-enabled/default Then perform the final steps as directed, i.e. restart the services: systemctl rest...

Backup iPhone to external hard drive in Mac OS Catalina

Issue: The MacBook internal SSD is too small for an iPhone backup. Under Mac OS Catalina, the iPhone backup and restore functionality is built in Finder. So iTunes is no longer needed. The path of the backup is essentially the same. Solution: Create a symlink so that it points to the external hard drive. Steps: 1/ Locate the Backup Folder. It should be inside: ~/Library/Application Support/MobileSync/ 2/ Rename the existing Backup folder to something like "Backup Old" so that you have a backup. 3/ Under the external SSD or storage, create a new "Backup" folder. 4/ Open Terminal and execute the symlink command: sudo ln -s /Volumes/ExternalHD/iPhoneBackup/Backup/ ~/Library/Application\ Support/MobileSync/Backup 5/ Under Finder, execute the backup, and verify that it is backing up Note: Similar methods applied to backup into specific backup folders (should be ideal for incremental backup) Photo Credit: Photo by Markus Spiske on Unsplash...

Installing php7.3 on ubuntu 18.04LTS

php 7.2 is the standard component of Ubuntu 16.04. The following steps can upgrade it to php7.3 sudo apt update sudo apt upgrade sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update sudo apt install php7.3-fpm 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

Ubuntu 18.04 Change Hostname

Follow the following post to change hostname: https://linuxize.com/post/how-to-change-hostname-on-ubuntu-18-04/ 1. sudo hostnamectl set-hostname [new hostname] 2. nano /etc/hosts 3. ls -l /etc/cloud/cloud.cfg If there is a cloud.cfg file, edit the following to "true" 4. # This will cause the set+update hostname module to not operate (if true) preserve_hostname: true

Implementing MFT for a more secure data transfer than SFTP

Managed File Transfer provides a more secure file transfer options. Implementing this requires the use of secured key pairs. The following is a summary of steps and references. Full credit to Mr. Martin Ng. Platform: AWS EC2 running on Ubuntu AMI. References to path may be different, with ISPConfig installed for virtual hosting management. For key generation: https://www.thesecuritybuddy.com/pgp-and-gpg/how-to-generate-gpg-key/ For generating enough entropy at the last step of key generation (need to open another SSH): https://serverfault.com/a/950103 (essentially run ls on root path so that it generates disk operations / entropy) Encrypting and decrypting: https://www.gnupg.org/gph/en/manual/x110.html Passing passphrase in decrypting (simplified as using this --batch --passphrase 'thepassphrase'): https://superuser.com/a/1358025 Note: The ".gnupg" directory should be in the same directory of the PHP files...

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 ...