Last active
September 3, 2015 03:58
-
-
Save bperin/54ed46bbfcac3b53e841 to your computer and use it in GitHub Desktop.
LAMP Install 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## update the server and then install the lamp stack | |
sudo yum update -y | |
## install PHP 55 | |
## this also installs apache as it's a dependecy in amazons version of php55 | |
sudo yum install -y php55 php55-bcmath php55-gd php55-xml php55-mbstring php55-mcrypt php55-soap php55-xml | |
## install mysql | |
#sudo yum install -y mysql-server | |
## install git | |
sudo yum install -y git | |
## start apache | |
sudo service httpd start | |
sudo chkconfig httpd on | |
## add a www user group | |
sudo groupadd www | |
sudo usermod -a -G www ec2-user | |
## micro instances don't come with swap files so we need to make one | |
## adding line to fstab so it's enabled on boot | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 | |
sudo mkswap /swapfile | |
sudo chmod 0600 /swapfile | |
sudo swapon /swapfile | |
sudo sed -i '$ a\/swapfile swap swap defaults 0 0' /etc/fstab | |
# reboot to force logout | |
sudo reboot | |
#!/bin/bash | |
## fix the folder permissions for the html directory | |
sudo chown -R root:www /var/www | |
sudo chmod 2775 /var/www | |
find /var/www -type d -exec sudo chmod 2775 {} + | |
find /var/www -type f -exec sudo chmod 0664 {} + | |
## fix the httpd.conf so clean urls work | |
sudo sed -i '151s/.*/ AllowOverride All/' /etc/httpd/conf/httpd.conf | |
sudo service httpd restart | |
## create a test index.php file | |
touch /var/www/html/index.php | |
echo "<?php phpinfo(); ?>" >> /var/www/html/index.php | |
## put a little message saying where to view the phpinfo page | |
sudo yum -y install cloud-utils | |
echo "Take a look at the following IP to see your PHP config" | |
ec2-metadata --public-ipv4 | |
#get fuel oil | |
sudo curl get.fuelphp.com/oil | sh | |
cd /var/www/ | |
#clone repo | |
sudo git clone --recursive https://github.com/bperin/hackysnap_api | |
sudo chmod -R 777 /var/www/hackysnap_api/fuel/app/logs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment