Howto create own archlinux distro

From Vidalinux Wiki
Revision as of 18:25, 15 November 2023 by Mandulete1 (talk | contribs)
Jump to navigation Jump to search

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:

hostnamectl set-hostname archlive

configure timezone:

timedatectl set-timezone America/Puerto_Rico

stop and disable systemd-resolved:

systemctl disable systemd-resolved && systemctl stop 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 curl vim screen nano net-tools bind-tools networkmanager ebtables ethtool wget unzip socat conntrack-tools parted 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

umount qcow2 image:

umount /mnt/archlive/proc
umount /mnt/archlive/dev
umount /mnt/archlive 
nbd-client -d /dev/nbd0
dmsetup remove /dev/mapper/nbd0p1