Installing Pharo on the Server

Table of Contents:

Step 1: Set up your hosting server / OS – Ubuntu 12.04 LTS x64

For hosting, I went with a Digital Ocean VPS instance. The amount of RAM, disk space, bandwidth and processing power you can get for $5 to $10 US a month can’t be beat.

With this host, you select your operating system up front, and they create it from a ready image in a very short amount of time (with my previous host, it booted up to “bare” hardware with an Ubuntu install CD in the emulated disk drive, and so installation took a while).

OS-wise, I went with Ubuntu 12.04 LTS x64. Ubuntu because of familiarity and ease of dev tool installation, 12.04 LTS (Long Term Support) for its mix of newness, stability and long term security patch support, and the 64-bit version because the Riak db only runs on 64 bit systems, and that’s what I want to use for my Smalltalk persistence layer (via the Phriak library).

I’m pretty sure you can make all of this work on CentOS / RedHat, but I’m less familiar with those distros, and plus going with Ubuntu meant I could make use of the nice pre-packaged Pharo VMs, as you’ll see below.

Step 2: Install the Pharo VM

There are several ways of installing Pharo on a Linux server — see the Installing Pharo in Many Flavors post for a discussion.

However, the apt-get install method on Ubuntu is the most straightforward for beginners. (A huge Thank You to Damien Cassou and Nicolas Petton for making available the Pharo Ubuntu packages! These make server-side installation much easier.)

For instructions, I went with the recommendations from the Pharo on Ubuntu guide.

Enable the add-apt-repository command:

sudo apt-get install python-software-properties

Add the Pharo PPA (custom package archive):

sudo add-apt-repository ppa:pharo/stable
sudo apt-get update

Install the server-side version of Pharo. (Meaning, only pharo-vm-core, not the pharo-launcher:i386 package).

sudo apt-get install pharo-vm-core

You can see all of the files installed by pharo-vm-core via:

sudo dpkg -L pharo-vm-core:i386

The binary that you will be executing will be in:

/usr/bin/pharo-vm-nox

Note: -nox means “No X Windows”. Meaning, this is a server-side pharo, without any GUI components.
Also, you can view the help files from the command line:

man pharo-vm-nox

Step 3: Upload Your Seaside Image

Now that Pharo is ready to go on your server, it’s time to upload your deployment image.

First, locate your deployment image on your development machine.
On Mac OS X, the image is located in:

[Seaside install/download folder]/Seaside-3.0.7.app/Contents/Resources

Copy the image to the server using scp. For example, I would use:

scp ~/Seaside-3.0.7.app/Contents/Resources/Seaside.1.image my-username@xx.xx.xx.xx:/home/my-username/

Step 4: Start Pharo

Finally, to launch the Pharo VM and point it to your image:

pharo-vm-nox ~/Seaside.1.image

This will load the image from my user home, and start the Seaside web stack listening on port 8080, by default.

Of course, this is merely the basic concept of launching Pharo, for tutorial purposes. For a production application you would want to ensure that Pharo is started via a system service. In addition, you would want to put a web server such as Apache or Nginx in front of it, for security and load balancing purposes.

Advertisements

3 thoughts on “Installing Pharo on the Server

  1. Thanks, that’s helped me get started with Pharo on Ubuntu. Out of curiosity, what security issues does Apache address (asked out of complete ignorance). Also, will you be covering how to set this up and configure it?

    • That’s a great question! I think this is best answered by Installing Apache chapter of the Seaside book. I’ll quote just one item from there, as an example:

      To listen on port 80, the standard port used by the HTTP protocol, the web server needs to run as root. Running a public service as root is a huge security issue. Dedicated web servers such as Apache drop their root privileges after startup. This allows them to listen to port 80 while not being root. Unfortunately this is not something that can be easily done from within the Smalltalk VM.

      In general, using a programming language’s built-in server (such as Seaside’s Zinc, Ruby’s WEBrick or Mongrel, etc) for development, but putting the application behind an industry-proven server such as Apache or Nginx, is standard best practice.

      I may do a post on how to set up Apache with Seaside later on, but for now I would point you to:
      Seaside Book: Installing Apache
      and
      Linode’s Deploy Applications with Seaside and Apache

      Hope that helps, let me know if you have any other questions.

Comments are closed.