Howto create own archlinux distro: Difference between revisions
Line 113: | Line 113: | ||
cat >> /root/archlive/airootfs/etc/gshadow << EOF | cat >> /root/archlive/airootfs/etc/gshadow << EOF | ||
root:::root | root:::root | ||
sys:!!:: | sys:!!::archlive | ||
network:!!:: | network:!!::archlive | ||
power:!!:: | power:!!::archlive | ||
adm:!!:: | adm:!!::archlive | ||
wheel:!!:: | wheel:!!::archlive | ||
uucp:!!:: | uucp:!!::archlive | ||
optical:!!:: | optical:!!::archlive | ||
rfkill:!!:: | rfkill:!!::archlive | ||
video:!!:: | video:!!::archlive | ||
storage:!!:: | storage:!!::archlive | ||
audio:!!:: | audio:!!::archlive | ||
users:!!:: | users:!!::archlive | ||
nopasswdlogin:!:: | nopasswdlogin:!::archlive | ||
autologin:!:: | autologin:!::archlive | ||
archlive:!:: | |||
EOF | EOF | ||
set automatic desktop user login: | set automatic desktop user login: |
Revision as of 00:11, 16 November 2023
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
configure archiso
install archiso:
pacman -S archiso-git --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 -O packages.x86_64
enable services at boot:
cp /usr/lib/systemd/system/NetworkManager.service /usr/lib/systemd/system/graphical.target cp /usr/lib/systemd/system/graphical.target /usr/lib/systemd/system/graphical.target cp /usr/lib/systemd/system/gdm.service /root/archlive/airootfs/etc/systemd/system/
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
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/ << 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