Table of Contents
In this article, we will see how to install Juju client on Ubuntu 20.04 LTS (Focal Fossa). Juju is a free and open source framework that helps us perform multiple operations like install, maintain, upgrade and integrate applications on a kubernetes Cluster, container, virtual machines or on a bare metal machine running on a private or public cloud through a shared, reusable, tiny applications called Charm Operators.
A charm operator is just like a kubernetes operator which contains the operational knowledge of installing, maintaining and upgrading it on a kubernetes cluster. This gives lot of flexibility in managing applications on a kubernetes cluster, hence making it an ideal choice for developers. It is also easy to install and work on.
Juju is also a command line tool which is used to manage Juju controllers, either as an administrator or a regular user. It is available as one of the Juju clients for which we will see here how to install Juju Client on Ubuntu 20.04 LTS Virtual machine.
How to Install Juju Client on Ubuntu 20.04 LTS (Focal Fossa)
Also Read: How to Install and Use crictl on Linux Using 10 Easy Steps
Step 1: Prerequisites
a) You should have a running Ubuntu 20.04 LTS
System.
b) You should have sudo
or root
access to run privileged commands.
c) You should have snap
utility available in your System.
Step 2: Update Your Server
In the first step, you need to check for all the available updates and install it by using sudo apt update
command. Then you need to upgrade the packages to the latest version by using sudo apt upgrade
command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:3 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:7 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Hit:8 https://download.sublimetext.com apt/stable/ InRelease
Get:9 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [59.9 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [95.4 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [274 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B]
Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [409 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:16 http://in.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [8,000 B]
Get:17 http://in.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.5 kB]
Fetched 1,216 kB in 8s (158 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
.............................................................................
Step 3: Install Juju
In the next step, you can install Juju client as either a snap package or as a binary file as explained below.
a) Using Snapd
If you are looking to install Juju client as snap package then you need to run sudo snap install juju --classic
command as shown below.
cyberithub@ubuntu:~$ sudo snap install juju --classic [sudo] password for cyberithub: juju (2.9/stable) 2.9.42 from Canonical** installed
b) Using Binary File
You need to go to official website and download the appropriate version as per your local system architecture. We are downloading the latest version for amd64
architecture using below curl
command.
cyberithub@ubuntu:~$ curl -LO https://launchpad.net/juju/3.2/3.2-rc1/+download/juju-3.2-rc1-linux-amd64.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 35.3M 100 35.3M 0 0 4236k 0 0:00:08 0:00:08 --:--:-- 7078k
After successfully downloading the package, you need to extract it by using below tar
command. Below command will extract the binary file in current working directory.
cyberithub@ubuntu:~$ tar xf juju-3.2-rc1-linux-amd64.tar.xz
Then you need to install the binary to /usr/local/bin
directory by running below command.
cyberithub@ubuntu:~$ sudo install -o root -g root -m 0755 juju /usr/local/bin/juju
Step 4: Check Version
If you install juju as a snap package then you might see different version in comparison to binary file installed from official website when you run juju --version
command. For example, in my case it is showing 2.9.42
as you can see below.
cyberithub@ubuntu:~$ juju --version 2.9.42-ubuntu-amd64
If you install the binary package then it might show different version depending on which one you have installed. For example, in my case I have installed the latest binary package from official website which is 3.2
at the time of writing this article. It could be different for you depending on when you are checking.
cyberithub@ubuntu:~$ juju --version 3.2-rc1-ubuntu-amd64
Step 5: Create a New Controller
Now that juju client is installed, you are now ready to setup your model. But before that you need to make sure a controller is either already available so that you can connect it by using juju register
command or if not available then you need to create one. In our case, we do not have any controller available so we are going to create a new one by running juju bootstrap
command as shown below. While running below command, you will be asked to select your cloud and and enter a meaningful name of controller.
cyberithub@ubuntu:~$ juju bootstrap Clouds aws aws-china aws-gov azure azure-china equinix google localhost oracle Select a cloud [localhost]: Enter a name for the Controller [localhost-localhost]: juju-localhost Creating Juju controller "juju-localhost" on localhost/localhost Looking for packaged Juju agent version 2.9.42 for amd64 Located Juju agent version 2.9.42-ubuntu-amd64 at https://streams.canonical.com/juju/tools/agent/2.9.42/juju-2.9.42-linux-amd64.tgz To configure your system to better support LXD containers, please see: https://linuxcontainers.org/lxd/docs/master/explanation/performance_tuning/ Launching controller instance(s) on localhost/localhost... - juju-6641c7-0 (arch=amd64) Installing Juju agent on bootstrap instance Fetching Juju Dashboard 0.8.1 .......................................................................
NOTE:
juju bootstrap
command over SSH connection as you might face connection reset error in between resulting in bootstrap failure. You need to always run this command physically on the server or on your system.
Step 6: Setup a Model
Once a controller is available, you can setup a model by using juju client. For example, here we are setting up a model called example using juju add-model example
command as shown below.
cyberithub@ubuntu:~$ juju add-model example
Added 'example' model on localhost/localhost with credential 'localhost' for user 'admin'
Step 7: Destroy a Model
You can also destroy a model once you are done with it using juju destroy-model
command. Here we are destroying a model called example using juju destroy-model example
command as shown below.
cyberithub@ubuntu:~$ juju destroy-model example WARNING! This command will destroy the "example" model. This includes all machines, applications, data and other resources. Continue [y/N]? y Destroying model Waiting for model to be removed... Model destroyed.
Step 8: Uninstall Juju
Once you are done with Juju client, you can choose to uninstall it from your System by using one of the below method depending on how you installed it.
a) Using Snapd
If you installed juju client as a snap package then to remove you need to run sudo snap remove juju
command as shown below.
cyberithub@ubuntu:~$ sudo snap remove juju [sudo] password for cyberithub: juju removed
b) Manual Removal
If you installed the binary package then removal is pretty easy. You just need to remove the binary file from /usr/local/bin
directory by using sudo rm -rf /usr/local/bin/juju
command as shown below.
cyberithub@ubuntu:~$ sudo rm -rf /usr/local/bin/juju
[sudo] password for cyberithub: