Setup EC2 for Production using Ubuntu

Setup EC2 for Production using Ubuntu

Here is full guide how to setup EC2 for production using Ubuntu. I use server for hosting many frameworks stacks start from PHP, Ptyhon and Nodejs.

1. Install default development packages

1
sudo apt-get install git-core curl build-essential openssl libssl-dev pkg-config python-dev libxml2 libxml2-dev libxslt1-dev libbz2-dev libssl-dev p7zip-full unzip unace unp bzip2 gzip patch bind9 apache2 haproxy subversion git -y nmap libmysqlclient-dev libmysqlclient-dev libmysqlclient18

2. Install LAMPP

1
sudo apt-get install nginx php5-fpm php5-mysql mysql-server php5-mysql phpmyadmin apache2-threaded-dev php5-dev php-pear php5 libapache2-mod-wsgi

3. Setup Python and Django Environment

1
2
3
4
sudo apt-get install python-pip python-setuptools libjpeg-dev libjpeg8-dev libpng3  libfreetype6-dev imagemagick
sudo pip install virtualenv
sudo pip install virtualenvwrapper
mkvirtualenv --no-site-packages --distribute production

Edit ~/.bashrc

1
2
3
4
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME # Tell pip to create its virtualenvs in $WORKON_HOME.
export PIP_RESPECT_VIRTUALENV=true # Tell pip to automatically use the currently active virtualenv.

Install PIP

1
sudo pip install PIL  --allow-unverified PIL --allow-all-external

For virtualhost, for new Apache, make sure virtualhost have .conf extensions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.