Howto create own archlinux distro: Difference between revisions
Mandulete1 (talk | contribs) No edit summary |
Mandulete1 (talk | contribs) |
||
(82 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
wget https://linuximages.de/openstack/arch/arch-openstack-LATEST-image-bootstrap.qcow2 | wget https://linuximages.de/openstack/arch/arch-openstack-LATEST-image-bootstrap.qcow2 | ||
make sure we have libguestfs installed: | make sure we have libguestfs installed: | ||
pacman -S libguestfs guestfs-tools | pacman -S libguestfs guestfs-tools multipath-tools nbd --noconfirm | ||
install this packages on debian or ubuntu: | |||
apt-get install -y multipath-tools libguestfs-tools nbd | |||
resize image: | resize image: | ||
cp arch-openstack-LATEST-image-bootstrap.qcow2 arch-openstack-LATEST-image-bootstrap_100G.qcow2 | cp arch-openstack-LATEST-image-bootstrap.qcow2 arch-openstack-LATEST-image-bootstrap_100G.qcow2 | ||
Line 16: | Line 18: | ||
cd /var/lib/libvirt/images/ | cd /var/lib/libvirt/images/ | ||
mount image: | mount image: | ||
modprobe nbd | |||
qemu-nbd -c /dev/nbd0 arch-openstack-LATEST-image-bootstrap_100G.qcow2 | qemu-nbd -c /dev/nbd0 arch-openstack-LATEST-image-bootstrap_100G.qcow2 | ||
kpartx -a /dev/nbd0 | kpartx -a /dev/nbd0 | ||
Line 38: | Line 41: | ||
systemctl enable sshd | systemctl enable sshd | ||
configure hostname: | configure hostname: | ||
echo " | echo "archlive" > /etc/hostname | ||
configure timezone: | configure timezone: | ||
ln -s /usr/share/zoneinfo/America/Puerto_Rico /etc/localtime | ln -s /usr/share/zoneinfo/America/Puerto_Rico /etc/localtime | ||
Line 50: | Line 53: | ||
pacman -Syuu --noconfirm | pacman -Syuu --noconfirm | ||
install packages: | install packages: | ||
pacman -Sy | pacman -Sy --noconfirm vim screen nano net-tools bind-tools networkmanager ethtool wget unzip socat gptfdisk lvm2 git | ||
configure networkmanager: | configure networkmanager: | ||
cat > /root/net << EOF | cat > /root/net << EOF | ||
Line 62: | Line 65: | ||
enable and start chrony: | enable and start chrony: | ||
systemctl enable chronyd | systemctl enable chronyd | ||
exit chroot: | |||
exit | |||
umount qcow2 image: | umount qcow2 image: | ||
umount /mnt/archlive/ | umount /mnt/archlive/dev -l | ||
umount /mnt/archlive/ | umount /mnt/archlive/proc -l | ||
umount /mnt/archlive | umount /mnt/archlive -l | ||
nbd-client -d /dev/nbd0 | nbd-client -d /dev/nbd0 | ||
dmsetup remove /dev/mapper/nbd0p1 | 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 | |||
EOF | |||
= configure archiso = | |||
install archiso: | |||
pacman -S archiso-git dos2unix patch --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://raw.githubusercontent.com/vidalinux/archiso/main/packages.x86_64 -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 NetworkManager-dispatcher.service | |||
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 archlive with vidalinux as password: | |||
echo 'archlive:x:1000:1000::/home/archlive:/bin/bash' >> /root/archlive/airootfs/etc/passwd | |||
echo 'archlive:$y$j9T$OUqRlu65oVBl08eze57XM/$acVf7HTozoZ3Y18uAnZbPfxSLLQPI/rGaX18QP/h3lD:19678::::::' >> /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 | |||
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 | |||
rm -rf /root/archlive/airootfs/usr/share/pacman/keyrings/archlinux* | |||
uncoment extra and multilib repos from /root/archlive/pacman.conf: | |||
[extra] | |||
Include = /etc/pacman.d/mirrorlist | |||
[multilib] | |||
Include = /etc/pacman.d/mirrorlist | |||
download calamares config files: | |||
wget -O /root/archlive/airootfs/usr/local/bin/calamares https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares | |||
wget -O /root/archlive/airootfs/usr/local/bin/calamares-before https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares-before | |||
wget -O /root/archlive/airootfs/usr/local/bin/calamares-final https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares-final | |||
fix file permissions on /root/archlive/profiledef.sh: | |||
file_permissions=( | |||
["/etc/gshadow"]="0:0:400" | |||
["/etc/shadow"]="0:0:400" | |||
["/root"]="0:0:750" | |||
["/etc/sudoers.d"]="0:0:750" | |||
["/root/.automated_script.sh"]="0:0:755" | |||
["/root/.gnupg"]="0:0:700" | |||
["/usr/local/bin/choose-mirror"]="0:0:755" | |||
["/usr/local/bin/Installation_guide"]="0:0:755" | |||
["/usr/local/bin/livecd-sound"]="0:0:755" | |||
["/usr/local/bin/calamares"]="0:0:755" | |||
["/usr/local/bin/calamares-before"]="0:0:755" | |||
["/usr/local/bin/calamares-final"]="0:0:755" | |||
) | |||
create the iso: | |||
cd /root/archlive && mkarchiso -v . | |||
= references = | |||
* https://gitlab.com/SamArcade777/arcade101 | |||
* https://gitlab.com/garuda-linux/pkgbuilds | |||
* https://gitlab.com/dtos/etc/dtos-calamares-settings | |||
* https://wiki.archlinux.org/title/archiso | |||
* https://github.com/archlinux/archiso/blob/master/CHANGELOG.rst |
Latest revision as of 20:28, 8 April 2024
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 multipath-tools nbd --noconfirm
install this packages on debian or ubuntu:
apt-get install -y multipath-tools libguestfs-tools nbd
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:
modprobe nbd 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/dev -l umount /mnt/archlive/proc -l umount /mnt/archlive -l 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 EOF
configure archiso
install archiso:
pacman -S archiso-git dos2unix patch --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://raw.githubusercontent.com/vidalinux/archiso/main/packages.x86_64 -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 NetworkManager-dispatcher.service 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 archlive with vidalinux as password:
echo 'archlive:x:1000:1000::/home/archlive:/bin/bash' >> /root/archlive/airootfs/etc/passwd echo 'archlive:$y$j9T$OUqRlu65oVBl08eze57XM/$acVf7HTozoZ3Y18uAnZbPfxSLLQPI/rGaX18QP/h3lD:19678::::::' >> /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
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 rm -rf /root/archlive/airootfs/usr/share/pacman/keyrings/archlinux*
uncoment extra and multilib repos from /root/archlive/pacman.conf:
[extra] Include = /etc/pacman.d/mirrorlist [multilib] Include = /etc/pacman.d/mirrorlist
download calamares config files:
wget -O /root/archlive/airootfs/usr/local/bin/calamares https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares
wget -O /root/archlive/airootfs/usr/local/bin/calamares-before https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares-before
wget -O /root/archlive/airootfs/usr/local/bin/calamares-final https://raw.githubusercontent.com/vidalinux/archiso/main/airootfs/usr/local/bin/calamares-final
fix file permissions on /root/archlive/profiledef.sh:
file_permissions=( ["/etc/gshadow"]="0:0:400" ["/etc/shadow"]="0:0:400" ["/root"]="0:0:750" ["/etc/sudoers.d"]="0:0:750" ["/root/.automated_script.sh"]="0:0:755" ["/root/.gnupg"]="0:0:700" ["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/Installation_guide"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755" ["/usr/local/bin/calamares"]="0:0:755" ["/usr/local/bin/calamares-before"]="0:0:755" ["/usr/local/bin/calamares-final"]="0:0:755" )
create the iso:
cd /root/archlive && mkarchiso -v .