Sunday, June 24, 2018

How did I replicate my aws ec2 instance

First, select instance that you want to replicate in aws web and go to actions->image->create image.
And then I increased Size(GiB) of default instance volume from 8 to 20 just to be sure that replica has enough space.

Give image name, and click on Create Image button. So after that AMI is created and it takes some time so you can see the progress on link that was given on prompt window.

Finally, you can go to Intances window, create a new instance using the AMI you just created.

When I created a new instance, I created a new security group for that instance.
Or can I choose the same security group that I used for the original instance?

Checklist:

1.
I commented out a line

Redirect / https://whatevermydomain.com

in /etc/apache2/sites-available/000-default.conf. Because it was redirecting requests to my replica server to the original server at https://whatevermydomain.com.

2.
I re-associated an elastic ip address that was being used by a stopped instance previously to my newly created replica. I went to "Elastic IPs" on aws web -> Choose ip that I want to re-associate -> click mouse 2 on it -> "associate address" and choose instance that I want to associate it to. Don't forget to check "Allow Elastic IP to be reassociated if already attached" if it is used by another instance.

Thursday, November 16, 2017

How to put a currently running process in foreground to background and detach from ownership

1. Ctrl + Z to stop (pause) the program and get back to the shell.
2. bg to run it in background.
3. disown -h [job-spec] where [job-spec] is the job number (like %1 for the first running job; find about your number with the jobs command) so that the job isn't killed when the terminal closes.
example: disown -h %1

Tuesday, August 15, 2017

How to install python 2 alongside python 3 with conda and install opencv

Create a new environment names pyth2 for installing python2. 

conda create --name pyth2 python=2

 
To check envs:

conda info --envs


After that you can switch environment in conda by:


In Windows: 

activate pyth2

In Linux: 


source activate pyth2
 
Then if you want to install opencv in pyth2 environment, run: 


conda install -c https://conda.anaconda.org/menpo opencv3 

 
To check installation:


import cv2 cv2.__version__

Sunday, June 25, 2017

How to install phpmyadmin in linux

To install phpmyadmin, run the following commands:

sudo apt-get update
sudo apt-get install phpmyadmin

After that if it is still not possible to access phpmyadmin via
http://localhost/phpmyadmin

Add a following  line to a file: /etc/apache2/apache2.conf

Include /etc/phpmyadmin/apache.conf

And restart the server by:

sudo service apache2 restart

Source:https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04

Monday, June 19, 2017

How to connect to Mariadb with Phpmyadmin

A new debian 9 comes with Mariadb as a substitute of mysql by default. If you don't have the installation of refer to https://mariadb.com/downloads.

Next, you have to install phpmyadmin. Since I am on debian, my command is:

sudo apt-get install phpmyadmin

After that, include the following line in /etc/apache2/apache2.conf.

/etc/phpmyadmin/apache.conf