Developing for Flash Media Interactive Server 3 under OS X and Ubuntu using Virtualization

Published: Wednesday October 15, 2008 at 12:00 AM

View or Add Comments

Flash OS X virtualization VMWare Ubuntu

If you weren't yet aware, FMS3 is a terribly awesome (and expensive) server that does all sorts of great stuff like streaming video, recording video, remote shared objects and basically does a great job of making a multi-user server very easy to create. Currently, we're preparing for a project that is going to use some of these features so I've had to dive in recently. The first thing any OS X developer will notice is that you can't install FMS3 on OS X. This is a bit of a pain because, for all intents and purposes, OS X's underlying system more than likely could support the server. However, we're not dealing with an open source product here so we'll have to deal with this fact. So our host options are Windows and Linux which makes the decision very easy.

My opinion is that virtualization is one of the best things to happen to computing. There's a few solutions out there for OS X: VMWare, VirtualBox and Parallels. We can eliminate Parallels right now because it only handles Windows virtualization. There it goes, trodding off the stage in humiliation. Now I've given each of the other products a whirl and it should be said that there are times when my patience is less than high. Both VMWare and VirtualBox are great products but have some pros and cons. VirtualBox is free for developers and I found to be much better performance-wise but a right pain in the ass to get the networking set up so that I could connect between a guest OS and the host OS. VMWare, on the other hand, is a commercial product ($80USD at the time I'm writing this) and is a bit more sluggish out of the box but has the upside of networking that "just works" the way I wanted it to from the get go. For simplicity I chose VMWare and that's what we'll use in this article.

1. Download everything we need.

Start by downloading VMWare Fusion which has a 30 day free trial and does this email confirmation thing which could take a few minutes. Next, we'll need to get Flash Media Interactive Server 3 (you'll need an Adobe account for this, its free). Finally lets go grab Ubuntu Server.

2. Install VMWare Fusion

This is pretty trivial - when you mount the disk image there's an installation package that takes care of everything. You'll need the activation key that was emailed to you to finish the install.

3. Install Ubuntu Server 8.04 as a guest OS

Once the Ubuntu Server ISO has fully downloaded, open up VMWare Fusion. In the "Virtual Machine Library" window select the "New" button at the bottom left of the window.

You'll be prompted about the OS installation disk - click the "Continue without disk" button. On the next screen you'll want to select the "Use an operating system installation disk image file" option and then select the Ubuntu Server ISO you downloaded earlier.

VMWare should automatically detect the type of OS on the next screen. If it doesn't have Linux and Ubuntu selected, do this manually and continue. On this screen you are preparing to finish the setup of the virtual machine. For the sake of simplicity we'll leave everything as-is but we'll uncheck the "Always open this virtual machine" checkbox at the bottom (unless you want this functionality).

Now the virtual machine should boot automatically and you'll begin the Ubuntu install process. Start by selecting your language and then "Install Ubuntu Server" from the menu.

Answer all the questions regarding your language and region as prompted and then the install will begin. When prompted for the hostname you can enter anything you want, I used simply ubuntuserver.

After entering your timezone you'll be asked about disk partitioning. In this case we'll select "Guided - use entire disk". VMWare takes care of the virtual disk for us so this option is the simplest.

Next you should be provided with only one disk to partition, select it and continue.

When asked to write changes to the disks just select the "Yes" option. The install will do a bunch of work here so just sit back.

Now you'll be prompted for your real name then your username and finally a password. Enter these however you like but be aware that this user will have root priviledges. When asked for an HTTP proxy, enter one if you use one, otherwise just leave it blank.

Next you'll be prompted to chose some standard software configurations. Check the "OpenSSH server" option and continue. When you've been notified that the installation is complete, before continuing, enter the virtual machine settings and select CDs and DVDs. In here, chose "Specify physical CD/DVD drive" so that we effectively unmount the Ubunty Server ISO. When done, close the window and continue the installation.

The machine will reboot and you should be at the login prompt - you're done installing Ubuntu!

4. Install and configure FMS3

The following steps require a lot of work in the terminal so if you're not comfortable in there, don't worry - just enter everything as-is and you should be fine. Below I won't indicate every time you need to enter a password - advanced users should set their ssh public key to the authorized keys on the Ubuntu instance for ease.

Login to the server with the username and password you created during the instal process. We need to get our virtual machine's assigned IP address. Do this by typing ifconfig and checking the output. The ifconfig output can look daunting but we're only looking for "inet addr:XXX.XXX.XXX.XXX" under the eth0 section (you should likely only see two tabbed sections: eth0 and lo).

Switch into OS X and find the zip file you downloaded for FMS3 then double click it or extract it however you normally do. We're interested in the file named FlashMediaServer3.tar.gz

Now open up a terminal - we're going to move the file we need to install FMS3 on to the Ubuntu Server. Type the following and hit enter:

scp /path/to/FlashMediaServer3.tar.gz YOUR_USERNAME@UBUNTU_IP_ADDRESS:~/FlashMediaServer3.tar.gz

For example, this is what I used:

scp /path/to/FlashMediaServer3.tar.gz paul@192.168.122.130:~/FlashMediaServer3.tar.gz

Let's switch back to Ubuntu and get started. If to be sure you're in the right directory, enter cd ~. Extract the archive by entering: tar xfz FlashMediaServer3.tar.gz - this should create a new directory named something like FMS\_3\_0\_1\_r123 (the revision number might change depending on when you download it).

Before we can actually start installing FMS3 we need to patch is as it was only originally configured for Red Hat. There is also a library dependency that is required by the server that we'll need to install first.

Type: sudo apt-get install libnspr4-dev and the enter your password when prompted. When asked to install dependencies type Y and hit enter.

Now type: sudo apt-get install patch and the enter your password when prompted. To patch the installer we can download a ready-to-go patch graciously offered by Markus Bertheau. Download it by entering:

wget http://www.bluetwanger.de/~mbertheau/flash-media-server-3-ubuntu.patch

When that completes enter the FMS directory: cd FMS_3_0_1_r123 then appy the patch by entering: patch -p1 < ../flash-media-server-3-ubuntu.patch

Now we can finally start installing: sudo ./installFMS Accept the license agreement and then press enter when asked for your serial number (unless of course, you are lucky enough to have a license number).

Install to the default directory /opt/adobe/fms and use all the default port numbers. Enter an administrative username and password for the Flash Media Server (note that this is not your username and password for your Ubuntu account. When asked to run the server as a daemon, use the default "Y" option and do the same when asked if the server should launch after installation.

Finally, accept the settings with "y". We're now done installing FMS3!

5. Prepare a sample application under FMS3 and test that it works

This part is relatively straightforward and I'll show how I push my changed server-side ActionScript to FMS. This is by no means the best way to do things and I'm sure there's a way to do this either automatically or by using a shared directory. In any event, here's my method...

First, we need to place our user in the fms group so that we can modify files under the FMS applications directory. We do this by entering sudo nano /etc/group then scrolling to the end of the file and adding your username to the fms group which would look something like this: fms:x:1001:paul - save the file when exiting (control+X).

Change to the applications directory: cd /opt/adobe/fms/applications and create a new folder: sudo mkdir sample then issue the following commands to set the proper ownership and permissions:

sudo chmod g-s sample
sudo chmod g+w sample
sudo chown fms:fms sample

Now back in OS X we can copy our server source files to the sample application by using

scp /path/to/osx/server/files/* YOUR_USERNAME@UBUNTU_IP_ADDRESS:/opt/adobe/fms/applications/sample

I'm not going to get into any server-side code in this tutorial.

In Flash test the connection to the sample application with the following code:

package {
  import flash.display.Sprite;
  import flash.events.NetStatusEvent;
  import flash.net.NetConnection;

  public class FMSTest extends Sprite {
    private var _connection:NetConnection;

    public function FMSTest() {
      _connection = new NetConnection();
      _connection.addEventListener(NetStatusEvent.NET_STATUS,
        onConnectStatus, false, 0, true);
      // Use your Ubuntu IP address below
      _connection.connect('rtmp://192.168.122.130/sample');
    }

    /**
    * Handles net connection status events.
    */
    public function onConnectStatus(event:NetStatusEvent):void {
      trace(event.info.code);
    }
  }
}

If you run this and get the status NetConnection.Connect.Success then everything is working!

Comments

 

No comments.

 

Add a Comment

*email addresses are not made public

*uses a small subset of markdown for formatting and links