Build UCCS Ubuntu Focal (amd64) LXC / PVE Template

  • install temporary proxmox ve install in KVM VM
  • aptitude install dab
  • make a temporary directory with the following files (based on PVE debian minimal and debian 64-bit vm's):

dab.conf:

Suite: focal
CacheDir: ../cache
Source: http://mirror.cs.uchicago.edu/ubuntu SUITE main restricted universe multiverse
Source: http://mirror.cs.uchicago.edu/ubuntu SUITE-updates main restricted universe multiverse
Source: http://mirror.cs.uchicago.edu/ubuntu SUITE-security main restricted universe multiverse
#Source: http://mirror.cs.uchicago.edu/puppet SUITE puppet6 # not available yet
Source: http://mirror.cs.uchicago.edu/puppet bionic puppet6
Architecture: amd64
Name: ubuntu-20.04-uccs
Version: 20.04-uccs1
Section: system
Maintainer: Tom Dobes <tdobes@cs.uchicago.edu>
Infopage: http://howto.cs.uchicago.edu/
Description: Ubuntu Focal for UChicago CS
 A base Ubuntu Focal amd64 install plus UCCS stuff (e.g. Puppet)

Makefile:

define TIMESYNCD_CONF
[Time]
NTP=ntp-0.uchicago.edu ntp-1.uchicago.edu ntp-2.uchicago.edu ntp.cs.uchicago.edu
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org
endef

define PUPPET_CONF
[agent]
server = puppet.cs.uchicago.edu
environment = server
#certname = hostname.cs.uchicago.edu
endef

BASEDIR:=$(shell dab basedir)

export TIMESYNCD_CONF
export PUPPET_CONF
all: info/init_ok
	dab bootstrap --minimal

	sed -e 's/^# en_US.UTF-8/en_US.UTF-8/' -i ${BASEDIR}/etc/locale.gen
	echo "LANG=en_US.UTF-8" > ${BASEDIR}/etc/default/locale
	dab exec dpkg-reconfigure -f noninteractive locales

	mkdir -p ${BASEDIR}/root/.ssh
	echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3kOWMhOJuu79zdZKNTDCQX1M+1jI15wTMsKLRx1VYSKIred//66C3q5feA9Sj9iKcLOtslH03LmjZ49Quo7E5AXt8SAzn6sqyfFz8kad6Fv4ECoM78OJ+UIUM8fjJJfn7n+DdGie95y7r2qai3ac7ELP50MLYYIv7GdO3Uv7wyEJoillEZCYC1LObzGd4VOqvyNrf2eq+VChiddmtYUltmTIWuQsTyLocQGAuM7vg1R/iUO+5x0TYoYPRnpHbrfqfJK+PCQocbx9vXq/pXGi0eYsLT1c1CzAmuAAfLcv4Y+FcfVJVyqGHCkU08J13BQ7aIlUv2tVQNXxthx0BiSk8w== root@puppet.cs.uchicago.edu' > ${BASEDIR}/root/.ssh/authorized_keys

	ln -sf /usr/share/zoneinfo/America/Chicago ${BASEDIR}/etc/localtime
	echo "America/Chicago" > ${BASEDIR}/etc/timezone
	dab exec dpkg-reconfigure -f noninteractive tzdata

	echo "$$TIMESYNCD_CONF" > ${BASEDIR}/etc/systemd/timesyncd.conf

	dab install gnupg # dependency of apt-key add
	dab install nano # We install this by default, according to Foreman

	dab install puppet-agent
	echo "$$PUPPET_CONF" > ${BASEDIR}/etc/puppetlabs/puppet/puppet.conf

	dab exec /opt/puppetlabs/bin/puppet agent --enable
	# apparently we don't need this:
	#echo '#!/bin/sh' > ${BASEDIR}/etc/rc.local
	#echo "sed -i -e 's/^#certname = .*\$/certname = '\`hostname -f\`'/g' /etc/puppetlabs/puppet/puppet.conf" >> ${BASEDIR}/etc/rc.local
	#echo 'rm /etc/rc.local' >> ${BASEDIR}/etc/rc.local
	#chmod 0755 ${BASEDIR}/etc/rc.local

	rm ${BASEDIR}/etc/ssh/ssh_host_*_key*
	dab finalize

info/init_ok: dab.conf
	dab init
	touch $@

.PHONY: clean
clean:
	dab clean
	rm -f *~

.PHONY: dist-clean
dist-clean:
	dab dist-clean
	rm -f *~

Note that when testing this you need to be sure to run dab init before the commands in the 'all' section. Also, note that it's important that the dpkg-reconfigure for locales go BEFORE setting the contents of the /etc/default/locale file, or else it will get commented out.

  • run make in that directory (Note: Since dab is in /usr/sbin/, this has to be done as root)
computer/build_ubuntu_focal_amd64_lxc_pve_template.txt · Last modified: 2020/04/23 10:53 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS