Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm too cheap to pay for EC2, and I don't have enough servers to set up my own openstack, how do I configure juju to use Linux Containers (LXC) on something like my laptop?

share|improve this question
add comment

1 Answer

up vote 49 down vote accepted

Install Juju:

sudo add-apt-repository ppa:juju/stable
sudo apt-get update
sudo apt-get install juju-core

For 12.04 LTS users:

You need a newer backported kernel for LXC support:

sudo apt-get install juju-local linux-image-generic-lts-raring linux-headers-generic-lts-raring

For everyone else (13.xx):

Your kernels are new enough, you just need to install the local provider:

sudo apt-get install juju-local

Configuration:

After that you might get error for SSH authorized/public key not found. Generate an SSH key if you haven't already.

ssh-keygen -t rsa

First configure your environment local environment, if you've not set up Juju before do a:

juju init

This will write out an example config file that will work. Then you need to tell Juju to use the local provider and then bootstrap:

juju switch local
sudo juju bootstrap

The first time this runs it might take a bit, as it's doing a netinstall for the container, it's around a 300 megabyte download. Subsequent bootstraps should be much quicker. sudo is needed because only root can create LXC containers. After the initial bootstrap, you do not need sudo anymore, except to sudo juju destroy-environment when you want to tear everything down.

You deploy charms from the charm store using the following commands:

juju deploy mysql
juju deploy wordpress
juju add-relation wordpress mysql

When it's deployed juju should return something like this in juju status:

services:
  mysql:
    charm: cs:precise/mysql-27
    exposed: false
    relations:
      cluster:
      - mysql
      db:
      - wordpress
    units:
      mysql/0:
        agent-state: installed
        agent-version: 1.13.1.1
        machine: "2"
        public-address: 10.0.3.98
  wordpress:
    charm: cs:precise/wordpress-16
    exposed: false
    relations:
      db:
      - mysql
      loadbalancer:
      - wordpress
    units:
      wordpress/0:
        agent-state: pending
        agent-version: 1.13.1.1
        machine: "1"
        public-address: 10.0.3.134

In this example, navigating the browser to 10.0.3.134 should take you to the wordpress configuration page.

References:

share|improve this answer
    
I'd like to add that for people with more than one environment setup in the yaml file, you select the environment by passing -e <environment_name> to select which one to use. –  mfisch Nov 21 '12 at 5:01
    
After running juju init -w, I get an error: " invalid choice: 'init'". I am using the version of Juju in the Raring archives. Do I need to use the PPA? –  Nathan Osman Aug 30 '13 at 7:10
    
@NathanOsman Yep you need the PPA and ensure it's "juju-core" that is installed! –  Jorge Castro Aug 30 '13 at 13:13
add comment

protected by Community Jun 16 '13 at 14:40

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.