Hello.
Thanks for your replies.
I got it working.
this is my new shell script.
<code>
#!/bin/bash
cat /vagrant/shell/self-promotion.txt
# Update the box
# --------------
# Downloads the package lists from the repositories
# and "updates" them to get information on the newest
# versions of packages and their dependencies
apt-get update
# Install Vim
apt-get install -y vim
# Apache
# ------
# Install
apt-get install -y apache2
# Remove /var/www default
rm -rf /var/www
# Symlink /vagrant to /var/www
ln -fs /vagrant /var/www
# Add ServerName to httpd.conf
echo "ServerName localhost" > /etc/apache2/httpd.conf
# Setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
DocumentRoot "/vagrant/public"
ServerName localhost
<Directory "/vagrant/public">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
Satisfy Any
</Directory>
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-enabled/000-default
# Enable mod_rewrite
a2enmod rewrite
# Restart apache
service apache2 restart
# Mysql
# -----
# Ignore the post install questions
export DEBIAN_FRONTEND=noninteractive
# Install MySQL quietly
apt-get -q -y install mysql-server-5.5
# PHP 5.5
# -------
apt-get install -y php5 libapache2-mod-php5
# Update
apt-get update
# httpd.conf setup
echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Restart apache
service apache2 restart
# PHP stuff
# ---------
# Command-Line Interpreter
apt-get install -y php5-cli
# MySQL database connections directly from PHP
apt-get install -y php5-mysql
# cURL is a library for getting files from FTP, GOPHER, HTTP server
apt-get install -y php5-curl
# Module for MCrypt functions in PHP
apt-get install -y php5-mcrypt
# GD
apt-get install -y php5-gd
# Pear
apt-get install -y php-pear
# cURL
# ----
apt-get install -y curl
# Restart apache
service apache2 restart
# Git
# ---
apt-get install git-core
# Install Composer
# ----------------
curl -s
https://getcomposer.org/installer | php
# Make Composer available globally
mv composer.phar /usr/local/bin/composer
</code>