ArchLinux安装过程
ArchLinux安装过程 前言
初始化网络
root@archiso ~ # iwctl
NetworkConfigurationEnabled: disabled
StateDirectory: /var/lib/iwd
Version: 2.19
[iwd]# device list
Devices *
--------------------------------------------------------------------------------
Name Address Powered Adapter Mode
--------------------------------------------------------------------------------
wlan0 11:11:11:11:11:11 on phy0 station
[iwd]# station wlan0 scan
[iwd]# station wlan0 get-networks
[iwd]# station wlan0 connect NAME
Type the network passphrase for Ziroom_2501 psk.
Passphrase: **********
[iwd]# exit
开启SHH服务
root@archiso ~ # systemctl start sshd
root@archiso ~ # systemctl status sshd
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: disabled)
Active: active (running) since Thu 2022-09-15 04:38:35 UTC; 34min ago
Main PID: 539 (sshd)
Tasks: 1 (limit: 18650)
Memory: 3.0M
CPU: 197ms
CGroup: /system.slice/sshd.service
└─539 "sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups"
Sep 15 04:38:35 archiso sshd[539]: Server listening on :: port 22.
root@archiso ~ # passwd
New password:
Retype new password:
passwd: password updated successfully
root@archiso ~ #
设置时间
root@archiso ~ # timedatectl set-ntp true
root@archiso ~ # timedatectl status
Local time: Thu 2022-09-15 05:26:28 UTC
Universal time: Thu 2022-09-15 05:26:28 UTC
RTC time: Thu 2022-09-15 05:26:28
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
分区
root@archiso ~ # fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: KINGSTON SNVS500G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D40E7459-C238-304D-995E-27300648B26D
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1564547 1562500 762.9M EFI System
/dev/nvme0n1p2 1564672 9953279 8388608 4G Linux swap
/dev/nvme0n1p3 9953280 976773134 966819855 461G Linux filesystem
root@archiso ~ # cfdisk /dev/nvme0n1
root@archiso ~ # fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: KINGSTON SNVS500G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D40E7459-C238-304D-995E-27300648B26D
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme0n1p2 1050624 9439231 8388608 4G Linux swap
/dev/nvme0n1p3 9439232 976773119 967333888 461.3G Linux filesystem
root@archiso ~ # mkfs.fat -F32 /dev/nvme0n1p1
mkfs.fat 4.2 (2021-01-31)
root@archiso ~ # mkswap /dev/nvme0n1p2
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=7af88558-e1de-45c2-96f0-c01ed0d29d01
root@archiso ~ # mkfs.ext4 /dev/nvme0n1p3
mke2fs 1.46.5 (30-Dec-2021)
/dev/nvme0n1p3 contains `ASCII text, with very long lines (501)' data
Proceed anyway? (y,N) y
Discarding device blocks: done
Creating filesystem with 120916736 4k blocks and 30236672 inodes
Filesystem UUID: ebccbf71-4d9f-4f6d-baec-0127b3cbb30e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks):
done
Writing superblocks and filesystem accounting information: done
root@archiso ~ # mount /dev/nvme0n1p3 /mnt
root@archiso ~ # mkdir /mnt/boot
root@archiso ~ # mount /dev/nvme0n1p1 /mnt/boot
root@archiso ~ # swapon /dev/nvme0n1p2
安装系统
root@archiso ~ # reflector -c China -a 10 --sort rate --save /etc/pacman.d/mirrorlist
root@archiso ~ # pacstrap /mnt base base-devel dialog linux linux-firmware
root@archiso ~ # pacman -S archlinux-keyring
root@archiso ~ # arch-chroot /mnt
[root@archiso /]#
[root@archiso /]# pacman -S vim bash-completion neovim zsh intel-ucode ntfs-3g
系统初始化设置
[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@archiso /]# hwclock --systohc
[root@archiso /]# vim /etc/locale.gen
[root@archiso /]# locale-gen
Generating locales...
en_US.UTF-8... done
zh_CN.UTF-8... done
Generation complete.
[root@archiso /]#
[root@archiso /]# vim /etc/locale.conf
[root@archiso /]# cat /etc/locale.conf
LANG=zh_CN.UTF-8
[root@archiso /]# vim /etc/hostname
[root@archiso /]# vim /etc/hosts
[root@archiso /]# cat /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost
::1 localhost
127.0.0.1 LST.localdomain LST
[root@archiso /]# cat /etc/hostname
LST
[root@archiso /]# useradd -m -g users -G wheel -s /bin/zsh kali-team
[root@archiso /]# passwd kali-team
New password:
Retype new password:
passwd: password updated successfully
[root@archiso /]# visudo
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL
配置引导
[root@archiso /]# pacman -S grub efibootmgr
resolving dependencies...
looking for conflicting packages...
Packages (3) efivar-38-2 efibootmgr-18-1 grub-2:2.06.r322.gd9b4638c5-4
Total Download Size: 6.95 MiB
Total Installed Size: 33.65 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
grub-2:2.06.r322.gd9b4638c5-4-x86_64 6.8 MiB 6.74 MiB/s 00:01 [###################################################] 100%
efivar-38-2-x86_64 145.5 KiB 1819 KiB/s 00:00 [###################################################] 100%
efibootmgr-18-1-x86_64 29.9 KiB 452 KiB/s 00:00 [###################################################] 100%
Total (3/3) 7.0 MiB 5.53 MiB/s 00:01 [###################################################] 100%
(3/3) checking keys in keyring [###################################################] 100%
(3/3) checking package integrity [###################################################] 100%
(3/3) loading package files [###################################################] 100%
(3/3) checking for file conflicts [###################################################] 100%
(3/3) checking available disk space [###################################################] 100%
:: Processing package changes...
(1/3) installing grub [###################################################] 100%
:: Install your bootloader and generate configuration with:
$ grub-install ...
$ grub-mkconfig -o /boot/grub/grub.cfg
Optional dependencies for grub
freetype2: For grub-mkfont usage
fuse2: For grub-mount usage
dosfstools: For grub-mkrescue FAT FS and EFI support
lzop: For grub-mkrescue LZO support
efibootmgr: For grub-install EFI support [pending]
libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue
os-prober: To detect other OSes when generating grub.cfg in BIOS systems
mtools: For grub-mkrescue FAT FS support
(2/3) installing efivar [###################################################] 100%
(3/3) installing efibootmgr [###################################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating the info directory file...
[root@archiso /]#
[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=archlinux --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
网络设置
[root@archiso /]# pacman -S nm-connection-editor dhcpcd
[root@archiso /]# systemctl enable sshd
Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service → /usr/lib/systemd/system/sshd.service.
[root@archiso /]# systemctl enable NetworkManager
Created symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service → /usr/lib/systemd/system/NetworkManager.service.
Created symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service → /usr/lib/systemd/system/NetworkManager-dispatcher.service.
Created symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service → /usr/lib/systemd/system/NetworkManager-wait-online.service.
[root@archiso /]# systemctl enable dhcpcd
Created symlink /etc/systemd/system/multi-user.target.wants/dhcpcd.service → /usr/lib/systemd/system/dhcpcd.service.
生成fstab
root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab
root@archiso ~ # cat /mnt/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3
UUID=ebccbf71-4d9f-4f6d-baec-0127b3cbb30e / ext4 rw,relatime 0 1
# /dev/nvme0n1p1
UUID=A12A-8861 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/nvme0n1p2
UUID=7af88558-e1de-45c2-96f0-c01ed0d29d01 none swap defaults 0 0
卸载分区重启
root@archiso ~ # umount -R /mnt
root@archiso ~ # reboot
优化
LST% sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Cloning Oh My Zsh...
remote: Enumerating objects: 1276, done.
remote: Counting objects: 100% (1276/1276), done.
remote: Compressing objects: 100% (1232/1232), done.
remote: Total 1276 (delta 24), reused 1199 (delta 24), pack-reused 0
接收对象中: 100% (1276/1276), 1.06 MiB | 32.00 KiB/s, 完成.
处理 delta 中: 100% (24/24), 完成.
来自 https://github.com/ohmyzsh/ohmyzsh
* [新分支] master -> origin/master
分支 'master' 设置为跟踪 'origin/master'。
已经位于 'master'
/home/kali-team
Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.
• Follow us on Twitter: https://twitter.com/ohmyzsh
• Join our Discord community: https://discord.gg/ohmyzsh
• Get stickers, t-shirts, coffee mugs and more: https://shop.planetargon.com/collections/oh-my-zsh
➜ ~
我的软件列表
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
- [multilib]
- Include = /etc/pacman.d/mirrorlist
+ [multilib]
+ Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
+ [archlinuxcn]
+ Server = https://repo.archlinuxcn.org/$arch
➜ ~ sudo pacman -Sy && sudo pacman -S archlinuxcn-keyring
➜ ~ sudo pacman -S xorg xorg-server lightdm-gtk-greeter lightdm-gtk-greeter-settings networkmanager
➜ ~ sudo systemctl enable lightdm.service
➜ ~ sudo systemctl enable NetworkManager
➜ ~ sudo pacman -S xf86-video-intel xorg-xinit i3 tilix
➜ ~ cp /etc/X11/xinit/xinitrc ./
➜ ~ mv xinitrc .xinitrc
➜ ~ sudo pacman -Sy picom polkit polkit-gnome fcitx fcitx-configtool fcitx-googlepinyin fcitx-cloudpinyin dex feh
软件 描述 firefox 唯一浏览器 i3status-rust 漂亮的状态栏 obs-studio 录制视频 pamac-aur 软件管理 keybase-gui keybase图形化客户端 seahorse 本地密码密钥管理 evolution 邮件客户端 remmina 远程桌面客户端 intellij-idea-community-edition 开发IDEA clamtk 杀毒软件 flameshot 截图软件 greenclip 剪切板管理 疑难杂症
OBS录屏出现闪屏撕裂
➜ ~ cat /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "uxa"
Option "DRI" "2"
EndSection
➜ ~
结束
参考