Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing Juju 2.0 on Centos7

Juju 2.0 on Centos7

Configure epel repository

yum -y install epel-release
yum repolist

Install LXD

Install lxc libraries

yum -y install python-requests
rpm --nodeps -i
yum copr enable thm/lxc2.0
yum -y install lxc lxc-devel

Build from source

yum install -y golang-bin git make dnsmasq squashfs-tools
mkdir ~/go
export GOPATH=~/go
go get
cd $GOPATH/src/

Add to path

cp $GOPATH/bin/* /usr/bin

Start LXD daemon

We want to setup systemd to manage LXD, and ensure that LXD will start after a reboot.

Create the file /etc/systemd/system/lxd.service with the following contents:

Description=LXD Container Hypervisor

ExecStart=/usr/bin/lxd --group lxd --logfile=/var/log/lxd/lxd.log

Once you've saved that file, enable, start, and set the service to start on boot:

addgroup lxd

mkdir -p /var/log/lxd
systemctl enable lxd
systemctl start lxd
ln -s /etc/systemd/system/lxd.service /etc/systemd/system/

Configure LXD

The first time LXD is run, we need to setup the storage backend and virtual network bridge. For optimal performance, we recommend using zfs-backed storage. Create a virtual network bridge, enabling ipv4 but disabling ipv6.

lxd init

Testing LXD

Launch an instance to verify that LXD is working. The first launch of an image will take the longest because it needs to download (and cache) the image.

lxc launch ubuntu:16.04
lxc list

Install Juju

curl -o juju-2.0.2-centos7.tar.gz -L
tar zxf juju-2.0.2-centos7.tar.gz
mkdir -p  /usr/lib/juju-2.0/bin
cp juju-bin/* /usr/lib/juju-2.0/bin 
update-alternatives --install /usr/bin/juju juju /usr/lib/juju-2.0/bin/juju 1

Once this is completed, Juju is installed on your system. You can confirm this by running juju, which will display usage information.



mkdir ~/.ssh
chmod 700 .ssh
ssh-keygen -t rsa

This comment has been minimized.

Copy link

commented Apr 13, 2017

I've followed your instructions on CentOS 7 but ran into an issue-you're missing adding the lxd group to the system, once I added that I was able to start lxd.


This comment has been minimized.

Copy link

commented Apr 28, 2017

Same problem, same solution!



This comment has been minimized.

Copy link

commented Jun 28, 2017

anyone getting this ?

[root@localhost ~]# lxc launch ubuntu:16.04
Creating the container
Container name is: popular-porpoise
error: Failed to fetch http://unix.socket/1.0/containers//state: 301 Moved Permanently


This comment has been minimized.

Copy link

commented Aug 30, 2017

Running the lxd init command returns the following error saying there is a bad command line option supplied to dnsmasq when it is executed:

error: Failed to run: dnsmasq --strict-order --bind-interfaces --pid-file=/var/lib/lxd/networks/lxdbr0/ --except-interface=lo --interface=lxdbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address= --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/lib/lxd/networks/lxdbr0/dnsmasq.leases --dhcp-hostsfile=/var/lib/lxd/networks/lxdbr0/dnsmasq.hosts --dhcp-range,,1h --listen-address=fd42:225c:bee5:3f1e::1 --enable-ra --dhcp-range ::,constructor:lxdbr0,ra-stateless,ra-names -s lxd -S /lxd/ --conf-file=/var/lib/lxd/networks/lxdbr0/dnsmasq.raw -u nobody: dnsmasq: bad command line options: try --help

Is there a place I can can go to edit the parameters sent?


This comment has been minimized.

Copy link

commented Jan 4, 2018

To fix problem Plugin "copr" can't be imported when run yum copr enable thm/lxc2.0, need to install python-requests.

pip install requests


This comment has been minimized.

Copy link

commented Feb 16, 2018

the lxd repo location has changed as well. this is from the

go get -d -v
cd $GOPATH/src/

This comment has been minimized.

Copy link

commented Jun 16, 2018


In this method, there is a problem - packages for Fedora are more likely to not work in CentOS, because they need dependencies for work that are not in CentOS (let's not forget that Fedora software is newer).

For the solution, it's easiest to download the package from the repository to the server with CentOS, and then use the "yum-builddep" and "rpmbuild -rebuild" commands to re-compile the package specifically for CentOS.

Less is a matter of updating programs, many things have to be done manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.