Last active
January 30, 2017 15:52
-
-
Save vspek/6660b0ca2c509ff0fadd to your computer and use it in GitHub Desktop.
Codeanywhere shell script to install Laravel 5 on Laravel 4 dev machine
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
#!/usr/bin/env bash | |
# make file executable chmod +x upgrade_laravel4.sh | |
sudo apt-get update | |
#sudo apt-get upgrade -y | |
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y | |
sudo /usr/local/bin/composer self-update | |
composer global require "laravel/installer=~1.1" | |
#echo "PATH=~/.composer/vendor/bin:\$PATH" >> $HOME/.profile | |
printf "\nPATH=\"\$HOME/.composer/vendor/bin:\$PATH\"\n" | tee -a $HOME/.profile | |
#move current files to workspaceold directory | |
mv $HOME/workspace $HOME/workspaceold | |
#install new laravel 5 app | |
cd $HOME | |
$HOME/.composer/vendor/bin/laravel new workspace | |
#set the correct permissions | |
cd $HOME/workspace | |
sudo chmod -R 775 storage | |
sudo chmod -R 775 bootstrap/cache | |
sudo chown -R cabox:www-data storage | |
sudo chown -R cabox:www-data bootstrap/cache | |
#set up the homestead user and database | |
mysql -u root -e "CREATE USER 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret';" | |
mysql -u root -e "GRANT ALL ON *.* TO 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;" | |
mysql -u root -e "GRANT ALL ON *.* TO 'homestead'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;" | |
mysql -u root -e "FLUSH PRIVILEGES;" | |
mysql -uhomestead -psecret -e "CREATE DATABASE homestead DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"; | |
sudo service mysql restart | |
#add /public after workspace for documentroot | |
sudo sed -i 's/workspace/workspace\/public/' /etc/apache2/sites-available/000-default.conf | |
sudo service apache2 restart | |
#make old files accessible as a symlink | |
ln -s $HOME/workspaceold $HOME/workspace/workspaceold | |
# Install Node | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
sudo apt-get install -y nodejs | |
sudo /usr/bin/npm install -g grunt-cli | |
sudo /usr/bin/npm install -g gulp | |
sudo /usr/bin/npm install -g bower | |
#install dependies in laravel project | |
cd $HOME/workspace | |
sudo /usr/bin/npm install | |
# notifications don't work, so disable them | |
echo "export DISABLE_NOTIFIER=true" >> $HOME/.profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment