In this post, we’re going to be setting up Red5 on an Ubuntu server that lives inside a virtual machine. I found this really useful when testing ideas that might require some sort of flash media server. The best part is that everything we’re going to be using is open-source and completely free. Also, since we’re using virtual machines, we can just delete the vm and start fresh if something goes wrong. But first let me just say that I’m no server admin, I’m a front-end developer that just wants to use Red5 to build cool flash things. There may be better ways of doing this, but here are the steps I took.
Step 1: Install VirtualBox and Ubuntu
Download and install the appropriate version of VirtualBox according to your operating system. I have a macbook, so I downloaded the OS X binary and went with the standard installation. Once VirtualBox is setup, create a new virtual machine. Use the .iso file provided by the ubuntu site (see downloads section above) and follow the onscreen instructions. I chose to install LAMP server, OpenSSH server, and Tomcat Java server for my virtual machine.
Once your installation has finished, it’s time to log in and let the awesomeness begin.
Note: After logging in, write down your virtual server’s ip address, you’ll need it later to test your installation. Type in
hit [Enter]. The “inet addr” property should indicate the ip address.
Step 2: Install dependencies
Before we can run Red5 on our virtual server, we need a few things.
- Subversion, so we can check out the latest source from the Red5 repo.
- Java, Red5 is written in Java.
- Ant, which is used to build and compile the Red5 source code
We’re going to be running some commands, so put on your nerd hat. Since I’m not logged in to my server as ‘root’ I will be using the keyword ‘sudo’ a lot, apparently this keyword gives us magic powers that enables software installation without being logged in as the almighty ‘root’.
Run the following command:
sudo apt-get install subversion
It will do some stuff (which is technical term for, “huh, look at that”) and will shortly tell you that the installation will take up some amount of space and will ask you to continue.
Press [Y] , [Enter]
More stuff will happen and when that’s all good and done, we can install java. To install java, I couldn’t simply run a command like we did for subversion, it turns out ubuntu had no idea where to get the files for java, so we have to tell it by editing the ‘sources.list’ file. This is basically a text file that contains urls of where ubuntu can go retrieve software and updates.
Let’s pico this shizzle. (Pico is the unix text editor, *snort)
sudo pico /etc/apt/sources.list
Scroll to the bottom of the text file using the down arrow on your keyboard and type the following:
deb http://archive.canonical.com/ lucid partner
Exit pico ([control] + [X] on mac) and make sure you save your changes by pressing [Y], [Enter]. Let’s run an update.
sudo apt-get update
More stuff will happen and once it’s done, you’re ready to install java. Run the following command:
sudo apt-get install sun-java6-jdk
It will ask if you want to continue so just press [Y], [Enter]. When the installation is complete, we have one more thing to install and we should be good to go with setting up Red5. Run the following command to install Ant.
sudo apt-get install ant
Step 3: Checkout Red5 from repo
Create a folder on your server to check the Red5 source code into.
sudo mkdir -p ~/svn/red5
Navigate to the new folder.
Check out the good stuff using svn.
sudo svn co http://red5.googlecode.com/svn/java/server/trunk red5
Step 4: Build the source
Now that we have the source code for Red5, we’ll need to compile it using ant.But first we have to set some values so that the code knows which java and ant versions to use.
Make sure you navigate to the folder where ‘build.xml’ file exists. If you’ve been following along, you should just be able to run this command:
Set the java version:
Set the ant version:
Now lets compile the code using ant:
The build might take a couple of minutes, but when it’s done you should see a “BUILD SUCCESSFUL” message. Let’s copy the build out of the repo folder and into it’s new home, the /usr/share/red5 directory. First let’s create the directory:
sudo mkdir /usr/share/red5
Now let’s make a recursive copy of everything in the distribution folder into our new folder:
sudo cp -R ~/svn/red5/red5/dist/* /usr/share/red5/
Step 5: It’s GO time.
Navigate to where our Red5 distribution exists.
Run the red5.sh shell script by entering the following:
sudo bash red5.sh
At this point, all kinds of nonsense text will scroll through the display and when it stops, it’s time to test if your installation is successful. Open up a browser type in your virtual server’s ip address along with port 5080. So if your ubuntu virtual machine’s ip address is 192.168.0.123, enter 192.168.0.123:5080 in your browser. If the following screen shows up, then congrats, you got Red5 installed!