How to install and manage the client

See also: Client

This document shows how to install and manage your Juju client – whether it is the juju client, the terraform juju client, or the python-libjuju client.

See more: juju, terraform juju, python-libjuju

Here and throughout the how-to guides, to view content specific to your client of interest, in each section select the tab for that client. The decision will stick until you select another client.

Install the client

Install from snap.

Why install from snap? Snaps get updated automatically. Thus, your client will be updated automatically as soon as a new Juju release becomes available.

Snap command not available on your system? Visit snapcraft.io for instructions on how to install snapd.

To install the latest juju client from snap, run:

sudo snap install juju

To select a particular version, run snap info juju to find out what versions are available, then sudo snap install juju --channel=<track/risk[/branch]> to install the version of your choice (e.g., sudo snap install juju --channel=3.4/stable).


Example
$ snap info juju
name:    juju
summary: Juju - a model-driven operator lifecycle manager for K8s and
  machines
publisher: Canonical✓
store-url: https://snapcraft.io/juju
contact:   https://canonical.com/
license:   AGPL-3.0
description: |
  A model-driven **universal operator lifecycle manager** for multi cloud and
  hybrid cloud application management on K8s and machines.
  
  **What is an operator lifecycle manager?**
  Kubernetes operators are containers with operations code, that drive your
  applications on K8s. Juju is an operator lifecycle manager that manages the
  installation, integration and configuration of operators on the cluster.
  Juju also extends the idea of operators to traditional application
  management on Linux and Windows servers, or cloud instances.
  
  **Model-driven operations and integration**
  Organise your operators into models, which group together applications that
  can be tightly integrated on the same substrate and operated by the same
  team. Capture resource allocation, storage, networking and integration
  information in the model to simplify ongoing operations.
  
  **Better day-2 operations**
  Each operator code package, called a charm, declares methods for actions
  like back, restore, or security audit. Calling these methods provides
  remote administration of the application with no low-level access required.
  
  **Learn more**
  
   - https://juju.is/
   - https://discourse.charmhub.io/
   - https://github.com/juju/juju
commands:
  - juju
services:
  juju.fetch-oci: oneshot, disabled, inactive
snap-id:      e2CPHpB1fUxcKtCyJTsm5t3hN9axJ0yj
tracking:     3.1/stable
refresh-date: 2024-01-03
channels:
  3/stable:      3.4.0             2024-03-07 (26548)  99MB -
  3/candidate:   ↑                                          
  3/beta:        ↑                                          
  3/edge:        ↑                                          
  4.0/stable:    –                                          
  4.0/candidate: –                                          
  4.0/beta:      4.0-beta2         2024-01-11 (25984)  98MB -
  4.0/edge:      4.0-beta3-ec9b93b 2024-02-19 (26600)  98MB -
  4/stable:      –                                          
  4/candidate:   –                                          
  4/beta:        4.0-beta2         2024-01-17 (25984)  98MB -
  4/edge:        ↑                                          
  3.5/stable:    –                                          
  3.5/candidate: –                                          
  3.5/beta:      –                                          
  3.5/edge:      3.5-beta1-c3de749 2024-03-12 (26766)  98MB -
  3.4/stable:    3.4.0             2024-02-15 (26548)  99MB -
  3.4/candidate: ↑                                          
  3.4/beta:      ↑                                          
  3.4/edge:      3.4.1-14d5608     2024-03-13 (26783)  98MB -
  3.3/stable:    3.3.3             2024-03-06 (26652)  99MB -
  3.3/candidate: ↑                                          
  3.3/beta:      ↑                                          
  3.3/edge:      3.3.4-65b78cd     2024-03-13 (26779)  99MB -
  3.2/stable:    3.2.4             2023-11-22 (25443)  95MB -
  3.2/candidate: ↑                                          
  3.2/beta:      ↑                                          
  3.2/edge:      3.2.5-9e20221     2023-11-17 (25455)  95MB -
  3.1/stable:    3.1.7             2024-01-03 (25751)  95MB -
  3.1/candidate: ↑                                          
  3.1/beta:      ↑                                          
  3.1/edge:      3.1.8-1a8d6a3     2024-03-12 (26750)  95MB -
  2.9/stable:    2.9.46            2023-12-05 (25672) 120MB classic
  2.9/candidate: 2.9.47            2024-03-07 (26724) 120MB classic
  2.9/beta:      ↑                                          
  2.9/edge:      2.9.48-dfd7fee    2024-03-07 (26740) 120MB classic
  2.8/stable:    2.8.13            2021-11-11 (17665)  74MB classic
  2.8/candidate: ↑                                          
  2.8/beta:      ↑                                          
  2.8/edge:      ↑                                          
installed:       3.1.7                        (25751)  95MB -

$ sudo snap install juju --channel=3.4/stable



To install multiple versions of juju via snap, enable snap’s experimental parallel-install feature, reboot, then install a different version with a different name.

See more: Snap | Channels


Example

# Enable snap's experimental parallel-install feature:
sudo snap set system experimental.parallel-instances=true`

# Reboot.

# Install juju 2.9 under the name 'juju_29'
sudo snap install --channel 2.9/stable juju_29 --classic

# Install juju 3.3 under the name 'juju_33'
sudo snap install --channel 3.3/stable juju_33

# Test your 2.9 client:
juju_29 status

# Test your 3.3 client:
juju_33 status


See more: Snap | Parallel installs

Install from binary.

This method allows you to install the Juju client on systems that do not support snaps.

  1. Visit the project’s downloads page and select the binary that matches your system’s architecture and the version that you want to install.

For example, to download the 2.9.38 client for amd64:

curl -LO https://launchpad.net/juju/2.9/2.9.38/+download/juju-2.9.38-linux-amd64.tar.xz
  1. Validate the downloaded binary archive (optional)

Download the md5 checksum that matches the binary you just downloaded:

The link to the md5 signature can be constructed by appending /+md5 to the end of the link you just downloaded.

curl -L https://launchpad.net/juju/2.9/2.9.38/+download/juju-2.9.38-linux-amd64.tar.xz/+md5 -o juju.md5

Validate the downloaded binary archive against the checksum file:

cat juju.md5 | md5sum --check

If the checksum check succeeds, the output will be:

juju-2.9.38-linux-amd64.tar.xz: OK

If the check fails, md5sum exits with nonzero status and prints output similar to:

juju-2.9.38-linux-amd64.tar.xz: FAILED
md5sum: WARNING: 1 computed checksum did NOT match
  1. Unpack and install client binary
tar xf juju-2.9.38-linux-amd64.tar.xz
sudo install -o root -g root -m 0755 juju /usr/local/bin/juju
  1. Test that the version of the client you installed is up to date
juju version

Build from source.

Visit the downloads section of the Launchpad project to download a tar.gz with Juju source code. For build instructions refer to the contributing to Juju documentation on Github.

Use the client

Use the juju client reference and the Juju how-to guides to build up your deployment.

See:

Back up the client

A backup of the client enables one to regain management control of one’s controllers and associated cloud environments.

Create a backup of the juju client. Making a copy of the client directory is sufficient for backing up the client. This is normally done with backup software that compresses the data into a single file (archive). On a Linux/Ubuntu system, the tar program is a common choice:

cd ~
tar -cpzf juju-client-$(date "+%Y%m%d-%H%M%S").tar.gz .local/share/juju 

For Microsoft Windows any native Windows backup tool will do.

The above invocation embeds a timestamp in the generated archive’s filename, which is useful for knowing when a backup was made. You may, of course, call it what you wish.

The archive should normally be transferred to another system (or at the very least to a different physical drive) for safe-keeping.

Whoever has access to a client backup will have access to its associated environments. Appropriate steps should be taken to protect it (e.g. encryption).

Restore the juju client from a backup. To restore your client from a backup, extract the backup created earlier. E.g., on Ubuntu:

This command will extract the contents of the archive and overwrite any existing files in the Juju directory. Make sure that this is what you want.

cd ~
tar -xzf juju-yymmdd-hhmmss.tar.gz 

Upgrade the client

See also: Upgrading things

If you’ve installed via snap.

Ensure you’ve created a backup of your ./local/share/juju before starting the upgrade process for the client.

If the Juju client was installed via snap, the updates to the client should be handled automatically. Run snap info juju to view a list of releases and juju version to view the current release.

If there has been a new release but the juju snap hasn’t been refreshed, you can manually trigger this with sudo snap refresh juju. To refresh to a specific version, run the refresh command with the --channel=<track/version> option, e.g.

sudo snap refresh juju --channel 3/stable

See more: Snap | Managing updates, Snap | Channels

Uninstall the client

If you’ve installed juju via snap: To uninstall, run:

sudo snap remove juju

Contributors: @cderici, @hmlanigan, @simonrichardson, @timclicks, @tmihoc