-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvagrant-setup
125 lines (104 loc) · 3.36 KB
/
vagrant-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/env bash
update_apt() {
sudo apt-get update > /dev/null
}
install_with_apt() {
update_apt
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install $1
}
installed_with_apt() {
sudo dpkg -s $1 | grep "Status: install ok" > /dev/null
}
new_install_with_apt() {
if installed_with_apt $1; then
echo "$1 is already installed"
else
install_with_apt $1
fi
}
write_file() {
sudo cat > $1
}
download_to_file() {
if [ -f $2 ]; then
echo "skipping download, the file already exists"
else
curl $1 > $2
fi
}
# Install APT utilities
new_install_with_apt "python-software-properties"
# Install tools to compile software
new_install_with_apt "build-essential"
# Create directory for downloads
mkdir -p /home/vagrant/downloads
# Create directory for local installs
mkdir -p /home/vagrant/local
chown -R vagrant:vagrant /home/vagrant/local
# Install various utilities
new_install_with_apt "git-core"
new_install_with_apt "ack-grep"
new_install_with_apt "curl"
# Setup vim if required
if installed_with_apt "vim"; then
echo "vim is already installed"
else
install_with_apt "vim"
echo "EDITOR=\"vim\"" >> /home/vagrant/.profile
fi
# Install Ruby 1.9.3 if it is not already present
if [ -d "/home/vagrant/local/ruby-1.9.3-p194" ]; then
echo "ruby-1.9.3-p194 is already installed"
else
install_with_apt "libyaml-dev libssl-dev zlib1g-dev libreadline-dev openssl libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev ncurses-dev automake libtool bison libffi-dev"
download_to_file "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz" "/home/vagrant/downloads/ruby-1.9.3-p194.tar.gz"
cd /home/vagrant/downloads
tar xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194 && ./configure --prefix=/home/vagrant/local/ruby-1.9.3-p194 && make && make install
cd /home/vagrant/local
ln -s ruby-1.9.3-p194 ruby
chown -R vagrant:vagrant ruby-1.9.3-p194
chown -R vagrant:vagrant ruby
echo "PATH=\"/home/vagrant/local/ruby/bin:\$PATH\"" >> /home/vagrant/.profile
source /home/vagrant/.profile
gem install bundler rubygems-bundler
fi
# Install ImageMagick
# new_install_with_apt "libmagick++-dev"
# new_install_with_apt "imagemagick"
# Install Xvfb (a fake X environment for testing purposes)
# new_install_with_apt "xvfb"
# Install the libraries needed to use Capybara with webkit
# new_install_with_apt "libqt4-dev"
# new_install_with_apt "libwebkit-dev"
# # Install MongoDB
# if installed_with_apt "mongodb-10gen"; then
# echo "MongoDB is already installed"
# else
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# echo >> /etc/apt/sources.list
# echo "# MongoDB" >> /etc/apt/sources.list
# echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
#
# install_with_apt "mongodb-10gen"
# fi
# # Install nginx
# if installed_with_apt "nginx"; then
# echo "Nginx is already installed"
# else
# install_with_apt "nginx"
#
# write_file "/etc/nginx/sites-available/yoursite" <<EOF
# your config file content here
# EOF
#
# cd /etc/nginx/sites-enabled
# rm default
# sudo ln -s /etc/nginx/sites-available/yoursite yoursite
# sudo service nginx restart
# fi
# Install postfix (not needed at this time because we use Sendgrid)
new_install_with_apt "postfix"
# # Install MySQL
# new_install_with_apt "mysql-server"
# new_install_with_apt "libmysqlclient-dev"