Howto create own archlinux distro: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
(Created page with "= 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...")
 
No edit summary
Line 30: Line 30:
  cat > /etc/hosts << EOF
  cat > /etc/hosts << EOF
  127.0.0.1 localhost
  127.0.0.1 localhost
  192.168.24.10 archlinux.ovoxcloud.com
  10.44.1.44 archlinux
  EOF
  EOF
edit /etc/ssh/sshd_config:
edit /etc/ssh/sshd_config:
Line 36: Line 36:
  sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
  sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
enable sshd service:
enable sshd service:
  systemctl enable sshd
  systemctl enable --now sshd
ensure net.bridge.bridge-nf-call-iptables is set to 1 in your sysctl config:
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
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 192.168.24.10/24 ipv4.gateway 192.168.24.254 ipv4.dns 4.2.2.1,4.2.2.2 autoconnect yes
EOF
umount qcow2 image:
umount /mnt/archlinux/proc
umount /mnt/archlinux/dev
umount /mnt/archlinux
nbd-client -d /dev/nbd0
dmsetup remove /dev/mapper/nbd0p1
configure hostname:
configure hostname:
  hostnamectl set-hostname archlive
  hostnamectl set-hostname archlive
Line 71: Line 52:
  pacman -Syuu --noconfirm
  pacman -Syuu --noconfirm
install packages:
install packages:
  pacman -Sy curl vim screen nano net-tools bind-tools containerd networkmanager ebtables ethtool wget unzip socat cni-plugins conntrack-tools cri-o parted gptfdisk lvm2 git
  pacman -Sy curl vim screen nano net-tools bind-tools networkmanager ebtables ethtool wget unzip socat conntrack-tools parted gptfdisk lvm2 git
install iptables:
configure networkmanager:
  pacman -S iptables
  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:
install chrony:
  pacman -S chrony --noconfirm
  pacman -S chrony --noconfirm
Line 80: Line 66:
reboot machine:
reboot machine:
  reboot
  reboot
umount qcow2 image:
umount /mnt/archlinux/proc
umount /mnt/archlinux/dev
umount /mnt/archlinux
nbd-client -d /dev/nbd0
dmsetup remove /dev/mapper/nbd0p1

Revision as of 18:17, 15 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/archlinux
mount /dev/mapper/nbd0p1 /mnt/archlinux
mount -o bind /dev /mnt/archlinux/dev
mount -o bind /proc /mnt/archlinux/proc

enter enviroment with arch-chroot:

arch-chroot /mnt/archlinux

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 archlinux
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 --now sshd 

configure hostname:

hostnamectl set-hostname archlive

configure timezone:

timedatectl set-timezone America/Puerto_Rico

network configuration:

ip addr add 192.168.24.10/24 dev eth0
ip route add default via 192.168.24.254
rm /etc/resolv.conf
echo "nameserver 4.2.2.1" > /etc/resolv.conf
echo "nameserver 4.2.2.2" >> /etc/resolv.conf

stop and disable systemd-resolved:

systemctl disable systemd-resolved && systemctl stop systemd-resolved

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

reboot machine:

reboot

umount qcow2 image:

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