Last active
March 19, 2023 15:41
-
-
Save piyoki/5268a5923581db12b3bda1f4566bcea9 to your computer and use it in GitHub Desktop.
Install Archlinux OS GUIDE (BIOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================ | |
--- | |
References | |
- https://www.cio.com/article/238607/how-to-install-arch-linux-on-your-pc.html | |
- https://arch.icekylin.online/ | |
- https://zhuanlan.zhihu.com/p/112536524 | |
- https://zhuanlan.zhihu.com/p/568211941 | |
[NORMAL INSTALLATION] | |
*** BOOT UNDER BIOS NOT UEFI *** | |
--- | |
Restart sshd service | |
systemctl restart sshd.service | |
--- | |
Sync time | |
$ timedatectl set-ntp true | |
$ timedatectl status | |
--- | |
Change mirrorlist | |
# Cut the line with 'Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' and Paste it on top of the list | |
$ nano /etc/pacman.d/mirrorlist | |
## | |
## Arch Linux repository mirrorlist | |
## Generated on 2020-12-05 | |
## | |
Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch | |
## Worldwide | |
Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch | |
Server = http://mirror.rackspace.com/archlinux/$repo/os/$arch | |
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch | |
--- | |
Configure Disk | |
$ lsblk | |
$ cfdisk | |
swap – 4 GB (min 512 MB) | |
/ – ~ 1000 GB (remaining space) | |
$ parted /dev/sda | |
root@archiso ~ # parted /dev/sda | |
GNU Parted 3.3 | |
Using /dev/sda | |
Welcome to GNU Parted! Type 'help' to view a list of commands. | |
(parted) set 1 boot on | |
$ lsblk | |
root@archiso ~ # lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | |
loop0 7:0 0 566.5M 1 loop /run/archiso/sfs/airootfs | |
sda 8:0 0 50G 0 disk | |
├─sda1 8:2 0 4G 0 part | |
├─sda2 8:3 0 45.7G 0 part | |
sr0 11:0 1 690.3M 0 rom /run/archiso/bootmnt | |
$ mkswap -f /dev/sda1 | |
$ mkfs.ext4 /dev/sda2 | |
$ mount /dev/sda2 /mnt | |
$ swapon /dev/sda1 | |
# verify partitions | |
$ df -h | |
--- | |
Install system | |
$ pacstrap /mnt base linux linux-firmware linux-headers | |
$ pacstrap /mnt dhcpcd iwd vim sudo nano curl inetutils usbutils networkmanager openssh | |
$ pacstrap /mnt amd-ucode | |
$ genfstab -U /mnt >> /mnt/etc/fstab | |
$ cat /mnt/etc/fstab | |
--- | |
Convert environment to the newly installed partition | |
$ arch-chroot /mnt | |
root@archiso ~ # arch-chroot /mnt | |
[root@archiso /]# | |
--- | |
Configure timezone | |
$ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
$ hwclock --systohc | |
--- | |
Configure language | |
$ vim /etc/locale.gen | |
# uncomment the line with 'en_US.UTF-8 UTF-8' | |
$ locale-gen | |
$ echo 'LANG=en_US.utf-8' > /etc/locale.conf | |
[root@archiso /]# cat /etc/locale.conf | |
LANG=en_US.utf-8 | |
--- | |
Set rootpasswd | |
$ passwd root | |
--- | |
Set hostname | |
$ echo "archlinux.local" > /etc/hostname | |
--- | |
Setting up the boot-loader (syslinux) | |
$ pacman -S gdisk syslinux | |
$ syslinux-install_update -i -a -m | |
We need to edit the syslinux config file to use the correct root partition | |
$ vim boot/syslinux/syslinux.cfg | |
Scroll down to find the section that lists entries for arch and archfallback. Replace “sda2” with the root partition of your system. After making those changes, my entries look like these. | |
--- | |
Enable services | |
$ systemctl enable dhcpcd | |
$ systemctl enable sshd | |
$ systemctl enable NetworkManager | |
$ exit | |
--- | |
Reboot | |
$ umount -R /mnt | |
$ reboot | |
[DONE WITH NORMAL INSTALLATION] | |
============================ | |
[POST INSTALLATION] | |
$ ip a | |
$ ping www.baidu.com | |
# enable ssh root login | |
$ vim /etc/sshd/ssh_config | |
$ systemctl restart sshd | |
--- | |
Create new user | |
$ useradd -m -g users -G wheel -s /bin/bash kev | |
$ passwd kev | |
$ EDITOR=nano visudo | |
## Uncomment to allow members of group wheel to execute any command | |
%wheel ALL=(ALL) ALL | |
--- | |
Change mirrorlist | |
# Cut the line with 'Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' and Paste it on top of the list | |
$ nano /etc/pacman.d/mirrorlist | |
--- | |
Update the system | |
$ pacman -Syyu | |
$ pacman -S neofetch | |
$ neofetch | |
--- | |
Install softwares | |
$ vim /etc/pacman.conf | |
# Add multilib | |
[multilib] | |
Include = /etc/pacman.d/mirrorlist | |
# An example of a custom package repository. See the pacman manpage for | |
# tips on creating your own repositories. | |
[archlinuxcn] | |
SigLevel = Optional TrustAll | |
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch | |
$ pacman -Syu | |
# compile tools | |
$ pacman -S base-devel git | |
$ sudo pacman -S archlinuxcn-keyring | |
$ sudo pacman -S yay | |
--- | |
Configure static IP address on Arch Linux | |
Reference: https://nanxiao.me/en/configure-static-ip-address-on-arch-linux/ | |
Use NetworkManager to manage network on Arch Linux | |
# Check current connection | |
$ sudo -i | |
$ nmcli con show | |
NAME UUID TYPE DEVICE | |
Wired connection 1 f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ethernet enp0s3 | |
# Configure IP address, gateway and DNS | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ipv4.addresses 192.168.1.124/24 | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ipv4.gateway 192.168.1.1 | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ipv4.dns "8.8.8.8" | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 802-3-ethernet.mtu 1500 | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ipv4.method auto | |
$ nmcli con modify f1014ad6-4291-3c29-9b0d-b552a0c5eb02 ipv6.method auto | |
$ sudo nmcli con mod f1014ad6-4291-3c29-9b0d-b552a0c5eb02 connection.autoconnect yes | |
# Active connection | |
$ nmcli con up f1014ad6-4291-3c29-9b0d-b552a0c5eb02 | |
# Verify the new ip | |
$ ip addr | |
# Check current configurations | |
$ nmcli d show | |
# It is done! BTW, the connection file can be found: | |
$ cat /etc/NetworkManager/system-connections/Wired\ connection\ 1.nmconnection | |
[connection] | |
id=Wired connection 1 | |
uuid=f1014ad6-4291-3c29-9b0d-b552a0c5eb02 | |
type=ethernet | |
autoconnect-priority=-999 | |
interface-name=enp0s3 | |
...... | |
Alternatively, use nmtui to configure | |
$ nmtui | |
--- | |
Configure Rootless Containerd | |
# Set subuid and subgid | |
$ touch /etc/subuid /etc/subgid | |
$ usermod --add-subuids 100000-165535 --add-subgids 100000-165535 <username> | |
# Verify subuid and subgid | |
$ cat /etc/subuid | |
$ cat /etc/subgid | |
# Install nerdctl and contained | |
$ yay -S nerdctl-full-bin | |
$ containerd-rootless-setuptool.sh install | |
$ sudo pacman -S contained | |
# Install buildkit | |
$ sudo pacman -S buildkit | |
# Test | |
$ nerdctl run -d --name nginx -p 80:80 nginx:alpine | |
--- | |
Install RVM | |
curl -L get.rvm.io | bash -s stable | |
# .bashrc | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
# fish shell | |
curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish | |
echo "rvm default" >> ~/.config/fish/config.fish | |
# Set Path | |
set -gx PATH $PATH $HOME/.rvm/bin | |
--- | |
Install Homebrew | |
# Install Ruby 2.6.8 with RVM | |
rvm install 2.6.8 | |
# Install Homebrew | |
sudo pacman -Syu base-devel | |
curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh | sh | |
[ -d /home/linuxbrew/.linuxbrew ] && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) >> ~/.config/fish/config.fish | |
--- | |
Extra Packages | |
- lnav (logging tool) | |
[DONE WITH POST INSTALLATION] | |
============================ | |
--- | |
Locale Issue | |
https://zhuanlan.zhihu.com/p/385251617 | |
# /etc/locale.gen | |
en_US.UTF-8 UTF-8 | |
zh_CN.UTF-8 UTF-8 | |
$ sudo locale-gen | |
# /etc/locale.conf | |
LANG=en_US.UTF-8 | |
# Install Fronts | |
$ sudo pacman -S noto-fonts-cjk | |
$ sudo pacman -S firefox-i18n-zh-cn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment