Monday, March 16, 2020

LEMP Stack Setup Guide with Firewall and FTP Configuration

The Complete LEMP Stack Setup Guide For Beginners (Download PDF)

LEMP Stack Setup

L – Linux (Ubuntu 18.0.4 LTS)

E – NGINX (NGINX 1.14.0)

M – MySQL (MySQL 14.14 Distribution 5.7.29)

P – PHP (PHP7.2)

Pre-requisites

1 VPS Server: 4 GB RAM, 2 vCPU (AWS), 100 GB Hard Disk

OR

1 Virtual Box machine: 4 GB RAM, 100 GB Hard Disk

Virtual Box Installation

Download and install the Virtual Box setp for Ubuntu Linux (64-bit).

virtualbox-6.0_6.0.16-135674~Ubuntu~bionic_amd64.deb

Download and install the Virtual Box extension pack for the corresponding software version.

Oracle_VM_VirtualBox_Extension_Pack-6.0.16.vbox-extpack

Ubuntu (64-bit) OS Installation

Download the iso image file for the preferred version of Ubuntu Linux Server Edition.

ubuntu-18.04.3-live-server-amd64.iso

Note:

  1. The server edition does not have a GUI interface.
  2. Create a new virtual machine. Open its settings and select the storage option.
  3. Click on Controller IDE and add an optical drive (left-most circular button).
  4. Select the Ubuntu iso image file and save all settings.
  5. Start the virtual machine to initiate the installation process.

The iso image shall be automatically unmounted at the end of the installation process.

LEMP Stack Installation

1. Start the VM and login to the server instance.

2. Create a non-root user account (matrix) with sudo privileges.

root user privileges

home directory structure

3. Install the NGINX web server.

In order to display web pages to our site visitors, we are going to employ Nginx, a modern, efficient web server. All of the software used in this procedure will come from Ubuntu’s default package repositories. This means we can use the apt package management suite to complete the necessary installations.

sudo apt update

sudo apt install nginx

On Ubuntu 18.04, Nginx is configured to start running upon installation.

Check if the ufw service is running on the server. ufw is the Ubuntu Firewall system.

ps-ef|grep ufw

sudo ufw status

4. If not enabled, enable ufw as follows:

sudo ufw enable

5. If we have the ufw firewall running, we will need to allow connections to Nginx. Since we have not yet setup SSL on our VM, we only need to allow traffic on port 80.

sudo ufw allow 'Nginx HTTP'

Check the status of ufw.

sudo ufw status

6. Check if the NGINX web server is running by accessing the ipaddress of the Guest OS (VM) from a browser on the Host OS.

ifconfig

OR

ifconfig|grep inet

inet 192.168.1.8 (dynamic ip address of VM)

Type this ip address from a browser installed on the Host OS.

If we see the above page, we have successfully installed Nginx.

Note: Please ensure the VM adapter type under network settings is set to Bridged Adapter.

Select an appropriate adapter name and test by accessing the ip address of the VM.

Set Promiscuous Mode to Allow All. (Not mandatory)

Restart the NGINX server: sudo systemctl restart nginx

Stop the NGINX server: sudo systemctl stop nginx

Start the NGINX server: sudo systemctl start nginx

Check NGINX version: nginx -v

7. Install the MySQL database server.

sudo apt install mysql-server

8. Secure the MySQL installation

sudo mysql_secure_installation

Error encountered.

Fix: Start the MySQL database service.

/etc/init.d/mysql start

Re-run the security script.

Do not activate the component: VALIDATE PASSWORD PLUGIN

Set the database root password: <Specify a strong password>

  • Remove anonymous users.
  • Disallow remote root login.
  • Remove the test database.
  • Reload privilege tables.

Stop the database: /etc/init.d/mysql stop

Check database status: /etc/init.d/mysql status

Check the authentication string.

sudo mysql (logs in without prompting for password)

SELECT user,authentication_string,plugin,host FROM mysql.user;

Default authentication for root is set to auth_socket.

This enables greater security than using a password but may complicate things when using an external program such as phpMyAdmin.

Change the authentication method to mysql_native_password.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<enter password>';

Run FLUSH PRIVILEGES; from the MySQL prompt which tells the server to reload the grant tables and put the new changes into effect.

Sometimes, due to a MySQL bug, the alter user operation may not succeed. In such a scenario, remove the quotes around the ‘root'@'localhost’ string.

https://bugs.mysql.com/bug.php?id=86523

ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '<enter password>';

(MySQL is case-insensitive. However, on some system and setup tables, case-sensitive commands may be required. In such a situation, run the same command in lower-case alphabets.)

Verify the authentication method after running the flush statement.

sudo mysql shall no longer allow automatic login. We have to login with a password.

mysql -u root -p

9. Install PHP and configure NGINX to use the PHP processor.

We have Nginx installed to serve our pages and MySQL installed to store and manage our data. However, we still do not have anything that can generate dynamic content. This is where PHP comes into play. Since Nginx does not contain native PHP processing like some other web servers, we will need to install php-fpm, which stands for “fastCGI process manager”. We will tell Nginx to pass PHP requests to this software for processing.

Depending on our cloud provider, we may need to add Ubuntu’s universe repository, which includes free and open-source software maintained by the Ubuntu community, before installing the php-fpm package.

sudo add-apt-repository universe

Install the php-fpm module along with an additional helper package, php-mysql, which will allow PHP to communicate with our database backend. The installation will pull in the necessary PHP core files.

sudo add-apt-repository universe

sudo apt install php-fpm php-mysql

We now have the LEMP stack components installed. However, we need to make a few configuration changes in order to tell Nginx to use the PHP processor for dynamic content.

This is done at the server block level (server blocks are similar to Apache’s virtual hosts). To do this, open a new server block configuration file within the /etc/nginx/sites-available/ directory.

cd /etc/nginx/sites-available/

ls -ltr

Take a back-up of the default configuration file in the home folder of the logged-in user. The default file is the default server block (site) of the NGINX server.

The default root location from where NGINX servers files is /var/www/html.

A symbolic link is present in the sites-enabled folder.

Whatever server block file is available in the sites-enabled folder shall be treated as an active website.

10. Test the configuration by creating a PHP file.

Create a php file called info.php with the following contents:

<?php

phpinfo();

?>

sudo nano info.php

Place it in the /var/www/html folder.

Error: The info.php file is prompted for download instead of showing the php server information.

Check the version of php-fpm running: ps -ef|grep php

Check the status of php7.2-fpm: sudo systemctl status php7.2-fpm

Test the NGINX configuration file for syntax errors: nginx -t

Several errors are listed. Check with: sudo nginx -t

Error: unexpected end of file, expecting ";" or "}" in /etc/nginx/sites-enabled/default:92

Check the NGINX php settings.

cd /etc/php/7.2/fpm

The php.ini file is our concerned file. No change required.

Edit the default server block file: /etc/nginx/sites-available/default

Uncomment the following 4 lines:

location ~ \.php$ {
include snippets/fastcgi-php.conf;

and

fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; // Check version

and

} // This is very critical. Do not miss. It shall throw errors in ‘nginx -t’ command if left uncommented and php shall not work properly.

Restart the NGINX service: sudo systemctl restart nginx.service

OR

sudo systemctl restart nginx

Check nginx config erros again: sudo nginx -t

Check the url: http://192.168.56.102/info.php

PHP is working fine if the above page is displayed. After testing, remove this file as it may provide valuable information about your configuration to unauthorized users who may use it to hack into your system. This file should not be present in Production systems: sudo rm /var/www/html/info.php

Enable Shared Folders between Host and Guest OS

Enabled shared folders. Virtual Box: Devices --> Shared Folders

  • Specify the full directory path to be mounted.
  • Select Auto-mount
  • Select Make Permanent

Auto-Mount through Virtual Box Manager

In case we enabled auto-mounting on creating a shared folder from the Virtual Box Manager those shared folders will automatically be mounted in the guest with mount point /media/sf_<name_of_folder>. To have access to these folders users in the guest need to be a member of the group vboxsf.

sudo usermod -aG vboxsf userName

The guest will need to restart to have the new group added.

Note: In certain cases, the auto-mount feature may not work due to system bugs or version incompatibility. In such situations, please setup and use ftp for file transfer.

Monitor System Usage

top (RAM and CPU utilization)

OR

free -m

OR free -h (h – human readable format)

OR

watch -n 5 free -m (refresh data every 5 seconds)

OR

watch -n 5 free -h

df -k . (Disk space utilization)

Set a static ip adress for the virtual machine (Virtual Box)

Open Virtual Box --> File --> Host Network Manager

Click on Create to add a Host-Only network.

Click on Properties.

Note the Ipv4 and Network Mask addresses.

DHCP Enable check-box is kept unchecked by default. Leave it unchanged. Close the window.

Note: The host computer’s ip address (connected to dyamic ip-based router) shall not match the ip address of the guest virtual machine. The guest ip address may change after every reboot. Hence, we need to set a static ip address of our choice to proceed with the configuration of web and database servers on our virtual machine.

Select the virtual machine in the Virtual Box Manager window. Click on Settings – Network.

Adapter 1 should already be set up. Select Adapter 2.

Fill out the settings as shown below. Here, we specify the host-only adapter that we created earlier.

Enable Network Adapter: Checked

Attached to: Host-only Adapter

Name: vboxnet0 (Created earlier)

Other values should be pre-filled. Leave them unchanged.

Start the virtual machine.

ifconfig -a

This shows the network interfaces and ports. We shall work with the second one: enp0s8

sudo vim /etc/network/interfaces

Quit the file without making any change. In Ubuntu 18.04 (Bionic) we use netplan instead of network interfaces.

cd /etc/netplan/

ls -ltr

check the already existing files.

We need to configure the *.yaml file for a static ip address.

Take a backup of the original file.

Switch to root user: sudo su

cp -rp 50-cloud-init.yaml orig-config.yaml

Check all interfaces.

ip link show

We shall now configure orig-config.yaml and set enp0s8.

vi orig-config.yaml

Make the necessary changes as shown below:

addresses: [192.168.56.102/24] // 102 is the variable part. 24 is the range of ip(s) available.

dhcp4: no

gateway4: 192.168.56.1 // Noted earlier

Save the file and exit. Restart the network service.

sudo netplan apply

Check the changes in ip address.

Test by pinging the guest server from the host machine.

ping 192.168.56.102

Not pinging. Restart the virtual machine and test again.

The virtual machine (guest) can now be successfully pinged from the host machine.

Check if the NGINX web server can be accessed from the host machine by typing the static ip address.

The static ip configuration has been successfully tested.

Setup ftp server on host and guest OS

Check for existing installed ftp processes:

dpkg -l|grep ftp

Install the ftp server:

sudo apt-get install vsftpd

Check sftpd server status after installation:

sudo service vsftpd status

The above screenshot shows the vsftpd service running on the host machine.

If the service is not active, please start it as follows:

sudo service vsftpd start

Test the connection with: ftp localhost

Login should be successful. Perform the same installation steps on the guest os as well.

Check the firewall status in the guest machine and allow ftp access from the host machine to the guest machine.

sudo ufw status

sudo ufw allow ftp

sudo ufw status

Test ftp access from the host machine to the guest machine.

Note: Host-Only adpater is enabled in the Virtual Box network configuration. The specified static ip address may be used to connect to the ftp server.

Enable write access in the guest machine through ftp.

sudo vim /etc/vsftpd.conf

Uncomment the following line: #write_enable=YES

Save and quit the file.

sudo service vsftpd restart

Transfer a file from the host machine to the guest machine.

Common ftp commands:

ls – List the direectory contents in the target ftp server.

cd – Change directory in the target ftp server.

lcd – Change directory in the source (local) server.

(m)put – Write/transfer file(s) to the target ftp server.

(m)get – Read/Transfer file(s) from the target ftp server.

bye – Exit the ftp prompt.

bin – Switch to binary mode; suitable for binary-content transfer.

ascii – Switch to ASCII mode; suitable for text-content transfer.

Check if the file transfer has been successful in the guest machine.

Note: ftp access through the static ip address might not work if the host machine is connected to the wifi router for internet connection in bridged adapter mode. In such a situation, use the other dynamic ip address which is shown by the following command: ifconfig|grep inet

Install phpMyAdmin for LEMP on Ubuntu

phpMyAdmin is a browser based GUI interface to manage and operate MySQL databases.

sudo apt-get update

sudo apt-get install phpmyadmin

Press tab and do not select either Apache or Lighttpd. Select OK and hit enter to continue with the installation.

Select Yes and hit Enter.

Enter the root password for the MySQL database installed earlier.

Re-enter the database root password to confirm and and continue with the installation.

We shall need to create a symbolic link between phpMyAdmin and the site’s root directory. If we are using the NGINX default root directory, use the following command:

sudo ln -s /usr/share/phpmyadmin/ /var/www/html

Test by accessing the url: http://192.168.56.102/phpmyadmin

Error: 403 Forbidden

Check the folder permissions of /usr/share/phpmyadmin/ and /var/www/html/. This should be fine by default and no change is necessary. If not, rectify the same.

cd /etc/nginx/sites-available/

sudo vi default

Add index.php as a supported index in the site config file.

Save the changes and quit. Restart the NGINX web server.

sudo systemctl restart nginx

Test the public-ip-address/phpmyadmin URL again. The phpMyAdmin login page should be displayed.

Login with user id as ‘root’ and the associated password.

Default list of user accounts as visible in phpMyAdmin:

Warning noted in import section of phpMyAdmin.

This warning is usually encountered when an older version of phpMyAdmin is configured with a more recent version of PHP.

Solution:

1) Download the latest version of phpMyAdmin and update the software.

OR

2) Make a small editin a config file to forcibly type cast an array data type with the count function.

File name: /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

Search and find the following line:

if ($options != null && count($options) > 0) {

Change it to the following:

if ($options != null && count((array)$options) > 0) {

Login to phpMyAdmin and test the import option again.

Try to import a database into MySQL through phpMyAdmin.

Error: 413 Request Entity Too Large

We have to edit the NGINX configuration file to allow an upload of larger file size. The following changes shall increase the file upload size for all server blocks.

cd /etc/nginx/

sudo vi nginx.conf

Add the following line in the http section:

client_max_body_size 15M;

Save and quit. Reload the NGINX configuration. Restart is not necessary.

sudo systemctl reload nginx

Login to phpMyAdmin and re-attempt the import operation.

Error:

We now have to change the PHP settings for maximum file upload size.

cd /etc/php/7.2/fpm/

sudo vi php.ini

Update upload_max_filesize to 15M.

Update post_max_size to 15M.

Save and quit. Reload php-fpm.

sudo systemctl reload php7.2-fpm

Re-attempt the database import operation.

Error: 504 Gateway Time-out

This usually happens if the database import file is large in size and can be fixed by suitably increasing the NGINX time-out values.

MySQL database operations

mysql -u root -p

create database knowhowspotdb;

create user ‘khuser’@’localhost’ identified by ‘<enter password>’;

use knowhowspotdb;

grant all privileges on knowhowspotdb.* to ‘khuser’@’localhost’;

exit

cd /home/matrix/ftpbase

sudo apt install unzip

unzip a1034c7b8_knowhowdb_2020-01-24_10-13-50.sql.zip

mysql -u khuser -p knowhowspotdb < a1034c7b8_knowhowdb_2020-01-24_10-13-50.sql

Note: Ensure that the sql dump has been ftp’ed in binary mode and not in ascii mode.

Setup NGINX Server Blocks (Virtual Hosts)

When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server.

Nginx, on Ubuntu 18.04, has one server block enabled by default. It is configured to serve documents out of a directory at /var/www/html. This shall work well for a single site. However, we shall need additional directories if we want to serve multiple sites. We can consider the /var/www/html directory as the default directory that will be served if the client request does not match any of our other sites.

We will create a directory structure within /var/www for each of our sites. The actual web content will be placed in an html directory within these site-specific directories.

sudo mkdir -p /var/www/knowhow.com/html

The -p flag tells mkdir to create any necessary parent directories along the way.

We shall now reassign ownership of the web directories to our normal user account. This will let us write to them without sudo.

Note: Depending on our needs, we may need to adjust the permissions or ownership of the folders again to allow certain access to the www-data user. Dynamic sites will often need this.

sudo chown -R $USER:$USER /var/www/knowhow.com/html

We are using the $USER environmental variable to assign ownership to the account that we are currently signed in (Please ensure that we are not logged in as root). This will allow us to easily create or edit the content in this directory.

Copy the website’s files inside the html folder of the target site.

cd ~/ftpbase

cp -rp knowhowspot.zip /var/www/knowhow.com/html

unzip knowhowspot.zip

Now, we have to create a server block file for knowhow.com. Let us start by creating a copy of the default block file.

cd /etc/nginx/sites-available

sudo cp default knowhow.com

Edit the knowhow.com server block file.

sudo vi knowhow.com

Remove the commented lines.

Remove the default_server tags.

Update the file root path to /var/www/knowhow.com/html.

Update the server_name tag to include knowhow.com and www.knowhow.com.

Save and close the file. The final server block configuration file should look as shown below.

Now that the server block file is created, we have to enable it by creating a symbolic link from this file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/knowhow.com /etc/nginx/sites-enabled/

The knowhow.com server block shall respond to requests for knowhow.com and www.knowhow.com. We can create more server blocks for multiple and different websites. The default server block shall respond to any request on port 80 that does not match any enabled server block.

In order to avoid a possible hash bucket memory problem that can arise from adding additional server names, we will go ahead and adjust a single value within our /etc/nginx/nginx.conf file.

sudo vi nginx.conf

Within the file, find the server_names_hash_bucket_size directive. Remove the # symbol to uncomment the line:

# server_names_hash_bucket_size 64;

Save and quit the file.

Check for NGINX syntax errors.

Restart NGINX: sudo systemctl restart nginx

Modify the local host’s file for testing. This will not allow other visitors to view our site correctly, but it will give us the ability to reach each site independently and test our configuration.

sudo vi /etc/hosts

Add the following entry in a new line:

192.168.56.102 knowhow.com www.knowhow.com

Save and quit the file.

This will intercept any request for knowhow.com and www.knowhow.com and send them to our server, which is what we want if we do not actually own the domains that we are using for testing purposes.

Test the website by accessing the following url in the browser of the local host machine (outside vm):

http://knowhow.com OR http://www.knowhow.com

Error: 404 Not Found

Edit the server block configuration file for knowhow.com.

In the location block, change the following:

try_files $uri $uri/ =404;

to

try_files $uri $uri/ /index.php?q=$uri&$args;

Save and quit the file. Restart NGINX server.

The first try_files directive means that if a file or directory does not exist, the web server shall throw a 404 error. The second directive redirects all requests to index.php. This is commonly used for software packages such Drupal, Joomla and Wordpress.

Test the website again: http://knowhow.com or http://www.knowhow.com

We can add as many different sites as we want on the same server, subject to performance constraints due to capacity. For each website, we need to create a separate server block file similar to knowhow.com under /etc/nginx/sites-available. For every new server block, amend the root path and server_name to host each website’s files in its separate directory structure.

Example: If we want to host an additional website called kitchen.com, the server block for that website should look something as shown below.

We must also ensure that the necessary symbolic link is created in the /etc/nginx/sites-enabled directory in order to activate the new website.

Restart the NGINX server after the new server block is enabled. For testing purposes, we need to add an additional entry in the /etc/hosts file in the local host machine.

Access the newly configured website from the browser of the local host machine: http://kitchen.com

If configured successfully, the new website should get displayed as shown below.

This completes the LEMP stack setup process on Ubuntu Linux.

Sunday, March 15, 2020

LEMP Stack Setup Guide with Firewall and FTP Configuration


Modern web applications, for several years, have been dominated by the LAMP technology stack where LAMP stands for Linux, Apache, MySQL and PHP. However, in recent years, Apache has slowly been replaced by modern, evolved and less resource-intensive web servers such as NGINX.

In keeping with latest technology trends, I decided to perform a small proof-of-concept installation and configuration in a Linux based virtual machine. The process and findings are extensively documented in the attached pdf file. I sincerely hope that this ebook shall help those who wish to setup and experiment on their own LEMP server.

The Complete LEMP Stack Setup Guide For Beginners (Download Link)

Sunday, August 11, 2019

The Complete Goldfish Tank Setup and Care Guide

Ornamental fish-keeping, as a hobby, has been around for several thousand years. Hobbyists may choose from a variety of freshwater and marine species to keep as pets in an aquarium or fish tank. It not only serves to beautify its surroundings but also acts as a great stress-reliever. An indoor water body such as an aquarium, if kept correctly, is also considered auspicious in Indian Vaastu Shastra and Chinese Feng-Shui.

Of the hundreds of species of ornamental fish available, Goldfish are the probably most popular and most loved variety. They are colourful, playful and come in various shapes. They are also relatively inexpensive to buy and are easily available at pet stores and markets. However, contrary to popular belief, Goldfish are not the easiest to keep or maintain. Although they are relatively tough and have long life-spans, they require clean water and good quality food to thrive and are, therefore, not recommended as beginner fish.

Goldfish can be segregated into two broad categories:

a) Common Goldfish - Also known as Comets, they are slim-bodied and fast swimmers. They can grow up to or more than a foot in length and best kept in outdoor ponds. They are inexpensive to buy and are much more tough than fancy goldfish; meaning, they can tolerate moderate changes in water temperature, pH, salinity and dissolved wastes.

b) Fancy Goldfish - There are more than a hundred species of fancy goldfish. The most popular ones are Fantail, Red Cap Oranda, Black Moor, Bubble Eye, Ryukin, Pear Scale, Lion Head, Ranchu and Celestial Eye to name a few. They typically have an egg-shaped body with long flowing fins although some varieties may have shorter fins, larger eyes or rounded heads. They are slow swimmers and are ideal for indoor aquariums and fish tanks. They may grow up to 8 inches and live for 5-10 years if cared for properly. However, these varieties are more expensive than the common goldfish and require very clean water and good quality food.

Goldfish, in general, are very docile and sweet-natured and bond well with other varieties of Goldfish and non-aggressive fish. However, in order to maintain compatibility with water quality requirements and feeding habits, it is best advised to keep only Goldfish in an aquarium or tank. The following list details all the items necessary for setting up a new Goldfish tank from scratch:

  1. An aquarium, preferably rectangular and made of glass, with the longest side measuring at least 2 feet in length. Goldfish are an active species and require lots of space to swim. It is recommended to provision at least 10-12 gallons of water per fancy goldfish although the ideal volume would be 20-25 gallons of water per fancy goldfish. Such a high volume of water is needed not just for swimming but also for diluting dissolved waste concentration.
  2. A high-capacity filter with a flow-rate roughly equal to 8-10 times the volume of the entire tank. Internal power filters, hang-on back filters, top filters and canisters are all suitable for a Goldfish tank. Selecting the right type would depend on the aquarium size and setup. Goldfish are messy eaters. They eat a lot and excrete a lot. Hence, the need for a high level of filtration.
  3. Filter media such as sponge, bio-balls and activated carbon.
  4. Aged and cycled fresh-water (tap water). Setting up a new tank and immediately putting fish in it is akin to torture. It is necessary to complete a fish-less cycle with the water by putting a piece of organic matter (e.g. raw shrimp) in it and letting it stand for 3-4 weeks. This will create a colony of beneficial bacteria in the water which will break-down the organic matter and complete the nitrogen cycle without harming your beloved goldfish. If possible, submerge the filter in this water so that the beneficial bacteria may colonize the filter media. This step is absolutely essential for cycling your tank and preventing unintended casualties in future.
  5. Water-proof aquarium lights, preferably full-spectrum and led-based.
  6. Thermocol or Polystyrene sheets to be placed underneath the aquarium for supporting the weight of water and to prevent cracks in the glass base.
  7. Seachem Prime or any other dechlorinating agent. Chlorine is harmful for fish as it burns their gills. If you don't have a dechlorinating solution, let the water stand overnight, uncovered, before putting it inside the tank. The dissolved chlorine shall evaporate, making the water safe for use.
  8. Seachem Cupramine or any other anti-ich treatment. This is necessary for disinfecting fish from external parasites and ich. Put your new goldfish in cupramine-treated water for at least 15-20 minutes before placing in the main tank.
  9. Good quality fish food, in the form of pellets (sinking or floating) and/or flakes. Hikari Goldfish Gold, Saki-Hikari Fancy Goldfish Colour-Enhancing, Saki-Hikari Fancy Goldfish Balance, Sinking Goldfish Excel and Hikari Oranda Gold are some good options. If you prefer a clean tank, floating pellets are the best bet although some hobbyists are of the opinion that this might cause swim bladder issues. Sinking pellets are equally good but may cause water-quality issues if left uneaten.
  10. Rock-Salt for reducing fish-stress and for treating internal parasites.
  11. Decorations, such as pebbles, gravel, porcelain show-pieces, fake plants, etc. It is recommended to keep a bare-bottom tank or one with minimal decorations for fancy goldfish such as Orandas and Pear Scales. A clean bottom will prevent accumulation of waste and aid in easy clean-up during weekly water changes.
  12. Background vinyl wallpaper to beautify your aquarium with minimum decorations.
  13. Thermometer; digital or analog to measure water temperature and observe fluctuations in the same.
  14. An air-pump, airline tubing and air-stone to oxygenate the tank or for emergency treatment of sick fish. Also stock an air-flow controller valve if you wish to control the intensity of air bubbles.
  15. Magnetic scrubber for cleaning the glass walls.
  16. Fish net to transfer the goldfish between tanks.
  17. Siphon for water-change activities.

Once the aquarium is set up and running with the goldfish in it, we need to start taking care of our pets. Maintenance does not require much time but one has to be consistent and punctual. The following list covers the most common activities:

  1. Feeding: Feed your goldfish daily, at least 2-3 times a day if they are young (less than a year old) or once, if they are adults. During each feeding, care should be taken to ensure that the goldies are not over-fed. Feed each fish the quantity of food that is roughly the size of their eye or that which can be completely eaten by each goldfish within 2 minutes. Remove any excess food from the water as it may degrade water-quality by polluting the environment. For example, you may feed a 3-inch goldfish up to 5-6 small pellets per day. Split the quantity to be fed, twice or thrice during the entire day. Slightly under-feeding shall not harm the goldfish as they are known to live without food for up to 2 weeks. However, over-feeding can cause bloating, constipation and swim-bladder issues.
  2. Water Change: At least 50% of the water should be changed every week to remove pollutants and dilute the concentration of growth-inhibiting hormones. A siphon may be used to drain the polluted water and also to vacuum the base of the tank to suck up fish-poop. However, do not remove all of the tank water as it contains beneficial bacteria and complete removal may upset the delicate nitrogen cycle of the aquarium. Refill with tap water and add a suitable dechlorinating agent such as Prime. One should be careful regarding the dosage since excess use of chemicals is harmful for fish.
  3. Salinity & pH: Add one table-spoon (3 tea-spoons) of non-iodized rock-salt for every five gallons of water. This shall reduce stress and prevent several goldfish diseases. For temporary treatment of severely sick fish, prepare a separate 5-gallon salt bath by adding 10 table-spoons (30 tea-spoons) of rock-salt for every gallon of water. Place the sick goldfish in it and observe for 5 minutes. If the goldfish act a bit odd, that is normal and is due to the high salinity. But if they roll over and cannot stay upright, remove them from the salt bath and keep them in a hospital tank with less dosage of salt or with proper medication. Goldfish do well in the pH range of 7.2 - 7.6, that is, slightly alkaline water, and care should be taken to maintain the same.
  4. Hiding Places: Goldfish sometimes need quiet places to hide. Use only blunt decorations and remove anything, including fake plants, which may tear or damage fins.
  5. Fish Behaviour: Check the behaviour of your goldfish periodically. Gasping at the top indicates a lack of dissolved oxygen. The remedy is to increase oxygen or air-bubbles with an air-pump. Bottom-sitting is a sign of stress or internal parasites. Add rock-salt or suitable medication. White-spots on the body or rubbing against glass walls may be an indication of ich. Separate the affected fish in a hospital tank and treat with salt and/or cupramine solution. Sudden jerks, spams, erratic movement or red-veins may be a sign of ammonia poisoning. In such a situation, frequent 50% water-changes may provide relief. Last but not the least, looks for signs of aggression. Although rare, aggression may sometimes be noticed due to competition arising out of lack of adequate food or lack of space due to over-stocking. The remedy would be to remove the aggressor, increase food quantity and/or reduce stocking.
  6. Light & Sound: Goldfish need at least 8 hours of daylight to stay active and maintain their colour (pigmentation). Direct sunlight is not recommended as it increases water temperature. Instead, use full-spectrum led aquarium lights to beautify your tank and aid your fish in maintaining their day-night cycle. Please note that goldfish also need to rest and/or sleep. Hence, 8 hours of darkness or shade per day is also necessary. Care must be taken to ensure that the goldfish are not subject to extremely loud noises.

Goldfish make excellent pets. They are cute, playful and come in various colours. Taking good care of them if the least that we can do. I really hope that this article shall help a lot of Goldfish owners or those who are planning to keep some as pets.

Sunday, May 5, 2019

Cyclone Fani: How India saved more than a million lives and averted a disaster of epic proportions

When a natural calamity of epic proportions strikes, humans are mostly rendered helpless. However, proper use of technology may help us prepare for the worst and minimize loss of precious lives. This was evident in the way India managed early warning and disaster relief operations and rescued more than a million people from impending disaster. Extremely Severe Cyclonic Storm Fani was the strongest tropical cyclone to strike the Indian state of Odisha since Phailin in 2013. Fani originated from a tropical depression that formed west of Sumatra in the Indian Ocean on 26th April, 2019. The Joint Typhoon Warning Center (JTWC) monitored a tropical disturbance that formed in the North Indian Ocean, and designated it with the identifier 01B. Fani slowly drifted westward, finding itself in an area conducive for strengthening. The system intensified and two days after being named, it became Cyclone Fani.

Simulated depiction of cyclonic winds, Fani
Simulated depiction of cyclonic winds, Fani

Fani moved northward and began to rapidly intensify. It became an extremely severe cyclonic storm on 30 April 2019, the first severe cyclonic storm of the season. Fani reached its peak intensity on 2nd May, as a high-end extremely severe cyclonic storm, and the equivalent of a high-end Category 4 major hurricane. Fani continued to maintain its strength up until landfall in the Indian state of Odisha on 3rd May when the coastal state witnessed torrential rain and wind-speeds reaching 200 kmph. Trees were uprooted, huts and temporary shelters blown away, vehicles over-turned, cranes toppled and buildings damaged. As people sought safety inside their homes, doors and windows were no match for Fani's might. Power-supply was cut off and transportation services were grounded. At least 14 people were reported killed and several others injured. Considering the power of the super typhoon, the number of casualties was miraculously low.

Trees uprooted by cyclone Fani, Odisha
Trees uprooted by cyclone Fani, Odisha

So, how did India manage to keep casualties at a minimum? What was different from the India of 20 years ago when it experienced a similar super-cyclone which ripped through the state of Odisha and left 10,000 people dead in its wake? The answer lay in early satellite-based meteorological forecast and warning, preemptive evacuation and speedy supply of relief materials to the affected areas. Prior to its landfall, authorities in India had moved at least a million people from Fani's projected path onto higher ground and into cyclone shelters, which is thought to have reduced the resultant death toll. The Central Government released preemptive aid to the tune of 1000 crore rupees for the coastal states and naval ships and reconnaissance aircraft were used to monitor and patrol the coastline.

Fani topples a crane
Fani topples a crane

Approximately 1.2 million people were shifted across 13 districts to the safety of 5000 cyclone shelters within a span of 24 to 36 hours. This was a tremendous achievement and required meticulous planning and herculean effort by both the state and central governments. The National Disaster Response Force (NDRF) and several other agencies were pressed into action and an operation ensued which involved 45,000 volunteers and 2,000 emergency workers.

NDRF Team for Cyclone Fani, Odisha
NDRF Team for Cyclone Fani, Odisha

Some 3 million targeted text messages were sent asking people to get to their nearest shelters and warning messages were repeatedly circulated across television and radio. The reach was more personal, and magnified several times over. Public address systems on government vehicles and auto-rickshaws moved around, telling people that they need to move. There was elaborate planning and everybody worked as a team.

Relief aid for Cyclone Fani, IAF C130J Super Hercules
Relief aid for Cyclone Fani, IAF C130J Super Hercules

Technical teams were kept on standby to repair fallen poles, broken wires and telecom lines; to move debris and fallen trees quickly to restore road connectivity. Air connectivity was restored in 36 hours. Those stranded, were air-lifted and essential supplies were air-dropped by army helicopters. The United Nations praised India for its early warning systems and its well-coordinated efforts aimed at rapid evacuation and relief.

After wrecking havoc in Odisha, Fani's convective structure rapidly degraded. The tropical storm passed through Kolkata as a cyclonic storm. On 4th May, Fani weakened to a depression, before degenerating into a well-marked low later that day and moved on to neighbouring Bangladesh. India's well coordinated efforts saved the day for a million people and goes on to prove, yet again, that technology can be and should be used for the benefit and welfare of mankind.

Sunday, April 14, 2019

Unreal Reality

According to popular definition, reality is the state or quality of having existence or substance. It also refers to events that have actually happened and those which are being perceived as happening at the moment. Therefore, reality is a state which can be perceived by the five fundamental senses, namely, sight, sound, smell, taste and touch. It is a mental construction of the inputs provided by our senses. Anything, which cannot be perceived, is usually called imaginary or unreal.

However, reality is not as simple as it seems. The more we explore, the more baffled we are at its complexity and true nature. As humans, we have all experienced the state of dreaming. Dreams are nothing but a series of events, images, ideas, emotions and sensations that flash across our mind when we are asleep. They occur involuntarily and are usually reflections of our memories and/or aspirations. However, to the observer in a state of sleep, these dreams appear as real and believable as they would to an observer who, in his state of awakened awareness, would experience the events had they actually taken place. The visual projection created by our mind may be pleasant or unpleasant but the fact is that the observer interprets the mental projection as "real" during the period of the dream. The observer experiences interaction with animate and inanimate entities during this time-frame. He may experience speaking with someone, holding hands, having food or driving his car. In his state of sleep, the observer cannot distinguish between that which is real and that which is not.

Sometimes, the emotions and sensations experienced in a dream have repercussions in the physical world as well. For example: if the observer, in his dreams, visualizes that he is falling from a roof-top or down a flight of stairs, he may experience a feeling of fright or a sense of loss of gravity. When the sensation peaks, the subject wakes up but he may find himself sweating profusely out of fright. He may also experience temporary nervousness and elevated pulse rates in this state. The question that remains is: If the dream was unreal, why did the observer experience nervousness and elevated pulse rates in his awakened state of reality? A scientific explanation would suggest that the dream influenced his mind or, rather, the brain; and the brain triggered hormonal reactions in his physical body resulting in the knee-jerk reaction. Thus, what we perceive as reality, is essentially what our brain or mind wants us to believe. If this hypothesis is true, then is it not possible that what we perceive as reality in this universe, is actually part of an elaborate dream; a dream, which our mind wants us to believe? Is it not possible that whatever we think exists, actually does not? Is it not possible that our lives are also part of an on-going dream? Is it not possible that one day, we might wake up from this elaborate dream and discover our true nature?

Ancient wisdom and spiritual thought suggests the concept of Maya or illusion to explore this possibility. The Upanishads describe the universe, and the human experience, as an interplay of Purusha (the eternal, unchanging principles, consciousness) and Prakrti (the temporary, changing material world, nature). The former manifests itself as Atman (Soul, Self), and the latter as Maya. Maya is the divine ability to create dimensional reality out of nothing. It is referred to as a wondrous and mysterious power which can turn an idea into a physical reality. When we say illusion, it does not mean that the world is not real and simply a figment of the human imagination. Maya means that the world is not as it seems; the world that one experiences is misleading as far as its true nature is concerned. The world is both real and unreal because it exists but is not what it appears to be. It is something that is constantly being made. Maya not only deceives people about the things they think they know; more basically, it limits their knowledge.

Thursday, March 28, 2019

Mission Shakti: India's ASAT test and its geopolitical implications

India announced on 27th March, 2019 that it had successfully terminated a low earth orbit (LEO) satellite in space using an indigenously developed anti-satellite missile system. The test, code-named Mission Shakti, was fully successful and achieved all parameters and met desired objectives. An ASAT test requires an extremely high degree of precision and technological capability. The test makes India the fourth country in the world after the United States, Russia and China, to acquire the strategic capability to shoot down enemy satellites in orbit.

China conducted an ASAT test in January 2007 which demonstrated the capability of shooting down satellites at an altitude of over 800 kilometres in the lower earth orbit (LEO). US was the first country to acquire the ASAT technology in 1958 followed by USSR in 1964. Anti-satellite weapons are considered to be strategic assets since they can easily cripple an enemy nation's communication links and earth-observing capabilities, thereby impacting military operations, financial transactions and broadcasting services. Much like nuclear assets, ASAT capabilities serve to act like a deterrence. The DRDO’s Ballistic Missile Defence interceptor was used in this test, which is part of India's on-going ballistic missile defence programme. Crucial support was also provided by ISRO, India's premier space research organization. The mission took only 3 minutes to complete from the time of locking on to the target satellite till the moment it was terminated.

Mission Shakti: India's ASAT Test
Mission Shakti: India's ASAT Test

The government of India has stated that it has no intention of entering into an arms race in outer space. The country has always maintained that space must be used only for peaceful purposes. The government has also stated that India is against the weaponization of outer space and supports international efforts to reinforce the safety and security of space based assets. The test was done simply to verify that India has the capability to safeguard its space assets. Care was taken to ensure that test was performed in the lower earth atmosphere. This would ensure that there was no space debris. Whatever debris was generated shall decay and fall back on to the earth's surface within a few weeks, thereby reducing the possibility of damage to other active satellites in the vicinity.

The consequences of publicly announcing an ASAT capability are far-reaching. An ASAT capability can finish a war even before it starts. It is a message to India's hostile neighbours, namely Pakistan and China, that the country can defend its space assets and, if required, eliminate enemy assets to cause massive disruption during war. It is a strategic and bold move by India and reflects a tectonic shift in the nation's military doctrine. India, is now truly ready for the space age.