Skip to content

Instantly share code, notes, and snippets.

@Trexology
Last active February 14, 2021 16:47
Show Gist options
  • Save Trexology/4586cde1bbf78816e1abb8cb3e0de4a5 to your computer and use it in GitHub Desktop.
Save Trexology/4586cde1bbf78816e1abb8cb3e0de4a5 to your computer and use it in GitHub Desktop.
Sample ec2-LAMP installation script
#!/usr/bin/env bash
sudo yum update -y
sudo yum install -y httpd24 git openssl-devel memcache mod24_ssl mysql
sudo yum install -y php56 php56-gd php56-mbstring php56-mcrypt php56-xmlrpc php56-soap php56-intl php56-xml php56-mysqlnd php56-bcmath php-pear php56-devel php56-fpm
#sudo yum install -y wqy-zenhei-fonts-0.9.45-3.2.amzn1 # For Chinese fonts
sudo yum-config-manager --enable epel
sudo pecl install uploadprogress # For drupal
sudo service httpd start
sudo chkconfig httpd on
sudo groupadd www
sudo usermod -a -G www ec2-user
sudo usermod -a -G www apache
sudo chown -R apache:www /var/www
echo '<?php phpinfo(); ?>' | sudo tee --append /var/www/html/phpinfo.php
echo 'LC_ALL="en_US.utf8"' | sudo tee --append /etc/environment
echo 'set number' | sudo tee --append /home/ec2-user/.vimrc
echo 'set number' | sudo tee --append ~/.vimrc
sudo yum install -y gcc-c++ make
cd /var/www/html/ # Download automatic-bitbucket-deploy.git
sudo git clone https://[email protected]/lilliputten/automatic-bitbucket-deploy.git
cd automatic-bitbucket-deploy/
sudo cp config.sample.php config.php
cd ~
curl -L -o ssl_ssh.zip https://www.dropbox.com/s/nqh95p8a8qdoz3k/upload%20sample.zip?dl=1 # Download SSH/SSL Config
unzip ssl_ssh.zip
cd ssl_ssh.zip
sudo sh setup.sh
cd ~
sudo curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer
sudo ln -s /usr/local/bin/composer /usr/bin/composer
sudo rpm -Uvh https://rpm.nodesource.com/pub_4.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm # Install the repository
sudo yum install -y nodejs # Install NodeJS
sudo npm install -g bower
# sudo composer global require drush/drush:dev-master
sudo sed -i '11 s/.*/PATH="$HOME/.composer/vendor/bin:$PATH"/' ~/.bash_profile
source ~/.bash_profile
#sudo yum install freeradius-mysql freeradius-utils #freeradius 2.2~
sudo easy_install supervisor # installing supervisor
sudo mkdir /etc/supervisor # check https://laravel.com/docs/5.1/queues#supervisor-configuration (sudo vim /etc/supervisor/supervisord.conf)
curl -L https://gist.githubusercontent.com/Trexology/6bd490d69f8f5682e12470c83dbb140f/raw/f544906a9cd4080ccdc8262f4790f588de931530/supervisord.sh > /etc/init.d/supervisord && chmod +x /etc/init.d/supervisord
/etc/init.d/supervisord start
chkconfig --add supervisord
chkconfig supervisord on
#Google mod_pagespeed
cd /home/ec2-user
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
sudo yum install at
sudo rpm -U mod-pagespeed-*.rpm
sudo service httpd restart
#Install centos.repo
curl -L https://gist.githubusercontent.com/Trexology/25d3cab0072c8afe99c7f5abbcdaf227/raw/9d196d7c68a7397c9fe636f175f141ddf2bfbfa4/centos.repo > /etc/yum.repos.d/centos.repo
sudo yum-config-manager --enable centos
sudo yum groupinstall -y "Chinese Support"
#pthreads installation
pecl download pthreads-2.0.10
tar zxvf pthreads-2.0.10.tgz
cd pthreads-2.0.10
zts-phpize
./configure --with-php-config=/usr/bin/zts-php-config-5.6
make
sudo cp modules/pthreads.so /usr/lib64/php-zts/5.6/modules/
echo 'extension = pthreads.so' | sudo tee --append /etc/php-zts-5.6.d/pthreads.ini
sudo vim /etc/httpd/conf.modules.d/00-mpm.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment