These notes should be read in conjunction with the README notes.

=== Generic Setup Steps for a PCP QA VM ===

(a) get the smallest possible boot media, install and boot
(b) check hostname, timezone and date-time are correct
(c) setup DNS: my server is bozo (192.168.1.100) and needs the VM to
    have localdomain in the domain search list
(d) change from DHCP (if setup during install) to fixed IP addresses,
    as per the DNS configured on bozo (other VMs need to be able to find
    you, and my local DHCP is not hooked into the DNS)
(e) if the install was done with a user different to the one you're going
    to run QA with, you need to set up the QA
(f) make sure the user you're going to run QA with can sudo without
    a password
(g) make sure there is no firewall, or if there is one the ports mentioned
    in qa/README (pmcd, pmlogger control, pmproxy, etc) are open
(h) git clone the PCP tree
(i) cd qa/admin and run list-packages -p until you're tired ...
    - the files in qa/admin/package-lists are the inventories for each
      distribution, version and architecture we know about ... see the
      README in that directory if you need to create a new package-list
      file ... and send it back to us for inclusion, please

If you're NOT going to run any of the -g remote tests, then you don't need
steps (c) or (d).

The specific details for (b), (e), (f) and (g) are platform and distro
version specific I'm afraid ... good luck with that!

=== Distro Releases and Packaging Hints ===

Ubuntu
    https://wiki.ubuntu.com/Releases
    13 Sep 2021: 20.04 LTS (Focal), 18.04 (Bionic) 16.04 LTS (Xenial), 14.04 LTS (Trusty)
    04 Jun 2018: 18.04 (Bionic) 17.10 (Artful), 16.04 LTS (Xenial),
		 14.04.3 LTS (Trusty),
    # which packages are installed
    $ dpkg-query -W -f '${package}\n'
    # package search recipe (name and info or description)
    $ dpkg-query -l <pattern>
    # which package installs a file/directory (only installed packages)
    $ dpkg-query -S file-or-dir-path
    # to find package for an uninstalled file/directory
    https://packages.debian.org/search
    # which files are in an installed package
    $ dpkg -l <package>
    # package install recipe
    $ sudo apt install <package>
    # update all packages recipe
    $ sudo apt update; sudo apt dist-upgrade
    # release upgrade recipe ... update, then
    $ sudo do-release-upgrade

Debian
    https://wiki.debian.org/DebianReleases
    17 Nov 2015: 6.0 (squeeze), 7.0 (wheezy) and 8.0 (jessie)
    04 May 2016: 7.0 (Wheezy), 8.0 (Jessie) and 9.0 (Stretch)
    15 Sep 2021: 10 (Buster) and 11 (Bullseye)
    # see Ubuntu for most notes
    #
    # release upgrade reciple
    # make sure everything is up to date
    $ sudo apt update; sudo apt upgrade
    # In a text editor, replace the codename of your release with that
    # of the next release in APT's package sources
    # For instance, the line
    #    deb https://deb.debian.org/debian/ buster main
    # should be replaced with
    #    deb https://deb.debian.org/debian/ bullseye main
    $ sudo vi /etc/apt/sources.list /etc/apt/sources.list.d/*
    # Clean and update package lists
    $ sudo apt clean; sudo apt update
    # Perform the major release upgrade, removing packages if required
    $ sudo apt full-upgrade
    # Remove packages that are not required anymore
    $ sudo apt autoremove
    # Reboot to make changes effective (optional, but recommended)
    $ sudo shutdown -r now

Fedora
    https://fedoraproject.org/wiki/Releases
    23 Sep 2018: 27 & 28
    23 Aug 2020: 31 & 32
    07 Sep 2021: 33 & 34
    # which packages are installed
    $ rpm -qa --qf '%{NAME}\n'
    # package search recipe (name and info or description)
    $ dnf search <pattern>
    # which package installs a file/directory
    $ rpm -qF <path>
    # which files are in an installed package
    $ rpm -ql <package>
    # update all packages recipe
    $ sudo dnf update
    # upgrade recipe from Fedora 21 onwards
    $ sudo dnf --refresh update; sudo dnf install dnf-plugin-system-upgrade
    $ sudo dnf install fedora-gpg-keys

    # only upgrade from N to N+1 is supported
    # for Fedora 33, else "33" replaced by the desired version number
    $ ver=33
    $ sudo dnf --refresh upgrade
    $ sudo dnf system-upgrade download --allowerasing --releasever=$ver
    $ sudo dnf system-upgrade reboot
    # and then watch the console window ...

    # recipe below works (at least) for Fedora 34
    # setting up a static IP addr using nmcli (assume interface enp1s0)
    $ if=enp1s0
    $ sudo connection modify IPv4.address 192.168.178.226/24
                                                      ^^^ 200 + vm ordinal, e.g vm26 here
    $ sudo nmcli connection modify $if IPv4.gateway 192.168.178.1
    $ sudo nmcli connection modify $if IPv4.dns 192.168.178.100
    $ sudo nmcli connection modify $if IPv4.dns-search localdomain
    $ sudo nmcli connection modify $if IPv4.method manual
    $ sudo nmcli connection down $if
    $ sudo nmcli connection up $if

RedHat
    https://access.redhat.com/articles/3078
    17 Nov 2015: 5.0-5.11, 6.0-6.7, 7.0-7.1
    23 Aug 2017: 5.0-5.11, 6.0-6.9, 7.0-7.4
    # which packages are installed
    $ rpm -qa --qf '%{NAME}\n'
    # package search recipe (name and info or description)
    $ yum search <pattern>
    # which package installs a file/directory
    $ rpm -qF <path>
    # which files are in an installed package
    $ rpm -ql <package>
    # package install recipe
    $ sudo yum install <package>
    # update all packages recipe
    $ sudo yum update
    # upgrade recipe
    $ ???
    # sort packages on installed size, smallest to largest
    $ rpm -qa --qf '%{SIZE} %{NAME}\n' | sort -k1 -n

    Update.  As of RHEL 8, dnf is preferred over yum.

    Note on dnf modules.
    To get libuv-devel installed on RHEL8 needed this recipe from Andreas.
    # dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    # dnf install -y libuv
    # dnf module install -y libuv/devel
    # rpm -q libuv-devel
    libuv-devel-1.23.1-2.module_el8+8698+518af944.x86_64

CentOS
    https://en.wikipedia.org/wiki/CentOS#CentOS_releases
    17 Nov 2015: 5.0-5.11, 6.0-6.7, 7.0 and 7.1
    19 Apr 2017: 6.0-6.7, 7.0-7.3
    25 Sep 2018: 6.*, 7.1-7.5
    # everything the same as RedHat
    # promising CentOS 7 -> CentOS 8 upgrade recipe at
      https://www.tecmint.com/upgrade-centos-7-to-centos-8/
      but it does not work ... CentOS 8 needs to be a reinstall
      then
    # sudo dnf install epel-release -y

openSUSE
    https://en.opensuse.org/Lifetime
    16 Oct 2019: 15.0 and 15.1
    15 Sep 2021: 15.2 and 15.3
    # which packages are installed
    $ rpm -qa --qf '%{NAME}\n'
    # package search recipe (name and info or description)
    $ zypper search -s <pattern>
    # which package installs a file/directory
    $ rpm -qF <path>
    # which files are in an installed package
    $ rpm -ql <package>
    # package install recipe
    $ sudo zypper install <package>
    # update all packages recipe
    $ sudo zypper refresh; sudo zypper update
    # upgrade recipe ... e.g from 42.2 to 42.3
    $ sudo sed -i 's/42\.2/42.3/g' /etc/zypp/repos.d/*
    $ sudo zypper --gpg-auto-import-keys ref
    # and then in a console window
    $ sudo zypper dup

SUSE (SLES)
    https://www.suse.com/lifecycle/
    18 Nov 2105: 11 SP4 and 12 SP1
    # which packages are installed
    $ rpm -qa --qf '%{NAME}\n'
    # package search recipe (name and info or description)
    $ zypper search -s <pattern>
    # which package installs a file/directory
    $ rpm -qF <path>
    # which files are in an installed package
    $ rpm -ql <package>
    # package install recipe
    $ sudo zypper install <package>
    # update all packages recipe
    $ sudo zypper refresh; sudo zypper update
    # release upgrade recipe
    # once only ...
    $ sudo zypper install zypper-migration-plugin
    # then
    $ sudo zypper update; sudo zypper patch
    $ sudo zypper migration

FreeBSD
    https://www.freebsd.org/security/security.html#sup
    26 Sep 2018: 10, 10.4, 11 and 11.2
    17 Oct 2019: 11.2, 11.3 and 12.0
    # which packages are installed
    $ pkg info -a | sed -e 's/-[0-9].*//'
    # package search recipe (name and info or description)
    $ pkg search <pattern>
    # which package installs a file/directory
    $ pkg which file-or-dir-path
    # which files are in an installed package
    $ pkg list pkgname
    # package install recipe
    $ sudo pkg install <package>
    # update all packages recipe
    $ sudo pkg update; sudo pkg upgrade
    # release upgrade recipe
    $ sudo freebsd-update fetch; sudo freebsd-update install
    # has to be a N.M-RELEASE version for -r
    $ sudo freebsd-update upgrade -r 11.2-RELEASE; sudo freebsd-update install
    $ sudo reboot
    ...
    $ sudo freebsd-update install
    $ sudo pkg update; sudo pkg upgrade

    on vm32:
    Message from gcc6-6.4.0_7:

    To ensure binaries built with this toolchain find appropriate versions
    of the necessary run-time libraries, you may want to link using

      -Wl,-rpath=/usr/local/lib/gcc6

    For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens
    transparently.

NetBSD
    http://www.netbsd.org/releases/formal.html
    23 Nov 2015: 6.1.5 and 7.0
    14 Feb 2018: 6.1.5 and 7.1.1
    # --- pkgin for pre-build binaries ---
    # which packages are installed
    $ pkg_info -a | sed -e 's/-[0-9].*//'
    # package search recipe (name and info or description)
    $ pkgin search <pattern>
    # which package installs a file/directory
    $ pkg_info -F <path>
    # which files are in an installed package
    $ pkgin pkg-content <package>
    # available packages
    $ pkgin avail | grep <pattern> (matches name or summary)
    # installed packages
    $ pkgin list
    # package install recipe
    $ sudo pkgin install <package>
    # update all packages recipe
    $ sudo pkgin update; sudo pkgin full-upgrade
    # release upgrade recipe
    $ ???
    # --- pkgsrc for source --
    $ sudo pkgin install cvs
    # run everything as root, after cd /usr
    # to seed with the 2018Q3 stable release
    # cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2018Q3 -P pkgsrc
    # to update CVS
    # cd /usr/pkgsrc && cvs update -dP

Gentoo
    https://wiki.gentoo.org/wiki/Main_Page
    No concept of versions, just install latest.
    # which packages are installed
    $ equery list '*' | sed -e 's/.*].*] //' -e 's/-[0-9].*//'
    # package search recipe - names
    $ emerge --search |-s somestring
    $ emerge --search |-s "%someregexp"
    # package search recipe - descriptions
    $ emerge --searchdesc|-S somestring
    # which package installs a file/directory
    $ equery belongs <full-pathname>
    # which files are in an installed package
    $ equery files <package>
    # package install recipe
    $ sudo emerge --ask <package> [...]
    # update all packages recipe
    No real concept of releases ... just weekly updates
    $ sudo emerge --sync
    # simple
    $ sudo emerge --update --ask @world
    # after some time may need
    $ sudo emerge --update --backtrack=100 --deep --with-bdeps=y --newuse --ask @world
    # ...
    $ sudo emerge --depclean
    # may need to rm -rf /var/tmp/portage if lots of updates
    # release upgrade recipe
    N/A

Linux Mint
    http://www.linuxmint.com/oldreleases.php
    24 Dec 2015: 13 (LTS), 17 (LTS)
    # same as Ubuntu
    
OpenMandriva
    https://wiki.openmandriva.org/en/Category:Releases
    9 Aug 2020: 2014.2 3.3 4.0 4.1
    20 Oct 2021: 4.1 4.2 4.3
    # same as Fedora now
    ...
    # for 4.1 -> 4.2 this looks promising
    https://forum.openmandriva.org/t/how-to-upgrade-from-rock-lx-4-1-to-lx-4-2/3791
    - update repository source to Release
    - dnf clean-all
    - sudo dnf clean-all
    - sudo dnf upgrade
    - revert repository source to Rock
    - dnf clean all
    - sudo dnf clean all ; sudo dnf --allowerasing distro-sync

Slackware
    https://www.slackware.com
    27 June 2016: 14.1
    # which packages are installed
    $ ls /var/log/packages | sed -e 's/-[0-9].*//'
    # package search recipe (name only)
    $ sudo slackpkg search <info-pattern>
    # which package installs a file/directory
    $ sudo slackpkg file-search <filename-pattern>
    # which files are in an installed package
    $ sed -e '1,/^FILE LIST:/d' </var/log/packages/<package>
    # package install recipe
    $ sudo slackpkg install <package>
    # update all packages recipe
    $ sudo slackpkg update; sudo slackpkg install-new
    # release upgrade recipe
    $ sudo slackpkg upgrade-all; sudo slackpkg clean-system

Arch Linux
    https://www.archlinux.org/releng/releases/
    05 Oct 2020: 2020.10.01 2020.09.01 2020.08.01
    # after virgin install, need at least this to get going
    $ sudo pacman -S inetutils	# for hostname(1)
    $ sudo pacman -S iputils	# for ping(1)
    $ sudo pacman -S which	# for which(1)
    # which packages are installed
    $ pacman -Q -i | sed -n -e '/^Name /s/.* : //p'
    # package search recipe (name and info or description)
    $ pacman -S -l | grep <package-name-pattern>
    $ pacman -S -s <regexp>
    # which package installs a file/directory
    $ pacman -Q -o <path> | <filename>
    # which files are in an installed package
    $ sudo pacman -F -y (refresh files database) then
    $         pacman -F -l <package> (files in a package)
    $         pacman -F -o <fullpath> (package(s) owning a file)
    $         pacman -F -x <regexp> (package(s) owning matching files)
    # package install recipe, always do 
    $ sudo pacman -Syu
    # then install the package ... never try to upgrade a package
    $ sudo pacman -S <package>
    # update all packages recipe
    $ sudo pacman -Sy archlinux-keyring
    $ sudo pacman -Syyu
    # clean pacman cache
    $ sudo pacman -Sc

OpenIndiana
    https://www.openindiana.org/download/
    17 Aug 2016: 2016.04
    # initial setup to get rid of restricitions and to get up to date ...
    $ sudo pkg uninstall userland-incorporation entire
    $ sudo pkg update
    # then need a reboot if pkg reports
    # 	Create boot environment: Yes
    # because the boot environment will have changed
    # which packages are installed
    $ pkg list -H | sed -e 's/ .*//'
    # package search recipe (name and info or description)
    $ pkg search -pr <pattern>
    # which package installs a file/directory
    $ pkg contents -H -o pkg.name -a path=<path without leading slash>
    # which files are in an installed package
    $ pkg contents <package>
    # package install recipe
    $ sudo pkg install <package>
    # update all packages recipe
    $ sudo pkg update
    # release upgrade recipe
    $ ???
    # to show zfs snapshots
    $ zfs list -t snapshot
    # to remove zfs snapshots
    $ sudo zfs destroy [-R] <name@date>

OpenBSD
    https://en.wikipedia.org/wiki/OpenBSD_version_history
    24 Aug 2020: 6.6, 6.7
    13 Sep 2021: 6.8, 6.9
    # package search recipe (name only, not info or description)
    $ pkg_info -Q <pattern>
    # which package installs a file/directory
    $ pkglocate <filename> or <pathname>
    # which files are in an installed package
    $ pkg_info -L <package>
    # package install recipe
    $ sudo pkg_add <package>
    # update all packages recipe
    $ sudo pkg_add -u
    # release upgrade recipe
    $ cd /tmp
    $ wget https://mirror.vdms.com/pub/OpenBSD/6.7/amd64/bsd.rd
                                                   ^^^^^ architecture
					       ^^^ new version		   
    $ wget https://mirror.vdms.com/pub/OpenBSD/6.7/amd64/SHA256.sig
    $ signify -C -p /etc/signify/openbsd-67-base.pub -x SHA256.sig bsd.rd
                                         ^^ new version, no "."
    $ sudo mv /bsd.rd /bsd.rd.6.3
    			      ^^^ old version
    $ sudo mv bsd.rd /bsd.rd
    $ sudo ln /bsd.rd /bsd.rd.6.7
    			      ^^^ new version
    $ sudo reboot
    and in console window, when boot> prompt appears, enter
    boot /bsd.rd
    Welcome to the OpenBSD/amd64 6.4 installation program.
    (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? u
    ...
    reboot
    $ sudo sysmerge
    $ sudo syspatch
    $ sudo reboot (if instructed to do so)
    $ sudo pkg_add -u

Template
    URL
    DATE: VERSION(S)
    # which packages are installed
    # package search recipe (name and info or description)
    # which package installs a file/directory
    # which files are in an installed package
    # package install recipe
    # update all packages recipe
    # release upgrade recipe

=== Package Hit List of Removal Candidates ===

If you're short of space, or have long-standing VMs that you'd like to
minimize update times for, the following list of packages are ones that
are commonly installed and are not needed for PCP builds nor QA.

    qt4-doc qt5-doc nodejs-docs libx11-doc
    imagemagick libreoffice* libfreerdp freerdp*
    cups foomatic-filters foomatic-db-filesystem hplip*
    sane xsane libsane libksane sane-backends*
    brasero evince totem evolution thunderbird firefox
    gimp ghostscript* busybox mono* libmono-* *games*
    espeak espeak-data aspell ispell hunspell hyphen
    atril analog coinor shotwell synaptic wamerican samba* libsamba*
    lohit-*-fonts adobe-source-han-sans-* cjkuni-uming-fonts
    wqy-zenhei-fonts julietaula-montserrat-fonts naver-nanum-fonts-common
    abattis-cantarell-fonts
    naver-nanum-gothic-fonts gnome-orca ndiswrapper* libhangul* libpinyin*
    libzhuyin*

=== Miscellaneous Hints ===

Extending a root LVM with device-mapper by adding a partition
    From
    https://serverfault.com/questions/810221/how-to-correctly-extend-a-linux-device-mapper-partition
    or
    https://rbgeek.wordpress.com/2013/01/27/how-to-extend-the-root-partition-in-lvm/
    Assume device-mapper vgname fedora-server
    Assume partiton to add is partiton 1 of /dev/vdb
    $ disk=/dev/vdb
    $ sudo cfdisk $disk		<- make 1 partition, all of the disk
    $ sudo pvcreate ${disk}1	<- initialize partition for use with LVM
    $ sudo vgdisplay		<- get volume group name
    $ vg=<name>			<- from above will be "fedora-server" or
    				   "centos" or similar
    $ sudo vgextend /dev/$vg ${disk}1	<- extend the volume group
    $ sudo lvextend -l +100%FREE /dev/$vg/root	<- extend LVM
    # for ext2
    $ sudo resize2fs /dev/$vg/root		<- extend filesystem
    # for xfs
    $ sudo xfs_growfs /				<- extend filesytem

Just remember that if you're using XFS, you need xfs_growfs instead of
resize2fs.
