I have just set up an wagn in my local Ubuntu Server with Apache and want to share how it's done.

Assuming that you are on a fresh Installation of Ubuntu 14.04 start with the usual steps:

 

sudo apt-get update && sudo apt-get dist-upgrade

 

 

After the updates are done it's time to get rvm and ruby:

 

sudo apt-get curl
\curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby

 

 

Now let's install apache with Passenger Support:

 

sudo apt-get install apache2 libapache2-mod-passenger
sudo a2enmod passenger

 

 

Imagemagick is also needed so lets get this to:

 

sudo apt-get install imagemagick libmagickwand-dev

 

 

Not to forget about the Database:

 

sudo apt-get install mysql-server

 

 

Let's create an Database user for wagn:

 

sudo mysql -u root -p
mysql> create user 'wagn' identified by 'secret'; mysql> grant all on *.* to 'wagn';
mysql> quit;

This will create the mysql user 'wagn' with the password 'secret'. this user has all rights on your mysql Server.

 


 

Now should everything be prepared and you can get the gems:

 

gem install image_science bundler wagn passenger

If any dependancies need to be fulified, gem will show you the necessary steps.

 

 

I've created an extra folder below /opt to put my wagn sites and set the rights:

 

sudo mkdir /opt/wagn/
sudo chown <user>:<usergroup> /opt/wagn/

<user> and <usergroup> should be the user and his group wich run ruby.

 

 

Now let's create our first wagn site:

 

wagn new /opt/wagn/mysite

 

Then install all necessary bundles

 

cd /opt/wagn/mysite
bundler install

 

Edit the opt/wagn/mysite/config/database.yml and put your former created mysql user with his password in the Production settings.

Now let's create the Database:

 

wagn seed

 


 

 

And Finally let's add the Passenger:

 

cd ~
passenger-install-apache2-module

 

Edit your passenger.load file and fill in the LoadModule line as given by the passenger-install:

 

sudo nano /etc/apache2/mods-enabled/passenger.load

 

Edit your passenger.conf file and fill in the IfModule mod_passenger.c lines as given by the passenger-install:

 

sudo nano /etc/apache2/mods-enabled/passenger.conf

 

In both config files outcomment the lines wich are installed automtically by Phusion Passenger.

 

 

Now let's edit  the Webserver config as given by the passenger-install:

 

sudo nano /etc/apache2/sites-enabled/000-default.conf

 


 

 

 And  finally restart your Apache, and it should be up & running!

sudo service apache2 restart