Shell scripts and configuration files are stored on rootfs to build RootFS in .wsl format.
Each distro and major version has own builder scripts. Each scripts has these positional parameters:
minor_version: Minor version of AlmaLinux OS 10. When not given, it is derived from thealmalinux-releasepackage in the BaseOS repository the image is built from (seetools/almalinux-release.shbelow), so it always matches the latest minor release without any hardcoded version.build_number: The build number of the version. Default value is the0as a first build of a version.
Example: AlmaLinux OS 10 with the derived minor version (e.g. 2 for 10.2) and build number (e.g. 20250801.0).
With default values.
bash -x rootfs/almalinux_10_x64.shWith custom values for AlmaLinux OS 10.1.
# bash -x rootfs/almalinux_10_x64.sh minor_version build_number
bash -x rootfs/almalinux_10_x64.sh 1 0Output: AlmaLinux-10."${minor_version}"_x64_"${build_version}".wsl
Before an AlmaLinux version is publicly released, its packages are only available from the PUNGI compose hosts (https://<arch>-pungi-<major>.almalinux.dev). To build the WSL images from those composes instead of the public repositories, rewrite the build scripts first:
bash tools/pungi-repos.shThe script injects exclusive PUNGI compose repositories into the dnf --installroot command of the AlmaLinux OS 9 and 10 build scripts. The compose packages are signed with the official AlmaLinux key of the major, so gpgcheck stays on with the key from the builder container, and dnf imports it into the image rpmdb exactly as in a GA build - the image content is identical to a GA build. AlmaLinux OS 8 (no PUNGI hosts exist) and AlmaLinux OS Kitten (a rolling stream whose public repositories already are the latest compose) are left untouched. The rewrite is idempotent and is meant for the working tree only - do not commit the rewritten scripts.
The rewritten scripts derive their default minor_version from the compose, so a build started without a minor_version argument is named after the pre-release version it contains (e.g. 10.3 while the public repositories still ship 10.2).
No AlmaLinux minor version is hardcoded in the build scripts or the workflows. tools/almalinux-release.sh <major> [arch] prints the almalinux-release package version found in the BaseOS repodata of the repository the images are built from: the public repository repo.almalinux.org for AlmaLinux OS 8, 9 and 10, or, with PUNGI_REPOS=1, the PUNGI compose for AlmaLinux OS 9 and 10:
bash tools/almalinux-release.sh 10 # e.g. 10.2
PUNGI_REPOS=1 bash tools/almalinux-release.sh 10 # e.g. 10.3The build scripts call it when no minor_version argument is given, and the Build timestamp and version job of the workflows calls it before every build, so the image names, the object storage paths, the GitHub release tag and the notifications follow /etc/almalinux-release inside the images. After the install, every build script also checks that /etc/almalinux-release inside the image says that version and fails otherwise - the version was derived from one repository, while each arch installs from its own, and the two can lag behind each other during a release sync or a PUNGI compose cycle. Nothing needs to be edited when a new AlmaLinux minor release is published.
The Build AlmaLinux OS 9 and 10 WSL images workflows (almalinux_9.yaml, almalinux_10.yaml) automate this with the Build from PUNGI pre-release repositories input. With that input the minor version is derived from the compose instead of the public repository (see Minor version above), so the images, the object storage paths and the GitHub release tag are named after the pre-release version. The built images flow through the regular pipeline: stored to the object storage in test mode, or released on GitHub in release mode - from where the Build AlmaLinux OS .appx and .appxbundle workflow and the publishing to microsoft/WSL consume them as usual. The run name and the Mattermost notifications carry PUNGI warnings, so pre-release builds are unmistakable.
wsl --install --from-file $IMAGE-
Use WinGet as a package manager to install build tools. Please, consult to the official documentation for the installation guide.
-
Install Visual Studio Community 2022 with Desktop development with C++ workload.
winget install --id Microsoft.VisualStudio.2022.Community --override '--wait --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.Universal'On the component selection, Universal workload will be checked. Click on "Install" to finish the installation. After the installation, Visual Studio will be open. Close the Visual Studio and Visual Studio Installer to finish the installation process.
- Use the build scripts inside the
rootfsdirectory to create tarballs of root filesystems. - Copy RootFS tarballs into
x64andARM64directories and rename toinstall.tar.gzi.e.apps/9/x64/install.tar.gzandapps/9/ARM64/install.tar.gz. - Generate a self-signed certificate via Visual Studio or command line.
$params = @{
TextExtension = @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")
KeyUsage = 'DigitalSignature'
KeyLength = 4096
KeyAlgorithm = 'RSA'
Type = 'Custom'
Subject = 'CN=AlmaLinux OS, O=AlmaLinux OS Foundation, C=US'
FriendlyName = 'AlmaLinux OS WSL'
HashAlgorithm = 'SHA256'
CertStoreLocation = 'Cert:\CurrentUser\My'
}
New-SelfSignedCertificate @params- Set the application version. The
Versionof theIdentityelement inapps/<major>/AlmaLinux-<major>/AlmaLinux-<major>.appxmanifestis committed as the0.0.0.0placeholder: the Build AlmaLinux OS .appx and .appxbundle workflow sets the real one at build time, so a manual build has to set it too. Use<Major>.<Minor>.<Build>.0, where<Major>.<Minor>is the AlmaLinux version of the RootFS (e.g.10.3.1.0); the last part has to stay0, as Microsoft Store reserves it.
$ManifestPath = 'apps/10/AlmaLinux-10/AlmaLinux-10.appxmanifest'
[xml]$xml = Get-Content $ManifestPath
$xml.Package.Identity.Version = '10.3.1.0'
$xml.Save((Resolve-Path $ManifestPath))Do not commit the changed version.
- Right click on the AlmaLinux-8/9 project > Publish > Create package for side-loading.
-
Activate Developer Mode https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development#activate-developer-mode to able to install apps outside of Microsoft Store.
-
Right click on the file with the
AppxBundleand import the digital signature which we created to sign the application: Install Certificate > Local Machine > Place all certificates in the following store > Trusted People -
Now it is ready to install with double click.
Additional tools might be useful.
winget upgrade --all
winget install Microsoft.PowerShell Microsoft.WindowsTerminal Microsoft.OpenSSH.Beta Git.Git cURL.cURL jqlang.jq Neovim.Neovim