Last active
November 22, 2016 21:52
-
-
Save samdoidge/55e4d3332448cc7f2f9a2cbe1124c247 to your computer and use it in GitHub Desktop.
Setup a DigitalOcean LAMP 16.04 image ready for Laravel. Creates a swap file, generates ssh key, installs required packages and composer.
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
# Run with the following: | |
# curl -s https://gist.githubusercontent.com/samdoidge/55e4d3332448cc7f2f9a2cbe1124c247/raw/7c434cabc84a550dbdb95f2fa4c6ce129e70475a/ubuntu-lamp-laravel-setup.sh | bash -s 1g | |
# Last argument is swapfile size. 1g = 1 gigabyte. | |
set -e | |
sudo fallocate -l $1 /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
echo "Swap file of size $1 created." | |
# Create ssh key | |
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa | |
# Install required packages for Laravel app | |
sudo apt-get -y install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0 | |
sudo apt-get -y install php-curl | |
sudo systemctl restart apache2 | |
# Install Composer | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment