Skip to content

Instantly share code, notes, and snippets.

@makmac213
Last active October 27, 2017 08:14
Show Gist options
  • Save makmac213/c340469d7274ebd06902 to your computer and use it in GitHub Desktop.
Save makmac213/c340469d7274ebd06902 to your computer and use it in GitHub Desktop.
AWS Instance Setup Guide
# Setup apache2 mysql php
$ sudo apt-get install tasksel
$ sudo tasksel install lamp-server
# python setup tools
$ sudo apt-get install python-setuptools
$ sudo apt-get install python-pip
# generate ssh key
$ ssh-keygen -t rsa -C "your.email@domain.com"
# git
$ sudo apt-get install git
-
# add user
$ sudo add user username
# change user passwd
# you will need to do this to allow/unlock user
# to ssh using public key
$ passwd <username>
# edit sudoers
$ sudo visudo
# i set up on /var/www
# always remember to change owner (chown)
# /var/www/ on ec2 when running git clone
# sites available
<VirtualHost *:80>
ServerName yourdomain.no
DocumentRoot /var/www/your_project
WSGIScriptAlias / /var/www/your_project/wsgi.py
Alias /static/ /var/www/your_project/your_project/assets/
Alias /media/ /var/www/your_project/your_project/media/
<Directory /var/www/your_project/your_project/>
Require all granted
</Directory>
</VirtualHost>
# install python mysql
$ sudo apt-get install python-mysqldb
$ sudo apt-get install build-essential python-dev libmysqlclient-dev
# postgres
$ sudo apt-get build-dep python-psycopg2
$ pip install psycopg2
# mongodb
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# install django-mongodb-engine (as of the moment 1.7.1 is not supported)
# https://django-mongodb-engine.readthedocs.org/en/latest/topics/setup.html
$ pip install git+https://github.com/django-nonrel/django@nonrel-1.5
$ pip install git+https://github.com/django-nonrel/djangotoolbox
$ pip install git+https://github.com/django-nonrel/mongodb-engine
# install requirements.txt
$ pip install -r requirements.txt
# create database
$ CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;
# ImportError: Could not find the GEOS library (tried "geos_c", "GEOS"). Try setting GEOS_LIBRARY_PATH in your settings.
sudo apt-get install binutils libproj-dev gdal-bin
# install mod_wsgi
$ sudo aptitude install libapache2-mod-wsgi
# install node.js
$ sudo apt-get install nodejs
$ sudo apt-get install npm
# https://www.npmjs.org/package/forever
# $ sudo npm install forever -g
# redis
$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ make test
# if you get error "You need tcl 8.5 or newer in order to run the Redis test"
$ apt-get install tcl
# It is a good idea to copy both the Redis server and the command line interface in proper places, either manually using the following # commands:
$ sudo cp src/redis-server /usr/local/bin/
$ sudo cp src/redis-cli /usr/local/bin/
# Or just using make install.
# postgresql
# sudo apt-get install postgresql postgresql-contrib
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment