These notes were used on a Windows 7 machine to create an Ubuntu Server and started with the notes created by http://notesofgreg.blogspot.co.uk/2012/04/slim-rails-environment-v2.html who started this after discovering my Vagrant notes didn’t quite get him where he wanted to be with Ruby and Rails development. I started with those and then added more parts as I was doing this behind the proxy and wanted any student to be able to copy what I’ve done to tweak their own version of a Linux box. I also referred to http://munkyonline.co.uk/articles/lamp-ubuntu-server-on-virtualbox for general creating vm and http://www.ubuntu.com/download/help/install-ubuntu-server for ubuntu server ISO.
I rebuilt the server in August 2015 and these notes were updated then.
We use a ‘server’ and not a ‘desktop’ ISO so that this is a smaller installation. Hence we only use a lightweight ‘desktop’ like Fluxbox. We still can use our Windows desktop, so we only need lightweight tools for this virtuarl machine.
Start with ISO
Once you have an ISO you can start it up and install it into VirtualBox. You will need to set the proxy if at the university so that you can download more software as needed in the box. Just follow the defaults for the most part and let it use the whole partition. Set yourself easy username and password. This is a virtual machine remember so you don’t need to be paranoid. You can also tell it to install Postgresql during this phase too.
When the installation is done and you’ve logged back in again with your new account you can start adding the software you want to use for the application.
(No longer necessary for Aberdeen, but kept here in case you’re doing this somewhere else.) I found you need to set the proxy again for the session with the command:
export https_proxy=http://proxy.abdn.ac.uk:8080
If you need to set the root password then look at https://help.ubuntu.com/community/RootSudo and at
http://ubuntuforums.org/showthread.php?t=1599832 at end of page for running as su with root
This setup uses fluxbox as a lightweight desktop (right-click) for any options. You start the ‘desktop’ from the command line with ‘startx’ command and can right-click for menu options. When you’re done you drop out of the desktop with ‘right-click->exit’.
You can stop the virtual machine with ‘machine->Close and select ‘send Shutdown signal’ ‘so that pick up where left off before.
Installing the system
#System
sudo apt-get update
sudo apt-get install xinit
sudo apt-get install fluxbox
sudo apt-get install build-essential
#Node.js Rails will not run without a Javascript Engine
sudo apt-get install python-software-properties
#might not need next two steps, try setting proxy first, but may need to also run this as su and thus set password for root. Try to avoid that though.
#set password for su
#switch to su and add proxy details so that su knows them.
export http_proxy=http://proxy.abdn.ac.uk:8080
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
#imagemagick so that we can manipulate images on the server
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20814
sudo apt-get install imagemagick libmagick++-dev
#Sqlite3
sudo apt-get install sqlite3 libsqlite3-dev
#Postgres <<– you need this for working with Heroku
sudo apt-get install libpq-dev (you may get some errors and also need to run sudo apt-get update to fix things, persist, it should all work)
#Ruby
We use the details at this Set up Ruby page to set up what we need on our Ubuntu server
#Git for version control
We’ll need version control and for dealing with some installation issues
sudo apt-get install git
#Rails
We use the Rails details at this Set up Ruby page to set up what we need on our Ubuntu server
sudo apt-get install libxml2-dev libxslt-dev (cucumber/nokogiri)
sudo gem install rails –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install sqlite3 –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install rspec –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install rspec-rails –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install cucumber –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install cucumber-rails –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install capybara –http-proxy http://proxy.abdn.ac.uk:8080
sudo gem install rmagick –http-proxy http://proxy.abdn.ac.uk:8080
#Heroku tools for deploying to remote server
heroku toolbelt wget -qO- https://toolbelt.heroku.com/install.sh | sh (note capital letter ‘o’)
#rails new cookbook -T (t flag keeps tests out)
#cd cookbook
#bundle install will get the rest of the gems
##Other Programs
#Terminator (Better terminal)
sudo apt-get install terminator
#scite for editing files
sudo apt-get install scite
#Google Chrome (web Browser) – that is a capital ‘oh’ NOT a zero in command and each ‘sudo’ is a new command
sudo wget -q -O – https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add –
sudo sh -c ‘echo “deb http://dl.google.com/linux/chrome/deb/ stable main” >> /etc/apt/sources.list.d/google.list’
sudo apt-get update
sudo apt-get install google-chrome-stable
#sqlitebrowser (SQLite3 browser)
sudo apt-get install sqlitebrowser
#enable shared folders on machine
Start here for basics https://www.virtualbox.org/manual/ch04.html
This page has the scripts for mounting and running the install script https://mylinuxramblings.wordpress.com/2014/12/06/how-to-install-virtualbox-guest-editions-in-ubuntu-server-14-04/
And then follow on with this post to configure integration http://www.sysprobs.com/virtualbox-shared-folders-ubuntu-1010-guest-windows-7-host
#change permissions on shared folder so default user can use this folder and edit files (edit in Windows on and run commands in Linux)
use this to add ruby to vboxsf folder permissions
sudo adduser xxxxxxx vboxsf
#need to log out and back in again for this to take effect
Winding up
You’re now done and should be able to do all that you need to do in a Linux box on a Windows machine. This should take lots of the pain of Ruby running on Windows away. So that you have a better idea of what you’re doing you should also look to these links for more help:
https://help.ubuntu.com/community/UsingTheTerminal for more on commands
http://fluxbox.org/ for details about the windowing manager installed
you can edit the menu for fluxbox so that Terminator and Scite are included by opening .fluxbox/menu from your home directory and adding in the three lines starting with [exec]. The result just adds them to the end of your menu, so if you want them grouped in another location then follow the instructions at the top of the full menu which is included there under the ‘etc’ directory.
NOTE: For ABDN we don’t need to declare the proxy any longer, but I leave it here in case it helps someone else.
begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)[exec] (editor) {scite}
[exec] (console) {terminator}
[exec] (google chrome with proxy) {google-chrome –proxy-server=http://proxy.abdn.ac.uk:8080}
[end]
Look at http://www.makeuseof.com/tag/8-great-alternative-desktop-managers-for-linux/ for alternatives to Fluxbox if it’s too minimalist for you.
You will now have a basic system to run what you need for the AWAD course using ruby and rails. You will need to learn more about using Ubuntu, and linux commands, but this will get you started and provide a system where installation of ruby gems and other tools should go smoothly.