#CentOS Server on EC2 with Git Deployment
##Use Rightscale CentOS Community Server Image ami-09496d4c
###Step 1: SSH into the server and do the following
BE SURE YOU PERFORM THESE ACTIONS AS ROOT OR SU
$ yum update
$ yum install git mysql mysql-libs httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-mcrypt
$ echo 'service httpd restart' >> /etc/rc.local
$ ssh-keygen -t rsa -C "[email protected]"
$ useradd git
$ passwd git
$ cd /home/git
$ mkdir .ssh
$ cat ~/.ssh/id_rsa.pub >> .ssh/authorized_keys
$ chown git:git .ssh
$ chown git:git .ssh/authorized_keys
$ chown git:git /var/www/html/
###Step 2: Setup the remote repository on the EC2 Instance
$ ssh [email protected]
$ mkdir my_project.git
$ cd my_project.git
$ git init --bare
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/html git checkout -f
$ chmod +x hooks/post-receive
###Step 3: On local machine $ cd my_project $ git init $ git add * $ git commit -m "initial commit" $ git remote add aws [email protected]:my_project.git $ git push aws master