Skip to content

Instantly share code, notes, and snippets.

@vallamost
Last active February 25, 2018 04:26
Show Gist options
  • Save vallamost/13e327b35612bb113fb7e1296b542935 to your computer and use it in GitHub Desktop.
Save vallamost/13e327b35612bb113fb7e1296b542935 to your computer and use it in GitHub Desktop.
Set up a LAMP stack on a new install of AMZN Linux v1
#What this does:
#updates centos distribution
#install apache, php7, mysql5.6, phpmysql, add apache and mysql to bootup, start apache and mysql, run secure mysql install. add ec2-user to apache users group. change the ownership of /var/www to ec2-user:apache. create vhost file
sudo yum update -y && sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd && sudo service httpd start && sudo chkconfig httpd on && sudo usermod -a -G apache ec2-user && sudo chown -R ec2-user:apache /var/www && sudo chmod 2775 /var/www && find /var/www -type f -exec sudo chmod 0664 {} \; && sudo service mysqld start && sudo chkconfig mysqld on && sudo mysql_secure_installation && sudo mkdir /etc/httpd/sites-available && sudo mkdir /etc/httpd/sites-enabled && echo "<VirtualHost *:80>
ServerName clickbuysmile.com
ServerAlias clickbuysmile.com
DocumentRoot "${INSTALL_DIR}/www/clickbuysmile.com"
ErrorLog ${APACHE_LOG_DIR}/clickbuysmile.com/error.log
CustomLog ${APACHE_LOG_DIR}/clickbuysmile.com/access.log combined
<Directory "${INSTALL_DIR}/www/clickbuysmile.com">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
</VirtualHost>" | sudo tee --append /etc/httpd/sites-available/clickbuysmile.conf && sudo ln -s /etc/httpd/sites-available/clickbuysmile.conf /etc/httpd/sites-enabled/clickbuysmile.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment