Last active
October 27, 2016 14:34
-
-
Save alankis/1e436bc75b840078be9b742cb5829148 to your computer and use it in GitHub Desktop.
Perfect remote Rails WorkStation inside your VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Get your favorite Linux distro, I am doing this on Lubuntu 16.04, becasue I am short on resources | |
2. Install it | |
3. Be sure that networking is in bridge mode | |
4. Call some terminals with Alt-Ctrl-T | |
5. Add some password to root user | |
~ sudo passwd root | |
6. Install Vi(m) if you don't want to break your fingers | |
~ apt-get install vim | |
7. Find out name of netwrok interface that you are using | |
~ ifconfig - a | |
In my case that is enp0s3, and DHCP resolved IP address is 192.168.0.222 | |
8. Set static IP on it, my configuration looks like this: | |
auto enp0s3 | |
iface eth0 inet static | |
address 192.168.0.220 | |
netmask 255.255.255.0 | |
gateway 192.168.0.254 | |
dns-nameservers 8.8.8.8 8.8.4.4 | |
9. Set hostname, if user-VirtualBox hurts your sighteeins | |
$ hostnamectl set-hostname workbox | |
and then logout and login from your current shell session, ypu will also have to update your hostname in hosts file, so hit | |
$ sudo vim /etc/hosts | |
Or you'll get "sudo: unable to resolve host workbox" | |
10. You are ready to install some Ruby dependecies and update your sistem | |
$ sudo apt-get update | |
Now install dependencies: | |
$ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
11. Instal rbenv and rbenv build | |
$cd | |
$git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
$echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
$echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
$exec $SHELL | |
$git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
$echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
$exec $SHELL | |
$rbenv install 2.3.1 | |
$rbenv global 2.3.1 | |
Check that you have correct version of Ruby running: | |
$ruby -v | |
12. Install bundler | |
$ gem install bundler | |
$ rbenv rehash | |
12. Set Github account settings | |
$git config --global color.ui true ( I don't know what is this actually meanse, but I think that has some connection with that colorfull git prompts) | |
$git config --global user.name "YOUR NAME" | |
$git config --global user.email "YOUR@EMAIL.com" | |
13. Generate SSH key and add it to your github account | |
$ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com" | |
-> cat or vi(m) your public account, and copy it to your new ssh key on Github | |
After you add your public key to github, feel free to test it, so hit | |
$ ssh -T git@github.com, if you know what are you doing you should get: | |
Hi niceperson! You've successfully authenticated, but GitHub does not provide shell access. | |
Where nice person is your github user name. | |
14. Ok, you are all set, but something is missing. Go and install Atom editor: | |
$ wget https://github.com/atom/atom/releases/download/v1.11.2/atom-amd64.deb | |
Install it: | |
$ sudo dpkg --install atom-amd64.deb | |
You may have some dependencies error, but just install those missing bins. | |
Run it: | |
$ atom | |
15. Ok, now when you have almost all, now get some Rails, but before that you will need JS runtime, so we will use NodeJS: | |
SO fetch package: | |
$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - | |
Install it: | |
sudo apt-get install -y nodejs | |
Sweet sexteen: | |
And finally install some Rails gem just to test: | |
gem install rails -v 4.2.6 --no-document | |
// We have added --no-document, to skip installation and downloading documentation, | |
// | |
16. Create some app to test | |
$ rails new app --no-document | |
17. Run rails server and bind it to your VM guest IP address, so you can access it outside | |
$rails s -b 192.268.0.220 | |
18. That's it :)) | |
19. Go further and git clone your favorite repo :) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment