User Tools

Site Tools


cloudhosting:amazonaws

A brain-dump for setting up a Amazon AWS micro server for various uses.

Initial setup will be a build environment for various applications:

  • NGINX w/FastCGI PHP
    • SMF
    • Magento
    • OpenCart
    • General Development
  • FreeSwitch

CLEANUP with MARKUP BELOW

ami-6fa27506 - micro edition 0.02/hr  ~ 15-20/mo
8GB EBS (0.10/GB/mo + transactions)
x86_64 ubuntu
592MB Ram

apt-get update
apt-get upgrade
apt-get install php5-cli php5-common php5-gd php5-mysql php5-pgsql php5-sqlite sqlite3 php5-cgi spawn-fcgi

apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-common postgresql-plpython-9.1 postgresql-server-dev-9.1 postgresql-plperl-9.1 postgresql-pltcl-9.1 libpq-dev


#if errors like
#PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/sqlite.so' - /usr/lib/php5/20090626/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
rm /etc/php5/cli/conf.d/sqlite.ini 

# for building nginx / freeswitch
apt-get install build-essential subversion git-core
apt-get install libpcre3 libpcre3-dev libpcrecpp0 zlib1g-dev libssl-dev


#nginx
wget http://nginx.org/download/nginx-1.2.0.tar.gz
tar -zxf nginx-1.2.0.tar.gz
cd nginx-1.2.0
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
make; make install

# create a user for nginx
adduser nginx

#change ownership of the nginx directory 
chown -R nginx.nginx /usr/local/nginx
chmod -R 750 /usr/local/nginx
chown -R nginx.nginx /usr/local/bin/nginx
chmod -R 750 /usr/local/bin/nginx

#edit /usr/local/nginx/conf/nginx.conf
# edit user to run as
user nginx;
# add to server->location
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name;
            include        fastcgi_params;
        }
        
#run
/usr/local/bin/nginx
/usr/local/nginx/html
PID: /usr/local/nginx/logs/nginx.pid
kill `cat /usr/local/nginx/logs/nginx.pid`

nginx-1.2.0.tar.gz

Resource:
http://articles.slicehost.com/2008/5/13/ubuntu-hardy-installing-nginx-from-source
http://articles.slicehost.com/2008/5/13/ubuntu-hardy-adding-an-nginx-init-script



#freeswitch
apt-get install libncurses5 libncurses5-dev libjpeg-dev unixodbc unixodbc-dev autoconf automake libtool make pkg-config
apt-get install libcurl4-openssl-dev libexpat1-dev libgnutls-dev libtiff4-dev libx11-dev unixodbc-dev libssl-dev python2.6-dev zlib1g-dev libzrtpcpp-dev libasound2-dev libogg-dev libvorbis-dev libperl-dev libgdbm-dev libdb-dev python-dev uuid-dev bison snmp libsnmp-dev

# 224M checkout
git clone git://git.freeswitch.org/freeswitch.git
cd freeswitch
./bootstrap.sh
# edit modules.conf, needs postgres if you enable pg_csv



./configure; make; make all install cd-sounds-install cd-moh-install
# !!! virtual memory exhausted: Cannot allocate memory !!!
# we need to make more temporary swap space!!!
#!/bin/bash
dd if=/dev/zero of=/root/fakeswap bs=1024 count=1048576 
mkswap /root/fakeswap 
swapon /root/fakeswap 

#!/bin/bash
swapoff /root/fakeswap
rm /root/fakeswap

# rerun config/make/make install


#run
/usr/local/freeswitch/bin/freeswitch



# Magento
http://wiki.nginx.org/Magento
http://wiki.nginx.org/PHPFcgiExample

#OpenCart
apt-get install mysql-server mysql-client curl unzip
http://www.opencart.com/
wget http://opencart.googlecode.com/files/opencart_v1.5.1.3.1.zip
cloudhosting/amazonaws.txt · Last modified: 2012.10.13 18:51 (external edit)