I prepared a documentation about this for a company and I thought I might as well post it here (modified a bit). I had to make sure the setup worked from scratch so I tested it using Sun’s VirtualBox.
Table of Contents
- Ubuntu Server
- Package Manager: apt-get
- Ruby
- RubyGems
- Apache 2
- MySQL
- Merb + DataMapper (+ SQLite 3?)
- Phusion Passenger
- Deploy the Merb App
1. Ubuntu Server
This setup was tested on the Ubuntu Server OS Hardy Heron, the latest version with LTS as of writing. Go to the Ubuntu website to download the installer of the Ubuntu version you want, preferably the latest with LTS.
The following instructions may work in other Debian-based OSes because it relies mainly on the apt-get package manager.
2. Package Manager: apt-get
Attribution: The content of this section, Package Manager: apt-get, is copied from Configure the Package Manager section of this Slicehost wiki page.
Ubuntu’s package management is done through apt-get. But it starts out handicapped. You need to edit a configuration file to add some additional sources.
sudo nano /etc/apt/sources.list
Uncomment these lines (remove the “# “; ignore if not commented out).
# deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe # deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe ... # deb http://security.ubuntu.com/ubuntu hardy-security main restricted universe # deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted universe
Now update the repository index and upgrade your built-in software:
sudo apt-get update && sudo apt-get upgrade
3. Ruby
To install Ruby, execute the following in the server’s command line:
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
4. RubyGems
First, install the essential tools for compiling:
sudo apt-get install build-essential
Then, install RubyGems (latest is version 1.3.1 as of writing; update the script if necessary):
mkdir sources; cd sources wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz tar zxvf rubygems-1.3.1.tgz cd rubygems-1.3.1 sudo ruby setup.rb cd ~ sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem sudo gem update --system
5. Apache 2
To install Apache, simply execute the following in the server’s command line:
sudo apt-get install apache2
6. MySQL
To install MySQL:
sudo apt-get install mysql-server mysql-client
Note: During installation, specify the root password for the MySQL when it’s asked.
7. Merb + DataMapper (+ SQLite 3?)
Unfortunately, installing the latest version of Merb (1.0 as of writing) requires SQLite 3. So for the moment,
sudo apt-get install sqlite3 libsqlite3-dev
Then, to install Merb and make it work with MySQL:
sudo gem install merb sudo apt-get install libmysqlclient15-dev sudo gem install do_mysql
8. Phusion Passenger
To install Passenger, do the following (from Phusion Passenger’s install page):
- Open a terminal and type:
sudo gem install passenger
- Type:
sudo passenger-install-apache2-module
And follow the instructions.
Re-run ‘passenger-install-apache2-module’ if you were asked to install other dependencies. For example, if you followed the instructions in this document, you will probably be asked to install development libraries of apache2, so:
sudo apt-get install apache2-prefork-dev sudo passenger-install-apache2-module
After that, you will probably be asked to edit your Apache configuration file (see /etc/apache2/httpd.conf) to add the following (note that version numbers may vary):
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3 PassengerRuby /usr/bin/ruby1.8
Since a Merb app is a Rack-based Ruby application, check out section 4 (or “Deploying a Rack-based Ruby Application” section) of the Phusion Passenger User’s Guide. From section 4.2 (or “Deploying to a virtual host’s root” section),
Add a virtual host entry to your Apache configuration file. The virtual host’s document root must point to the application’s public folder. For example,
<VirtualHost *:80>
ServerName www.yourdomain.com
DocumentRoot /var/www/apps/my_app/public
</VirtualHost>
Your Merb app needs to satisfy a certain directory layout for Passenger to work. This is described in section 4 of the User’s guide. In the root directory of your application, you need a public folder (which a standard Merb app should already have), a tmp folder (simply create an empty one), and a config.ru file containing the configuration detailed in section 4.5.4 of the User’s guide.
The Phusion Passenger User’s Guide is quite a comprehensive documentation. If you encounter any problems, be sure to check its other sections like the one on Troubleshooting. For example, if you have static assets (such as stylesheets) in your application’s public folder, you are likely to encounter the problem described in section 6.3.4. The solution is also there.
9. Deploy the Merb App
Basically, to get your Merb App to running you only need to do the following:
- Make sure the gem dependencies are satisfied by either installing the gems in your server, or freezing them in your app.
- Make sure your app satisfies the requirements of Passenger (i.e. tmp and public folders and config.ru file, see Phusion Passenger section above).
- Place a copy of the application in an appropriate directory such as /var/www/apps/my_app. Wherever it is, make sure that it is consistent with the specified directory in the Apache configuration file (see Phusion Passenger section above).
- Prepare your database: create it, configure your database.yml, and migrate your tables and data.
- Start your Apache server.
sudo apache2ctl start
Note that with Passenger, restarting your app is done by creating a restart.txt file in the Merb app’s tmp folder.
That should get you started. If you want more, there’s a great talk about Deploying a Merb App by Lindsay and you can download it from the MerbCamp videos page. It talks about freezing Merb and other gems, web servers, restarting your app, monitoring, configuration management, exception handling, and some other tips.
[…] Setting up your Ubuntu Server for Merb (tags: linux ubuntu ruby merb sysadmin) […]
< b >< a href=”http://eltcommunity.com/elt/bookmarks/1078?decorator=print#comments” >herpes kelly dating kansas< /a >< /b >< /blockquote >…
Buy_no prescription…
< b >< a href=”http://hopestreetgroup.org/bookmarks/7081?decorator=print#comments” >strong insulin< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://policy2.org/bookmarks/1684?decorator=print#comments” >erectile dysfunction herbal treatment< /a >< /b >< /blockquote >…
Buy_drugs without prescription…
< b >< a href=”http://www.screwfix.com/community/bookmarks/1418?decorator=print#comments” >brown algae good for slow thyroid< /a >< /b >< /blockquote >…
Buy_generic drugs…
< b >< a href=”http://www.screwfix.com/community/bookmarks/1441?decorator=print#comments” >novo 50 allergy medicine< /a >< /b >< /blockquote >…
Buy_now it…
< b >< a href=”http://community.techweb.com/bookmarks/2418?decorator=print#comments” >lithium alcohol< /a >< /b >< /blockquote >…
Buy_generic drugs…
< b >< a href=”http://eltcommunity.com/elt/bookmarks/1532?decorator=print#comments” >embed video webpage< /a >< /b >< /blockquote >…
Buy_generic drugs…
< b >< a href=”http://beta.hopestreetgroup.org/bookmarks/2845?decorator=print#comments” >what is plavix< /a >< /b >< /blockquote >…
Buy_drugs without prescription…
< b >< a href=”http://solid.community.appliedbiosystems.com/bookmarks/1600?decorator=print#comments” >postpartum remeron< /a >< /b >< /blockquote >…
Buy_no prescription…
< b >< a href=”http://www.protocolexchange.com/bookmarks/2989?decorator=print#comments” >medication errors 2nd ed< /a >< /b >< /blockquote >…
Buy_no prescription…
< b >< a href=”http://talk.sonyericsson.com/bookmarks/2040?decorator=print#comments” >oral cancer hospital< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://communities.leviton.com/bookmarks/3910?decorator=print#comments” >joke male birth control< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://community.crn.com/bookmarks/3307?decorator=print#comments” >prozac daily strength< /a >< /b >< /blockquote >…
Buy_generic pills…
< b >< a href=”http://cellnetwork.community.invitrogen.com/bookmarks/1936?decorator=print#comments” >acne in cats< /a >< /b >< /blockquote >…
Buy_it now…
< b >< a href=”http://enterpriseleadership.org/bookmarks/2059?decorator=print#comments” >nursing times alzheimer mavis ford< /a >< /b >< /blockquote >…
Buy_it now…
< b >< a href=”http://community.jboss.org/bookmarks/2287?decorator=print#comments” >diseaeses contracted from sand fleas< /a >< /b >< /blockquote >…
Buy_now it…
< b >< a href=”http://talk.sonyericsson.com/bookmarks/2293?decorator=print#comments” >pet ct scan results accuracy cancer< /a >< /b >< /blockquote >…
Buy_drugs without prescription…
< b >< a href=”http://community.crn.com/bookmarks/2115?decorator=print#comments” >pictures of herpes blisters< /a >< /b >< /blockquote >…
Buy_generic pills…
< b >< a href=”http://hopestreetgroup.org/bookmarks/4422?decorator=print#comments” >reversing alcohol induced neuropathy< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://community.techweb.com/bookmarks/3189?decorator=print#comments” >natural cures for premature ejaculation< /a >< /b >< /blockquote >…
Buy_generic drugs…
< b >< a href=”http://cellnetwork.community.invitrogen.com/bookmarks/2296?decorator=print#comments” >canadian paediatric diabetes association< /a >< /b >< /blockquote >…
Buy_now…
< b >< a href=”http://solid.community.appliedbiosystems.com/bookmarks/2293?decorator=print#comments” >discovery of zinc in human health< /a >< /b >< /blockquote >…
Buy_now…
< b >< a href=”http://community.music123.com/bookmarks/2254?decorator=print#comments” >emotions surviveing uterine cancer< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://www.harmonycentral.com/bookmarks/5486?decorator=print#comments” >clinical studies of clonidine< /a >< /b >< /blockquote >…
Buy_no prescription…
< b >< a href=”http://www.protocolexchange.com/bookmarks/2388?decorator=print#comments” >diet generator reviews< /a >< /b >< /blockquote >…
Buy_it now…
< b >< a href=”http://communities.leviton.com/bookmarks/3317?decorator=print#comments” >psychiatric care model< /a >< /b >< /blockquote >…
Buy_generic meds…
< b >< a href=”http://www.protocolexchange.com/bookmarks/2474?decorator=print#comments” >maple syrup and lemon juice diet< /a >< /b >< /blockquote >…
Buy_it now…
< b >< a href=”http://community.techweb.com/bookmarks/3609?decorator=print#comments” >most successful diet ever< /a >< /b >< /blockquote >…
Buy_generic pills…
< b >< a href=”http://www.harmonycentral.com/bookmarks/5723?decorator=print#comments” >sleep apnea side effect of lexapro< /a >< /b >< /blockquote >…
Buy_generic pills…
< b >< a href=”http://communities.leviton.com/bookmarks/3576?decorator=print#comments” >acute angle-closure glaucoma< /a >< /b >< /blockquote >…
Buy_drugs without prescription…
< b >< a href=”http://www.protocolexchange.com/bookmarks/2694?decorator=print#comments” >regulations for dementia units< /a >< /b >< /blockquote >…
Buy_drugs without prescription…
< b >< a href=”http://www.box.net/view_shared/d3pc6lusjz?ml=id side@effects.from.the.drug.protonix” >…< /a >< /b >< /blockquote >…
Buynow it…
< b >< a href=”http://hopestreetgroup.org/bookmarks/1212?decorator=print#comments” >benadryl dogs< /a >< /b >< /blockquote >…
Buy_generic drugs…
……
.@viagra.comprar” rel=”nofollow”>.…
……
.@levitra.generico” rel=”nofollow”>.…
……
Over.the.counter@sleep.aids” rel=”nofollow”>.…
……
kamagra@oral.jelly” rel=”nofollow”>.…
._….
natural@sleep.aids” rel=”nofollow”>.…
kgpark.net…
michael galero » Blog Archive » Setting up your Ubuntu Server for Merb…