Skip to content

Instantly share code, notes, and snippets.

@tjoskar
Last active August 29, 2015 13:56
Show Gist options
  • Save tjoskar/9036402 to your computer and use it in GitHub Desktop.
Save tjoskar/9036402 to your computer and use it in GitHub Desktop.
Install files for my vagrant box. Based on Vaprobash
# PHP
alias art="php artisan"
# Git
alias commitmsg='curl -s http://whatthecommit.com/index.txt'
# Shortcuts
alias v="cd /vagrant"
alias cl='clear'
alias df='df -h'
# Find by name
alias f="find . -name"
# ls
alias ls='ls -alGh --color'
alias lsd="ls -lFG --color | grep '^d'"
# Get week number
alias week='date +%V'
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin"
#!/usr/bin/env bash
echo ">>> Installing Apache Server"
sudo apt-get install -y apache2
sudo a2enmod rewrite actions
echo ">>> Download helpscript"
curl https://gist.github.com/fideloper/2710970/raw/vhost.sh > vhost
sudo chmod guo+x vhost
sudo mv vhost /usr/local/bin
#!/usr/bin/env bash
echo ">>> Installing Base Packages"
# Update
apt-get update
# Install base packages
apt-get install -y git-core ack-grep vim tmux curl wget build-essential python-software-properties
# Git Config and set Owner
curl https://raw2.github.com/tjoskar/dotfiles/master/home/.gitconfig > /home/vagrant/.gitconfig
chown vagrant:vagrant /home/vagrant/.gitconfig
#!/usr/bin/env bash
php -v > /dev/null 2>&1
PHP_IS_INSTALLED=$?
if [[ $PHP_IS_INSTALLED -ne 0 ]]; then
echo "!!! Installing composer stopped!"
echo " Make sure you install php first!"
exit 0
fi
# Test if Composer is installed
composer -v > /dev/null 2>&1
COMPOSER_IS_INSTALLED=$?
# Retrieve the Global Composer Packages, if any are given
COMPOSER_PACKAGES=($@)
# True, if composer is not installed
if [[ $COMPOSER_IS_INSTALLED -ne 0 ]]; then
echo ">>> Installing Composer"
# Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
else
echo ">>> Updating Composer"
# Update Composer
composer self-update
fi
#!/usr/bin/env bash
echo ">>> Installing MySQL Server"
# Install MySQL without password prompt
# Set username and password to 'root'
debconf-set-selections <<< "mysql-server mysql-server/root_password password root"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password root"
# Install MySQL Server
apt-get install -y mysql-server
sudo sed -i "s/bind-address.*=.*/bind-address=0.0.0.0/" /etc/mysql/my.cnf
#!/usr/bin/env bash
echo ">>> Installing nodeJS"
add-apt-repository -y ppa:chris-lea/node.js
apt-get update
apt-get install -y nodejs
[ -f /usr/local/bin/node ] && mv /usr/local/bin/node /usr/local/bin/node_old
[ -f /usr/bin/node ] && mv /usr/bin/node /usr/bin/node_old
ln -s /usr/bin/nodejs /usr/bin/node
npm install -g grunt-cli
npm install -g bower
echo ">>> Installing PHP"
add-apt-repository -y ppa:ondrej/php5
apt-get update
# Install PHP
apt-get install -y php5 php5-cli php5-mysql php5-curl php5-gd php5-gmp php5-mcrypt php5-xdebug php5-memcached php5-imagick
# xdebug Config
cat > /etc/php5/mods-available/xdebug.ini << EOF
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
# PHP Error Reporting Config
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/cli/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/cli/php.ini
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
#!/usr/bin/env bash
echo ">>> Installing Oh-My-Zsh"
# Install zsh
apt-get install -y zsh
# Install oh-my-zsh
su - vagrant -c 'wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh'
# Add /sbin to PATH
# sudo sed -i 's=:/bin:=:/bin:/sbin:=' /home/vagrant/.zshrc
# Change vagrant user's default shell
chsh vagrant -s $(which zsh);
cd /home/vagrant/
rm .zshrc
wget https://raw2.github.com/tjoskar/dotfiles/master/home/.zshrc
sed -i 's/ZSH_THEME="cloud"/ZSH_THEME="robbyrussell"/' .zshrc
wget https://gist.github.com/tjoskar/9036402/raw/.aliases
wget https://gist.github.com/tjoskar/9036402/raw/.exports
rm .gitconfig
wget https://raw2.github.com/tjoskar/dotfiles/master/home/.gitconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment