Installation and Initial Set-up
Setting up juju is a little more involved than, for example, installing a LAMP stack using tasksel, as it’s designed for cloud environments. First, we’ll need to install juju and its dependencies: Note: while there is a version of juju in the Universe repositories for Precise, the “Juju hackers” team has some PPA’s with updated versions. I’ll be using the version from the repositories. Once this is completed, you’ll need to generate an SSH key for your server, if you don’t have one already: Lastly, your user will need to be a group associated with the virtualization daemon libvirtd: This is because your juju environment is actually a virtual Ubuntu environment within your current machine. Next, you’ll need to initiate the “bootstrap” process, where this virtual environment is downloaded and installed: Oops! We’re missing a configuration file… thankfully, juju has at least created a sample for us. Using your text editor of choice, edit the file ~/.juju/environments.yaml to match the following:
Now, if you’re able to take the server down, rebooting will ensure all the services are started correctly. Let’s go get some charms.
Installing and Running Charms
As mentioned, Charms are similar to APT packages, but are also focused on all the things that need to happen to get a service running. We’ll deploy an instance of WordPress as an example here with the following command:
Now we should be able to go to the IP address of our server and get to blogging… we can confirm that WordPress is running with the following command: But wait, there’s an error here! This is because juju doesn’t automatically handle dependencies. WordPress requires a MySQL database to work, and this wasn’t installed automatically. Let’s get this set up: Now we need to connect the two together: Lastly, let’s make it visible to the world: At this point is the hardest part of the process: patience. While these commands will have seemed to complete, there will actually be a fair number of things happening in the background – specifically, the download, installation, and configuration of the “virtual” Ubuntu environment. You’ll notice two listings under “services:” when you issue the juju status command, one called “wordpress” (this is the actual WordPress instance) and “mysql” (this is the MySQL instance). Beneath each, there is a “agent-state” line, which will likely say “pending.” You may also hear your hard drive churning… that’s OK, that’s just a lot of packages being installed (check the results of ps ax to see some of what’s going on).
Suffice to say, you’ll need to wait until both of the services list “agent-state: started.” Keep using juju status to check on the progress. Once they are both started, you can see your WordPress installation by visiting the IP address listed in the “public-address” line of the output of juju status (mine was http://10.0.3.66).