Howto create own archlinux distro
configure os
download latest archlinux cloud image:
wget https://linuximages.de/openstack/arch/arch-openstack-LATEST-image-bootstrap.qcow2
make sure we have libguestfs installed:
pacman -S libguestfs guestfs-tools
resize image:
cp arch-openstack-LATEST-image-bootstrap.qcow2 arch-openstack-LATEST-image-bootstrap_100G.qcow2 qemu-img resize arch-openstack-LATEST-image-bootstrap_100G.qcow2 +99G
expand image:
virt-resize --expand /dev/sda1 arch-openstack-LATEST-image-bootstrap.qcow2 arch-openstack-LATEST-image-bootstrap_100G.qcow2
change password:
virt-sysprep -a arch-openstack-LATEST-image-bootstrap_100G.qcow2 -q --root-password password:vidalinux
uninstall cloud-init:
virt-sysprep -a arch-openstack-LATEST-image-bootstrap_100G.qcow2 --run-command "pacman -R cloud-init --noconfirm"
on centos copy the image to this directory:
cd /var/lib/libvirt/images/
mount image:
qemu-nbd -c /dev/nbd0 arch-openstack-LATEST-image-bootstrap_100G.qcow2 kpartx -a /dev/nbd0 mkdir /mnt/archlive mount /dev/mapper/nbd0p1 /mnt/archlive mount -o bind /dev /mnt/archlive/dev mount -o bind /proc /mnt/archlive/proc
enter enviroment with arch-chroot:
arch-chroot /mnt/archlive
initialize the pacman keyring and populate signing keys:
pacman-key --init pacman-key --populate archlinux
configure /etc/hosts:
cat > /etc/hosts << EOF 127.0.0.1 localhost 10.44.1.44 archlive EOF
edit /etc/ssh/sshd_config:
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
enable sshd service:
systemctl enable sshd
configure hostname:
echo "archlive" > /etc/hostname
configure timezone:
ln -s /usr/share/zoneinfo/America/Puerto_Rico /etc/localtime
stop and disable systemd-resolved:
systemctl disable systemd-resolved
nameserver configuration:
rm /etc/resolv.conf echo "nameserver 4.2.2.1" > /etc/resolv.conf echo "nameserver 4.2.2.2" >> /etc/resolv.conf
update entire os:
pacman -Syuu --noconfirm
install packages:
pacman -Sy --noconfirm vim screen nano net-tools bind-tools networkmanager ethtool wget unzip socat gptfdisk lvm2 git
configure networkmanager:
cat > /root/net << EOF systemctl start NetworkManager && systemctl enable NetworkManager nmcli con del eth0 nmcli con del Wired\ connection\ 1 nmcli con add con-name eth0 ipv4.method manual type ethernet ifname eth0 ipv4.addresses 10.44.1.44/24 ipv4.gateway 10.44.1.1 ipv4.dns 4.2.2.1,4.2.2.2 autoconnect yes EOF
install chrony:
pacman -S chrony --noconfirm
enable and start chrony:
systemctl enable chronyd
exit chroot:
exit
umount qcow2 image:
umount /mnt/archlive/proc umount /mnt/archlive/dev umount /mnt/archlive nbd-client -d /dev/nbd0 dmsetup remove /dev/mapper/nbd0p1
enable chaotic repo
install chaotic repo:
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com pacman-key --lsign-key 3056513887B78AEB pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' \ 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
run the following command to add chaotic repo to /etc/pacman.conf:
cat >> /etc/pacman.conf << EOF [chaotic-aur] Include = /etc/pacman.d/chaotic-mirrorlist EOF
install yay:
pacman -Sy yay --noconfirm
enable ovox.io repo
download ovox.io pubkey:
wget http://archlinux.ovox.io/acvelez@ovox.io.asc
add ovox.io pub key to pacman:
pacman-key --add acvelez@ovox.io.asc pacman-key --lsign-key acvelez@ovox.io
add repo to pacman.conf:
cat >> /etc/pacman.conf << EOF [ovox.io] Server = http://archlinux.ovox.io SigLevel = Optional TrustAll EOF
configure archiso
install archiso:
pacman -S archiso-git dos2unix --noconfirm
copy releng directory:
cp -rf /usr/share/archiso/configs/releng/ /root/archlive
retreive the following packages file from vidalinux repo:
cd /root/archlive cp packages.x86_64 packages.x86_64.default wget https://pastebin.com/raw/A2ecPs9N -O packages.x86_64 dos2unix packages.x86_64
fix syslinux mbr:
cd /root/archlive/syslinux/ wget -O sys-linux.patch https://pastebin.com/raw/BVarduzC dos2unix sys-linux.patch patch -p0 < sys-linux.patch
enable services at boot:
cd /root/archlive/airootfs/etc/systemd/system
ln -s /usr/lib/systemd/system/gdm.service display-manager.service ln -s /usr/lib/systemd/system/NetworkManager.service multi-user.target.wants/NetworkManager.service ln -s /usr/lib/systemd/system/NetworkManager-dispatcher.service dbus-org.freedesktop.nm- ln -s /usr/lib/systemd/system/NetworkManager-wait-online.service network-online.target.wants/NetworkManager-wait-online.service
set hostname:
echo "archlive" > /root/archlive/airootfs/etc/hostname
set localtime:
cp /usr/share/zoneinfo/America/Puerto_Rico /root/archlive/airootfs/etc/localtime
configure sudo:
mkdir /root/archlive/airootfs/etc/sudoers.d/
cat > /root/archlive/airootfs/etc/sudoers.d/wheel << EOF %wheel ALL=(ALL) ALL Defaults timestamp_timeout = 0 EOF
add user:
echo "archlive:x:1000:1000::/home/archlive:/bin/bash" >> /root/archlive/airootfs/etc/passwd echo "archlive::14871::::::" >> /root/archlive/airootfs/etc/shadow
add user to groups:
cat >> /root/archlive/airootfs/etc/gshadow << EOF root:::root sys:!!::archlive network:!!::archlive power:!!::archlive adm:!!::archlive wheel:!!::archlive uucp:!!::archlive optical:!!::archlive rfkill:!!::archlive video:!!::archlive storage:!!::archlive audio:!!::archlive users:!!::archlive nopasswdlogin:!::archlive autologin:!::archlive archlive:!:: EOF
cat >> /root/archlive/airootfs/etc/group << EOF root:x:0:root sys:x:3:bin,archlive network:x:90:archlive power:x:98:archlive adm:x:999:archlive wheel:x:998:archlive uucp:x:987:archlive optical:x:990:archlive rfkill:x:983:archlive video:x:986:archlive storage:x:988:archlive audio:x:995:archlive users:x:985:archlive nopasswdlogin:x:966:archlive autologin:x:967:archlive archuser:x:1000: EOF
set automatic desktop user login:
mkdir /root/archlive/airootfs/etc/gdm
cat >> /root/archlive/airootfs/etc/gdm/custom.conf << EOF [daemon] AutomaticLoginEnable=True AutomaticLogin=archlive EOF
set default locale:
cat > /root/archlive/airootfs/etc/pacman.d/hooks/40-locale-gen.hook << EOF [Trigger] Operation = Install Type = Package Target = glibc [Action] Description = Uncommenting en_US.UTF-8 locale and running locale-gen When = PostTransaction Depends = glibc Depends = sed Depends = sh Exec = /bin/sh -c "sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen && locale-gen" EOF
add polkit rule:
mkdir /root/archlive/airootfs/etc/polkit-1/rules.d/ -p
cat >> /root/archlive/airootfs/etc/polkit-1/rules.d/50-nopasswd_global.rules << EOF /* Allow members of the wheel group to execute any actions * without password authentication, similar to "sudo NOPASSWD:" */ polkit.addRule(function(action, subject) { if (subject.isInGroup("wheel")) { return polkit.Result.YES; } }); EOF cat >> /root/archlive/airootfs/etc/polkit-1/rules.d/40-nopasswd-calamares.rules << EOF /* Allow Calamares to be started without password authentication */ polkit.addRule(function(action, subject) { if ((action.id == "com.github.calamares.calamares.pkexec.run")) { return polkit.Result.YES; } }); EOF
configure chaotic:
cp /etc/pacman.d/chaotic-mirrorlist /root/archlive/airootfs/etc/pacman.d/ mkdir /root/archlive/airootfs/usr/share/pacman/keyrings -p cp /usr/share/pacman/keyrings/* /root/archlive/airootfs/usr/share/pacman/keyrings/ cp /etc/pacman.conf /root/archlive/pacman.conf
uncoment extra repo from /root/archlive/pacman.conf:
[extra] Include = /etc/pacman.d/mirrorlist
create the iso:
mkarchiso -v .