Skip to content

Commit 9a01b05

Browse files
authored
Update README.md
vagrant install
1 parent 59b67dd commit 9a01b05

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,82 @@ the enviorment and reconfigure whenever you want.
1313
1. Download VirtualBox 5.2.22 for Mac OSX [here,](https://download.virtualbox.org/virtualbox/5.2.22/VirtualBox-5.2.22-126460-OSX.dmg) or Windows [here](https://download.virtualbox.org/virtualbox/5.2.22/VirtualBox-5.2.22-126460-Win.exe)
1414
2. Run the installer.
1515
3. Download Vagrant for Mac OSX [here,](https://releases.hashicorp.com/vagrant/2.2.0/vagrant_2.2.0_x86_64.dmg) or Windows [here](https://releases.hashicorp.com/vagrant/2.2.0/vagrant_2.2.0_x86_64.msi)
16+
4. Let's create our first enviorment. You can run the script below to keep your rails projects on your Desktop.
1617

1718
```
19+
cd /Desktop && mkdir rails && cd rails && vagrant init
20+
```
21+
5. Download the OS to VirtualBox
22+
```
23+
vagrant box add ubuntu/trusty64
24+
```
25+
6. Double check and make sure our new box is there
26+
```
27+
vagrant box list
28+
```
29+
7. Add this script to the Vagrant File
30+
```
31+
Vagrant.configure("2") do |config|
32+
config.vm.box = "ubuntu/trusty64"
33+
end
34+
```
35+
8. Start the vagrant server
36+
```
37+
vagrant up && vagrant ssh
38+
```
39+
9. Direct yourself to the vagrant directory
40+
```
41+
cd /vagrant
42+
```
43+
10. Add our Bootstrap File
44+
```
45+
mkdir new_project && cd new_project && touch bootstrap.sh
46+
```
47+
11. Copy this script to configure our virtual enviorment
48+
```
49+
#!/usr/bin/env bash
50+
# upgrade and update the system
51+
echo upgrading and updating the system
52+
sudo apt-get update
53+
sudo apt-get -y upgrade
54+
# install node.js for js runtime when using Rails
55+
echo installing nodejs for ExecJS runtime and git
56+
sudo apt-get install -y nodejs
57+
sudo apt-get install -y git
58+
# install RVM
59+
echo installing RVM
60+
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
61+
\curl -sSL https://get.rvm.io | bash -s stable
62+
source /home/vagrant/.rvm/scripts/rvm
63+
rvm requirements
64+
# install Ruby and make 2.3.1 the default
65+
echo installing ruby
66+
rvm install 2.3.1
67+
rvm use 2.3.1 --default
68+
# install Bundler and Rails
69+
echo installing bundler and rails
70+
gem install bundler --no-ri --no-rdoc
71+
gem install rails -v 4.2.7 --no-ri --no-rdoc
72+
# install postgres and its dependencies
73+
echo installing psql and its dependencies
74+
sudo apt-get install -y postgresql postgresql-contrib libpq-dev
75+
```
76+
12. Re-edit the vagrant file for our newest editions + new bootstrap file
77+
```
78+
Vagrant.configure("2") do |config|
79+
config.vm.box = "ubuntu/trusty64"
80+
config.vm.network "forwarded_port", guest: 3000, host: 3000, host_ip: "127.0.0.1"
81+
config.vm.provision :shell, path: "bootstrap.sh", privileged: false
82+
config.vm.provider "virtualbox" do |vb|
83+
vb.customize ["modifyvm", :id, "--memory", "2048"]
84+
vb.customize ["modifyvm", :id, "--cpus", "2"]
85+
end
86+
end
1887
1988
```
89+
13. Open a new tab in your terminal and lets test the vagrant configs
90+
```
91+
vagrant halt && vagrant up --provision
92+
```
93+
14. Last step. whew...! Once your vagrant server is on (vagrant up and vagrant ssh!), check that Ruby and Rails was installed!
94+
``` ruby -v ```

0 commit comments

Comments
 (0)