Last active
September 2, 2019 07:40
-
-
Save kenmoini/6c71865138e8ec8f030a8a5b3faf163e to your computer and use it in GitHub Desktop.
Set up an Ubuntu 18.04 LTS system as close to as possible to a base Laravel Homestead configuration (no go/wp-cli/etc just stuff for Laravel)
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 | |
# Install... | |
## Git | |
## nginx | |
## composer | |
## Redis | |
## MariaDB | |
## Memcached | |
sudo apt-get install git nginx mariadb-server mariadb-client composer curl ufw redis-server memcached -y | |
# Install PHP stuff | |
sudo apt-get install php7.2-bcmath php7.2-fpm php7.2-mbstring php7.2-soap php7.2-zip php-memcached php-mongodb php-oauth php-redis php-ssh2 php-uuid php-memcache php-mailparse php-imagick php-libsodium php7.2-xml php7.2-xmlrpc php7.2-sqlite3 php7.2 php7.2-cli php7.2-gd php7.2-json php7.2-mysql php7.2-common php-pear php7.2-curl -y | |
#if Desktop dev environment, uncomment the following two lines: | |
#snap install atom gitkraken chromium | |
#sudo apt-get install guake -y | |
#Start MariaDB | |
sudo systemctl stop mariadb.service | |
sudo systemctl start mariadb.service | |
sudo systemctl enable mariadb.service | |
#Configure mariadb | |
sudo mysql_secure_installation | |
sudo echo "CREATE DATABASE homestead;CREATE USER 'homestead'@'localhost';GRANT ALL PRIVILEGES ON homestead.* To 'homestead'@'localhost' IDENTIFIED BY 'secret';FLUSH PRIVILEGES;" | sudo mysql -u root | |
#Configure Redis | |
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.bak | |
sudo sed 's/^supervised.*/supervised systemd/' /etc/redis/redis.conf >> /etc/redis/redis.conf.new | |
sudo cp /etc/redis/redis.conf.new /etc/redis/redis.conf | |
sudo systemctl restart redis.service | |
#Install NodeJS | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - | |
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update | |
sudo apt-get install nodejs gcc g++ make yarn -y | |
echo 'if [ -d "$HOME/.config/composer/vendor/bin" ] ; then' >> ~/.profile | |
echo ' PATH="$HOME/.config/composer/vendor/bin:$PATH"' >> ~/.profile | |
echo 'fi' >> ~/.profile | |
#Configure PHP | |
wget https://gist.githubusercontent.com/kenmoini/cc34bd0ce518c1f6334a80fa6a8041f1/raw/22dc7510046b141b09bdb0bb24af711a16b62b3f/php.ini | |
sudo cp /etc/php/7.2/fpm/php.ini /etc/php/7.2/fpm/php.ini.bak | |
sudo cp php.ini /etc/php/7.2/fpm/php.ini | |
#Configure Nginx | |
wget https://gist.githubusercontent.com/kenmoini/1a953c033a617ee043b55f1714b2baaa/raw/54e2c39da9094004f4f038f5196771f0d54f78d8/nginx.conf | |
wget https://gist.githubusercontent.com/kenmoini/76848b40104f17ba80864f4e32726acb/raw/9e19c0fead9e60c5daa231aca64d2306d1eb272b/default | |
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak | |
sudo cp nginx.conf /etc/nginx/nginx.conf | |
sudo cp default /etc/nginx/sites-available/default | |
sudo systemctl reload php7.2-fpm | |
sudo systemctl reload nginx | |
#Install Certbot | |
sudo add-apt-repository ppa:certbot/certbot -y | |
sudo apt install python-certbot-nginx -y | |
#Setup composer/laravel | |
composer global require laravel/installer | |
#Set firewall bits | |
sudo ufw enable | |
sudo ufw allow 'Nginx HTTP' | |
sudo ufw allow 'Nginx HTTPS' | |
sudo ufw allow 'ssh' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment