Skip to content

Instantly share code, notes, and snippets.

Embed
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 https://copr-be.cloud.fedoraproject.org/results/alonid/yum-plugin-copr/epel-7-x86_64/00110045-yum-plugin-copr/yum-plugin-copr-1.1.31-508.el7.centos.noarch.rpm
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 github.com/lxc/lxd
cd $GOPATH/src/github.com/lxc/lxd
make

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:

[Unit]
Description=LXD Container Hypervisor
Requires=network.service

[Service]
ExecStart=/usr/bin/lxd --group lxd --logfile=/var/log/lxd/lxd.log
KillMode=process
TimeoutStopSec=40
KillSignal=SIGPWR
Restart=on-failure
LimitNOFILE=-1
LimitNPROC=-1

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/multi-user.target.wants/lxd.net

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 https://launchpad.net/juju/2.0/2.0.2/+download/juju-2.0.2-centos7.tar.gz
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.

Configuration

SSH

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

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.

@shantanugadgil

This comment has been minimized.

Copy link

commented Apr 28, 2017

@troyfontaine
Same problem, same solution!
Thanks!!!

Regards,
Shantanu

@ghost

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
Starting
error: Failed to fetch http://unix.socket/1.0/containers//state: 301 Moved Permanently

@aboseman

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/dnsmasq.pid --except-interface=lo --interface=lxdbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=10.214.134.1 --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 10.214.134.2,10.214.134.254,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?

@koolay

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

@ipan

This comment has been minimized.

Copy link

commented Feb 16, 2018

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

go get -d -v github.com/lxc/lxd/lxd
cd $GOPATH/src/github.com/lxc/lxd
make
@alexdndz1

This comment has been minimized.

Copy link

commented Jun 16, 2018

Hey.

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.