Archlinux

From Halfface
Revision as of 07:47, 9 November 2024 by Ekaanbj (talk | contribs) (→‎pacman)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setup archlinux.

Create disks

gdisk /dev/sda
Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
  2            4096        62914526   30.0 GiB    8300  Linux filesystem
mount /dev/sda2 /mnt

Install some groups

pacstrap /mnt/ base xfce4 xorg
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
echo archlinux.halfface.se > /etc/hostname
ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

Install some apps

pacman --noconfirm -S grub vim openssh sudo rsync mlocate
vim /etc/locale.gen
locale-gen
vim /etc/locale.conf
LANG="en_US.UTF-8"
vim /etc/vconsole.conf 
KEYMAP="se-nodeadkeys"
FONT="eurlatgr"

Setup systemd network

/etc/systemd/network/wired.network
[Match]
Name=enp1s0

[Network]
DHCP=ipv4
UseHostname=false

Start Network

systemctl enable systemd-networkd.service
systemctl start systemd-networkd.service
systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Start sshd

systemctl enable sshd.service
systemctl start sshd.service

Create initrd

mkinitcpio -p linux
passwd

Setup grub

grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
reboot

Scheduled updates

Update system

pacman -Syu

Create cron script.

vim /root/bin/cron-daily-script 
# Scheduled script
pacman -Syu

Make script executable

chmod 755 /root/bin/cron-daily-script 

Create service running script.

vim /usr/lib/systemd/system/cron-daily-script.service
[Unit]
Description=cron-daily-script

[Service]
Type=simple
ExecStart=/root/bin/cron-daily-script

Create cronjob

vim /usr/lib/systemd/system/cron-daily-script.timer
[Unit]
Description=Runs cron-daily-script evry day.

[Timer]
# Time to wait after booting before we run first time
OnBootSec=10min
# Time between running each consecutive time
OnUnitActiveSec=1d
Unit=cron-daily-script.service

[Install]
WantedBy=multi-user.target

Enable cron job

systemctl start cron-daily-script.timer
systemctl enable cron-daily-script.timer

List jobs.

systemctl list-timers --all

pacman

-S: Sync packages -yy: refresh package database, force refresh even if local database appears up-to-date

pacman -Syy

-S: Sync packages. -u upgrade.

pacman -Syu

Install package

pacman -S package_name1 package_name2 ...

list repos

pacman-conf --repo-list

yay

pacman -S --needed --noconfirm base-devel git go ; && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si