验证启动模式:
ls /sys/firmware/efi/efivars
网络检测:
ip link
ping 百度一下,你就知道
更新系统时间:
timedatectl set-ntp true
timedatectl status
建立硬盘分区:
fdisk -l
fdisk /dev/sda (或者cfdisk /dev/sda)
-->n -->回车 -->回车 -->回车 -->+500m
-->n -->回车 -->回车 -->回车 -->+6G
-->n -->回车 -->回车 -->回车 -->回车
-->w
格式化分区
mkfs.ext2 /dev/sda1 将bios分区格式化为ext2
mkswap /dev/sda2
mkfs.ext4 /dev/sda3
打开swap分区
swapon /dev/sda2
挂载分区
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
选择镜像
vim /etc/pacman.d/mirrorlist
把中国地区复制粘贴到前面,在添加一条
Server = mirrors.aliyun.com/archlinux/arch
按 V 选择,复制 Y ,粘贴 P,编辑 I ,保存退出 :wq
更多中国资源选择可以在下面网站复制过来
Pacman Mirrorlist Generatorarchlinux.org/mirrorlist/
## China
#Server = http://mirrors.163.com/archlinux/$repo/os/$arch
#Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch
#Server = https://mirrors.aliyun.com/archlinux/$repo/os/$arch
#Server = http://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.hit.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.hit.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.nju.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.nju.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.njupt.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirror.redrock.team/archlinux/$repo/os/$arch
#Server = https://mirror.redrock.team/archlinux/$repo/os/$arch
#Server = http://mirrors.shanghaitech.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.shanghaitech.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.wsyu.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.wsyu.edu.cn/archlinux/$repo/os/$arch
#Server = https://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
#Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch
刷新源
pacman -Syy
安装必须的软件包
pacstrap /mnt base linux linux-firmware
生成fstab文件
genfstab -U /mnt >> /mnt/etc/fstab
切换环境
Chroot
arch-chroot /mnt
设置 时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ln -sf /usr/share/zoneinfo/$(tzselect) /etc/localtime
硬件时间
hwclock --systohc
安装vim
pacman -S vim
本地化
设置语言
vim /etc/locale.gen
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
执行
locale-gen
配置 /etc/locale.conf文件
vim /etc/locale.conf
写入
LANG=en_US.UTF-8
配置网络
创建 hostname
vim /etc/hostname
写入
ranger
添加对应的信息到 hosts
vim /etc/hosts
写入
127.0.0.1 localhost
::1 localhost
127.0.1.1 ranger.localdomain ranger (网络IP)
创建 initramfs
mkinitcpio -P
Root 密码
passwd
安装网络相关的包
pacman -S iw wpa_supplicant dialog net-tools networkmanager
安装编码
pacman -S intel-ucode
安装引导程序
pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
退出当前环境
exit
卸载新分区
umount -R /mnt
重启
reboot
关机
poweroff
网络配置
开启网卡
ip link set ens33 up
开机自动启动 NetworkManager:
systemctl enable NetworkManager
立即启动 NetworkManager:
systemctl start NetworkManager
配置远程
安装SSH
pacman -S openssh
开启ssh
systemctl start sshd
查看ip地址
ip a
更改root账户密码(这还不是系统的root)
passwd
在另外的电脑上连接
ssh root@[ip地址]
创建用户
useradd -G wheel -m ranger(用户名)
passwd ranger(设置密码)
new password(输入密码)
retype new password(再次输入密码)
ls /home(查看用户名文件夹)
安装桌面环境(KODI播放器)
安装桌面
pacman -S plasma kde-applications
安装图形登录界面
pacman -S sddm sddm-kcm
开启sddm服务
systemctl enable sddm
安装中文
pacman -S wqy-zenhei
命令
系统监控工具:top、ps、vmstat、iotop、glances、top、htop、atop、mytop
网络工具:ping、traceroute、mtr、iftop、netstat、tcpdump、curl、wget
磁盘工具:fdisk -l、df
查看当前cpu信息:lscpu或者cat /proc/cpuinfo
查看内存信息:cat /proc/meminfo
查看当前操作系统内核信息:uname -a
查看当前操作系统发行版信息:cat /etc/issue | grep Linux
查看内存:free -m
查看硬盘和分区:lsblk
查看网卡分析:ifconfig、nload
查看环境变量:env
查看空闲内存量:grep MemFree /proc/meminfo
查看所有监听端口:netstat -lntp
查看pci信息,即主板所有硬件槽信息:lspci
查看路由表: route -n
列出所有PCI设备:lspci -tv
查看各分区使用情况:df -h
查看网络统计信息:netstat -s
查看所有交换分区:swapon -s
显示当前的运行级别:who –rH
查看系统负载:cat /proc/loadavg
查看系统运行时间、用户数、负载:uptime
修改:alias ls=sl
history显示时间/用户
解决办法是修改配置文件 /etc/profile
打开该文件,在最后添加一行
export HISTTIMEFORMAT="whoami %F %T "
其中 whoami 代表执行whoami命令取返回值
%F 代表系统日期
%T 代表系统时间
执行
source /etc/profile
linux 开机运行命令
vim /etc/rc.local
命令敲进去,bingo.
i wanna fuck the world
字体大小
setfont /usr/share/kbd/consolefonts/LatGrkCyr-12x22.psfu.gz
设置WiFi
nmtui
nmtui
nmtui
nmtui