PureOS provides convenient pre-built images for use on computer and in Virtual Machines, you can find those images here: https://downloads.puri.sm/
It is also possible to build a PureOS image from scratch from the PureOS repos. Purism does this when we want to test the reproducibility of a PureOS image.
[[Development/Reproducible ISOs]] Use this document to read more detail about how we check byte-for-byte reproducible images.
**Build a PureOS image**
1. **Prepare an appropriate environment. **
//If you're already running PureOS on your build machine, then you're all set. If you're running another GNU/Linux distribution it is likely best to set up a chroot or to use a tool like debspawn (discussed below.)//
2. **Install live-build and other tools**
$ apt install live-build git ca-certificates
3. **Clone via git our configuration for PureOS**
$ cd /srv && git clone https://source.puri.sm/pureos/infra/make-live.git
$ cd /srv/make-live
Currently we build a number of images; gnome-live, gnome-oem, plasma-live. Exporting the type of image you want into your environment is needed if you want to overide the default;
$ export FLAVOR="gnome-oem"
If no FLAVOR variable is set, the GNOME Live Flavor will be built by default.
4. Run `lb config`
5. Run `lb build`
6. **Have fun with a fresh new PureOS image!**
**Building images with [[ https://github.com/lkorigin/debspawn | Debspawn ]]**
The above steps can be sped up a lot and be automated by using debspawn, which is used to create the official PureOS images in a controlled environment.
In order to use debspawn, just follow these steps:
1) Run `sudo apt install debspawn`
2) Then run `debspawn create green`
3) Create a new "build-pureos.sh" file with the following contents:
apt-get install -y git ca-certificates
apt-get install -y live-build
git clone --depth=2 https://source.puri.sm/pureos/infra/make-live.git
b2sum *.iso *.contents *.zsync *.packages > checksums.b2sum
sha256sum *.iso *.contents *.zsync *.packages > checksums.sha256sum
mv *.iso /srv/artifacts
mv -f *.zsync /srv/artifacts
mv -f *.contents /srv/artifacts
mv -f *.files /srv/artifacts
mv -f *.packages /srv/artifacts
mv -f *.b2sum /srv/artifacts
mv -f *.sha256sum /srv/artifacts
4) Make the .sh file executable and set the FLAVOR you want.
5) Tell debspawn to run the build and where to place the build result:
```debspawn run --external-command --artifacts-out=/where/to/put/the/built/image green /path/to/build-pureos.sh```
This should give you a replica of what our autobuilders did. You can also take a look at the actual code in Spark:
[[ https://github.com/lkorigin/laniakea-spark/blob/master/spark/runners/image_build.py#L30 | image_build.py ]]
Should you get an error regarding the PureOS Keyring when building with debspawn;
I: Keyring file not available at /usr/share/keyrings/pureos-archive-keyring.gpg; switching to https mirror https://deb.debian.org/debian
I: Retrieving InRelease
I: Retrieving Release
E: Failed getting release file https://deb.debian.org/debian/dists/green/Release
This is easily fixed if you're on a PureOS system. Simply install via apt the keyring;
```$ apt install pureos-archive-keyring```
Otherwise you can download and install the deb from here: https://repo.pureos.net/pureos/pool/main/p/pureos-archive-keyring/