I've been setting up multiple Ubuntu machines from past 1 year and so writing down the steps that I have compiled after hours of frustration and research.
DISCLAIMER : There are steps like these on many blogs but they did not work for me (hence this list). The steps mentioned below may also not work for you.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s
logout and login again (close the terminal and open it again)
- type this on the terminal window :
source ~/.rvm/scripts/rvm
- Check if RVM was installed properly, type :
rvm | head -n 1
(output should be “=rvm”) rvm install 2.2
rvm use 2.2
sudo apt-get install nodejs
sudo apt-get install git
sudo apt-get install libmysqlclient-dev
sudo apt-get install libgmp-dev
gem install mysql2
gem install bundler
After this point, you should set up your directories with your code in the server. Once you do that then do these steps
bundle install
(do it in all the code directories)sudo apt-get install apache2
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install apache2-threaded-dev
gem install passenger
(first try without sudo, if it fails then prepend “sudo” and run the command again)passenger-install-apache2-module
(if you used sudo in the above step, use sudo here, else don’t)
Now sit back and relax or grab a cup of coffee. Passenger will take around 10-15 mins (depending on your internet connection speed) to finish.
Once its done, it will print a configuration on the screen. Copy that and do the below step
cd /etc/apache2
sudo nano apache2.conf
- go the bottom of the conf file and paste the lines you copied
- Now do this :
cd /etc/apache2/sites-available
sudo nano 000-default.conf
- add the below lines at the end
<VirtualHost *:80>
# Change these 3 lines to suit your project
RailsEnv development
ServerName dev.blah.com
DocumentRoot /your/website/path/public # Note the 'public' directory
</VirtualHost>
Hope this helps!