Howard Shane
Howard Shane

Reputation: 956

Cloud-init: how to install it from the source code?

I have a Ubuntu 1604 VM on Azure, which by default has cloud-init installed.

To debug a cloud-init issue, I removed the default cloud-init (apt remove cloud-init) and cloned the source code from https://git.launchpad.net/cloud-init/ and want to build my version of cloud-init to debug.

Could you please help me:

  1. How to compile cloud-init from the source code tree?
  2. How to install cloud-init from my local source?

thanks!

Upvotes: 2

Views: 4203

Answers (1)

Bruno Bronosky
Bruno Bronosky

Reputation: 70319

I was pleased to find that, even though it is terribly [un]documented, it is easy to clone, build, and install the latest.

git clone https://github.com/cloud-init/cloud-init.git
cd cloud-init
sudo pip3 install -r requirements.txt 
sudo python3 setup.py build
sudo python3 setup.py install --init-system systemd
sudo cloud-init init --local
sudo cloud-init status

sudo ln -s /usr/local/bin/cloud-init /usr/bin/cloud-init
for svc in cloud-init-local.service cloud-init.service cloud-config.service cloud-final.service; do
  sudo systemctl enable $svc
  sudo systemctl start  $svc
done

I haven’t managed to use this new version yet. I will [continue to] update this answer if there are additional considerations.

Note: I am working on a demo that would use user-data and meta-data files in /var/lib/cloud/seed/nocloud-net/

Credit: https://www.ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com.ibm.zvm.v640.hcpo5/instsubuntu.htm

Upvotes: 2

Related Questions