Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in compiling and running juju-core from source. How can I do this? What are the risks involved?

share|improve this question

Before going in to this, according to the README in juju-core:

Note that the use of --upload-tools forces the instances to run with the same series and architecture of your development system. Currently the only supported architecture that can be deployed is amd64, so you must develop on 64-bit machines.

If you do not have an amd64 machine, or are trying to compile for i386, ARM, etc these steps will likely not work.

Setup Dependencies

The following packages are required to build juju-core:

sudo apt-get install build-essential bzr zip git-core mercurial golang-go

The golang-go package will prompt you about anonymous usage statistics and if you wish to opt-in. Select Yes or No depending on your interest.

After installation you'll need to create a GOPATH, which is what go will use for downloading and compiling dependencies. You can set this to any directory you choose, for example ~/go. You can read more about gopath with go help gopath

export GOPATH=${HOME}/go
mkdir -p $GOPATH

Then prefix or append GOPATH to your PATH. It's recommended you prefix your PATH as it'll give you your compiled version by default. You'll still be able to access other installed versions of Juju, though you'll have to use an absolute path to access them. If you do not wish to have GOPATH in your path, you can bypass this step.


Building & Installing

Once your environment is setup, build juju-core is a relatively straight forward process. You'll first need to get the latest code for juju-core in a manner that go will know what to do with. Simply run the following command to fetch the latest source:

go get -v

This will have go fetch juju-core and the source of all dependencies. Finally, to build juju-core run:

go install -v

This should take a few seconds to complete. Once finished you can verify juju compiled properly by running which juju if you prefixed your PATH with GOPATH. If not you can verify it's installed with $GOPATH/bin/juju version which should report the current compiled version of juju-core.


Once juju-core is built and you're able to use it as you like, there are a few caveats to be made aware of. First, whenever you run a bootstrap you'll need to include the --upload-tools flag, otherwise you'll end up having the 'released' version of the juju-core tools installed instead of the newly compiled ones.

juju bootstrap -e <your_environment> --upload-tools

Also, juju-core isn't compatible with previously deployed juju versions less than 0.7 (the python version of juju). You'll need to create new environments.yaml definitions and use different control-bucket keys. If you want to maintain two separate environment files you can do so by specifying a JUJU_HOME environment variable:

export JUJU_HOME=~/.juju-core
mkdir -p $JUJU_HOME
juju init -w

This will create a new boilerplate environments.yaml file in ~/.juju-core/ where you can maintain your juju-core environments separate from previous versions of juju.


If you wish to remove the compiled version of juju-core you can do so at anytime by running rm -rf $GOPATH. This should return your system back to a state prior to when you had your compiled source version of juju-core.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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