Creating and using virtualenv

To create a virtualenv, run


On Ubuntu 18, this command will create virtualenv with Python 2.7.

To create virtualenv with Python 3, run

Here “venv” is my virtualenv name.

python3 virtualenv

To activate virtialenv, go to the folder where your virtialenv folder is present, then run

You will see name of your virtualenv on the command promt. To exit out of virtualenv, run

This can be run from any folder.

gunicorn behind Apache web server

gunicorn is a python application server used to run python applications in production. This is normally run behind web servers like nginx or apache.

To configre gunicorn behind apache, enable following apache modules.

Restart apache web server

For web site running pythin application, add a virtual host like following.

run same command on multiple tmux panes

If you want to run same command on multiple servers, you can use tmux synchronize-panes feature. This will be useful when you need to setup multiple servers, say install nginx/php/mysql on multiple servers.

You can create multiple panes in tmux. SSH into each of the servers from these panes. Now run

Now type

Whatever command you run on one of the pane will be executed on all panes. Be careful when you run server specific commands.

tmux create new window on current directory

When you start a new window or split pane on tmux, it always start with the directory from where you run tmux command.

I prefer it start with current working directory of active tmux window. To do this, edit file


Auto Attach to tmux session on SSH

To start tmux and attach to existing connection on SSH in, edit file


Method 2

You can use following command when connecting to remote sevrer.

Install MongoDB 4.0 on CentOS 7

To install MongoDB 4.0 (for other versions, see release note) on CentOS 7, create file

Add content

Install MongoDB with

Enable MongoDB start on boot

Start Mongo DB with

To see mongoDB version, run

To see if mongoDB running

Or use