Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Last active December 1, 2019 17:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zanematthew/6230817 to your computer and use it in GitHub Desktop.
Save zanematthew/6230817 to your computer and use it in GitHub Desktop.
My shell script for creating a Vagrant 64bit development server
#!/usr/bin/env bash
echo "Running boostrap.sh..."
echo "+---------------------------------------------------+"
echo "| Update apt-get |"
echo "+---------------------------------------------------+"
apt-get update
echo "+---------------------------------------------------+"
echo "| Installing aapache2 |"
echo "| setting /vagrant to web root |"
echo "+---------------------------------------------------+"
apt-get install -y apache2
rm -rf /var/www
ln -fs /vagrant /var/www
# Install ruby gems
echo "+---------------------------------------------------+"
echo "| Installing Capistrano |"
echo "| capistrano |"
echo "| capistrano-ext |"
echo "| railsless-deploy |"
echo "+---------------------------------------------------+"
gem install capistrano capistrano-ext railsless-deploy
echo "+---------------------------------------------------+"
echo "| Installing expect |"
echo "+---------------------------------------------------+"
apt-get install -y expect
# password="demo1234"
echo "+---------------------------------------------------+"
echo "| Installing mysql |"
echo "| libapache2-mod-auth-mysql |"
echo "| php5-mysql |"
echo "| mysql-server |"
echo "+---------------------------------------------------+"
VAR=$(expect -c '
spawn apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
expect "New password for the MySQL \"root\" user:"
send "demo1234\r"
expect "Repeat password for the MySQL \"root\" user:"
send "demo1234\r"
expect eof
')
echo "$VAR"
echo "+---------------------------------------------------+"
echo "| Starting mysql db |"
echo "+---------------------------------------------------+"
mysql_install_db
echo "+---------------------------------------------------+"
echo "| Run mysql secure install |"
echo "+---------------------------------------------------+"
VARA=$(expect -c '
spawn /usr/bin/mysql_secure_installation
expect "Enter current password for root (enter for none):"
send "demo1234\r"
expect "Change the root password?"
send "n\r"
expect "Remove anonymous users?"
send "y\r"
expect "Disallow root login remotely?"
send "y\r"
expect "Remove test database and access to it?"
send "y\r"
expect "Reload privilege tables now?"
send "y\r"
expect eof
')
echo "$VARA"
echo "+---------------------------------------------------+"
echo "| Installing php5 |"
echo "| php5 |"
echo "| libapache2-mod-php5 |"
echo "| php5-mcrypt |"
echo "+---------------------------------------------------+"
apt-get install -y php5 libapache2-mod-php5 php5-mcrypt
echo "+---------------------------------------------------+"
echo "| Installing the following PHP modules |"
echo "| php5-cli |"
echo "| php5-curl |"
echo "| php5-gd |"
echo "| php5-mysql |"
echo "| service apache2 restart |"
echo "+---------------------------------------------------+"
apt-get install -y php5-cli php5-curl php5-gd php5-mysql
echo "+---------------------------------------------------+"
echo "| Restarting apache2 |"
echo "+---------------------------------------------------+"
service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment