# ArchLinux学习笔记 **Repository Path**: luo_jun99/arch_linux ## Basic Information - **Project Name**: ArchLinux学习笔记 - **Description**: No description available - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-02 - **Last Updated**: 2025-11-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一、安装 ### 1、linux命令行代理 ```shell export ALL_PROXY=socks5://127.0.0.1:1080 设置命令行默认代理 echo export ALL_PROXY=socks5://192.168.1.150:1080 >> ~/.zshrc ``` ### 2、一键安装基于xorg的kde桌面环境 ```shell sudo pacman -S xorg-server sddm plasma-meta kde-applications systemctl enable --now sddm # 安装基于 wayland 的 kde 环境 sudo pacman -S wayland plasma-wayland-session ``` ![成功安装基于wayland环境的kde桌面](./images/成功安装基于wayland环境的kde桌面.png) ### 3、linux 远程连接 windows 桌面 ```shell sudo pacman -Sy rdesktop rdesktop 192.168.1.150 ``` ### 4、Archlinux安装搜狗拼音输入法 快速配置 ```shell yay -S fcitx fcitx-configtool fcitx-gtk2 fcitx-gtk3 fcitx-qt5 fcitx-qt4 fcitx-sogoupinyin wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts noto-fonts-cjk # 添加到环境变量 echo "export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx" >> ~/.xprofile ``` 打开输入法配置工具 ![打开输入法配置工具](./images/打开输入法配置工具.png) 在滚动条的最后面找到搜狗拼音输入法 ![在滚动条的最后面找到搜狗拼音输入法](./images/在滚动条的最后面找到搜狗拼音输入法.png) 正常使用输入法 ![正常使用输入法](./images/正常使用输入法.png) ### 5、idea不能输入中文 ```shell # 取消 对 zh_CN.UTF-8 UTF-8 的注释 cat /etc/locale.gen | grep "^[a-z]" zh_CN.UTF-8 UTF-8 en_US.UTF-8 UTF-8 # 重新配置 sudo locale-gen Generating locales... zh_CN.UTF-8... done en_US.UTF-8... done Generation complete. ``` ### 6、idea输入法不跟随 ![idea输入法光标不跟随](./images/idea输入法光标不跟随.png) > 如果是idea 2021.2 则 下载 https://github.com/RikudouPatrickstar/JetBrainsRuntime-for-Linux-x64/releases/tag/2022-04-15_00-02 > > 因为这个版本的idea是使用的`openjdk 11`,使用更高版本的`jbr`会报错 > > 最新版本的`idea`只用下载对应最新版本的`jbr`即可 > > 然后解压`jbr`放到`idea`对应目录之下 ### 7、安装微信、QQ ```shell yay -S linuxqq yay -S wechat-uos ``` ### 8、官方安装输入法 配置源 打开`/etc/pacman.conf`,在末尾加上 ```shell [archlinuxcn] SigLevel = Optional TrustAll Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch # 或者使用清华的镜像源 [archlinuxcn] SigLevel = Optional TrustAll Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch ``` 更新软件仓库 ```shell $ sudo pacman -Sy ``` 安装密钥包 安装key-ring ```shell $ sudo pacman -S archlinuxcn-keyring ``` 安装 安装Fcitx 由于搜狗拼音输入法依赖于Fcitx,在安装搜狗拼音输入法之前,需要先行安装Fcitx,在终端窗口下直接输入: ```shell $ sudo pacman -S fcitx ``` 即可完成安装,需要注意的是,仅仅安装这一项是不够的,这样在安装完成之后,Fcitx基本上是处于不可用的状态,我们还需要安装以下几个包: ```shell $ sudo pacman -S fcitx-configtool $ sudo pacman -S fcitx-gtk2 fcitx-gtk3 fcitx-qt5 ``` 目前在Archlinux的源中,fcitx-im包组已经取消了fcitx-qt4包,但是搜狗输入法需要这个包,可以用AUR获取: ```shell $ sudo pacman -S yay $ yay -S fcitx-qt4 ``` 安装搜狗拼音 在前一步中我们已经正确的配置了源,这里直接输入: ```shell $ sudo pacman -S fcitx-sogoupinyin ``` ### ```shell sudo pacman -S fcitx fcitx-googlepinyin fcipx-sogoupinyin sudo pacman -S fcitx fcitx-googlepinyin fcitx-sogoupinyin sudo pacman -S fcitx fcitx-googlepinyin yay -S fcitx-sogoupinyin sudo pacman -S fcitx-im cp /etc/xdg/autostart/fcitx-autostart.desktop ~/.config/autostart-scripts/ cd ~ ls ls -l ls -la vim .bashrc sudo pacman -S kcm-fcitx fcitx-configtool echo "export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx" >> ~/.xprofile ``` 安装字体 ```shell sudo pacman -Sy wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts noto-fonts-cjk ``` 配置 安装完之后我们还不可以直接使用,还需要进行一定的配置,用文本编辑器打开~/.xprofile,没有就新建,在其末尾添加以下几行: ```shell export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS="@im=fcitx" ``` 或者直接执行 ```shell $ echo "export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx" >> ~/.xprofile ``` wiki建议使用~/.pam_environment设置环境变量,可以一并加上: $ echo "GTK_IM_MODULE DEFAULT=fcitx QT_IM_MODULE DEFAULT=fcitx XMODIFIERS DEFAULT=@im=fcitx" >> ~/.pam_environment 然后注销后重新登录,或者重启后重新登录。 可能的问题 如果遇到登录之后输入法fcitx没有启动的问题,可以将fcitx设置为自动启动,deepin桌面下右键fcitx的图片就能做到,gnome桌面可以用gnome-tweaks,也可以就简单的在.xprofile里面加一句fcitx。 或者使用wiki上给出的方式 $ cp /etc/xdg/autostart/fcitx-autostart.desktop ~/.config/autostart/ ### 编译运行 edge 浏览器 ```shell pacman -S base-devel git clone https://aur.archlinux.org/microsoft-edge-stable.git cd microsoft-edge-stable makepkg -si ``` ### 使用 ifconfig 命令 ```shell ``` ### 安装 vnc 客户端 ```shell sudo pacman -Sy tigervnc ``` 一个名为virtio-win的RPM软件包(在RHEL发行版的Supplementary repository中),能为主流的Windows版本提供virtio相关的驱动 ```shell sudo pacman -Ql virtio-win sudo pacman -Ql virtio-win virtio-win /var/ virtio-win /var/lib/ virtio-win /var/lib/libvirt/ virtio-win /var/lib/libvirt/images/ virtio-win /var/lib/libvirt/images/virtio-win.iso windows 中 virtio 的驱动程序 ``` 如果你想要为一台HVM实例开启PCI直通(例如,一台KVM创建的全虚拟化的虚拟机),你的母系统(包括CPU和主板)必须满足以下条件。如果你的虚拟机是半虚拟化的(由Xen创建),你可以跳过这步。 为了在 HVM虚拟机上开启PCI直通,系统需要支持VT-d (Intel处理器)或者AMD-Vi (AMD处理器)。Intel的VT-D(“英特尔直接I/O虚拟化技术”)是适用于最高端的Nehalem处理器和它的后继者(例如,Westmere、Sandy Bridge的,Ivy Bridge)。注意:VT-d和VT-x是两个独立功能。intel/AMD处理器支持VT-D/AMD-VI功能的列表可以查看这里。 在确认你的设备支持VT-d/AMD-Vi后,还有两件事情需要做。首先,确保VT-d/AMD-Vi已经在BIOS中开启。然后,在内核启动过程中开启IOMMU。IOMMU服务,是由VT-d/AMD-Vi提供的,可以保护虚拟机访问的主机内存,同时它也是全虚拟化虚拟机支持PCI直通的前提。 Intel处理器中,通过将“intel_iommu=on传给内核启动参数来开启IOMMU。参看这篇教程了解如何通过GRUB修改内核启动参数。 配置完启动参数后,重启电脑。 https://www.xmodulo.com/add-kernel-boot-parameters-via-grub-linux.html ```shell sudo -e /etc/default/grub $ sudo grub-mkconfig -o /boot/grub/grub.cfg sudo pacman -Sy grub sudo grub-mkconfig -o /boot/grub/grub.cfg ``` ### 运行时新增swap分区,而不用格式化磁盘 ```shell # 新建一个专门的文件用于swap分区 # 注:此文件的大小是count的大小乘以bs大小,上面命令的大小是8GB dd if=/dev/zero of=/swap bs=1024 count=8388616 # 通过mkswap命令将上面新建出的文件做成swap分区 # 使用mkswap格式化文件为swap文件系统 # -f 使用文件作为 swap 交换区 mkswap -f /swap # 启用此交换分区的交换功能并开机挂载 swapon /swap echo "/swap swap swap defaults 0 0" >> /etc/fstab # 关闭swap分区 swapoff /swap ``` ### 设置 jdk8为默认的jdk ```shell # 查看jdk的位置 whereis java  ✔ java: /usr/bin/java /usr/share/java /usr/lib/jvm/java-8-openjdk/bin/java # 发现使用的jdk是一个符号链接 ll /usr/bin/java  ✔ lrwxrwxrwx 1 root root 37 5月 16 2020 /usr/bin/java -> /usr/lib/jvm/default-runtime/bin/java # 跳转到 jvm 目录 pwd  ✔ /usr/lib/jvm # 查看jvm和符号链接 ll  ✔ 总用量 8 lrwxrwxrwx 1 root root 14 12月 7 16:58 default -> java-11-openjdk lrwxrwxrwx 1 root root 14 12月 7 16:58 default-runtime -> java-11-openjdk drwxr-xr-x 7 root root 4096 12月 2 14:58 java-11-openjdk drwxr-xr-x 6 root root 4096 12月 7 16:56 java-8-openjdk # 删除两个默认的符号链接 rm -rf default default-runtime # 重新创建默认的符号链接 ln -s java-8-openjdk default ln -s java-8-openjdk default-runtime # 测试默认的jdk java -version  ✔ openjdk version "1.8.0_292" OpenJDK Runtime Environment (build 1.8.0_292-b10) OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode) ``` ### 安装 chrome ```shell yay -Sy google-chrome ``` ### arch 美化 ```shell sudo pacman -S latte-dock ``` ### 安装`waydroid`安卓子系统 ```shell waydroid init # 未安装 python-dbus 模块 Traceback (most recent call last): File "/usr/bin/waydroid", line 6, in import tools File "/usr/lib/waydroid/tools/__init__.py", line 8, in import dbus.mainloop.glib ModuleNotFoundError: No module named 'dbus' yay -S python-dbus sudo waydroid init # 未安装 [05:21:24] Failed to load binder driver [05:21:24] modprobe: FATAL: Module binder_linux not found in directory /lib/modules/6.0.12-arch1-1 [05:21:24] ERROR: Binder node "binder" for waydroid not found [05:21:24] See also: Run 'waydroid log' for details. ``` # 二、通过kvm安装macOS > 硬件直通参考:https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) > mac-kvm 参考:https://github.com/kholia/osx-kvm ## 1、启用iommu ```shell # 在 grub 的配置文件模板中 开启 intel_iommu iommu=pt cd /etc/default/ ll -rw-r--r-- 1 root root 2095 4月 17 01:57 grub -rw------- 1 root root 160 1月 27 13:47 useradd # 设置内核启动参数 开启 虚拟化与硬件直通 head grub # GRUB boot loader configuration GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Arch" # 添加启动参数 intel_iommu=on iommu=pt GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet intel_iommu=on iommu=pt" GRUB_CMDLINE_LINUX="" # 生成 grub 启动配置文件 grub-mkconfig -o /boot/grub/grub.cfg # 在重启之后,检查 dmesg 以确认 IOMMU 已经被正确启用: dmesg | grep -e DMAR -e IOMMU ... [ 0.038998] DMAR: IOMMU enabled ... [ 0.316540] DMAR: Intel(R) Virtualization Technology for Directed I/O ``` ## 2、禁止宿主机使用要直通的显卡 这个脚本将输出您的 PCI 设备是如何被分配到 IOMMU 组之中的。如果这个脚本没有输出任何东西,这代表您并没有启用 IOMMU 支持或者是您的硬件不支持 IOMMU。 ```shell #!/bin/bash shopt -s nullglob for d in /sys/kernel/iommu_groups/*/devices/*; do n=${d#*/iommu_groups/*}; n=${n%%/*} printf 'IOMMU Group %s ' "$n" lspci -nns "${d##*/}" done; ``` 脚本执行结果 使用 `lspci -kn` 也能实现类似的效果 ```shell IOMMU Group 0 00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v3 Processor DRAM Controller [8086:0c08] (rev 06) IOMMU Group 10 00:1d.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1 [8086:8ca6] # gtx710 显卡 IOMMU Group 14 06:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK208B [GeForce GT 710] [10de:128b] (rev a1) IOMMU Group 14 06:00.1 Audio device [0403]: NVIDIA Corporation GK208 HDMI/DP Audio Controller [10de:0e0f] (rev a1) # pcie x16 控制器 IOMMU Group 1 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller [8086:0c01] (rev 06) # gt1060 显卡 IOMMU Group 1 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1) IOMMU Group 1 01:00.1 Audio device [0403]: NVIDIA Corporation GP106 High Definition Audio Controller [10de:10f1] (rev a1) ``` vfio-pci通常通过 ID 来定位 PCI 设备,这意味着您只需要指定设备的ID就可以完成绑定。对于下面的 IOMMU 组,您可能希望将vfio-pci与 10de:0e0f 和 10de:0e0f 绑定,这将作为本章节其余部分的示例值。 您需要加载vfio-pci,并将设备-供应商ID参数传递给内核。 ```shell cat /etc/modprobe.d/vfio.conf options vfio-pci ids=10de:128b,10de:0e0f ``` 但是,这并不能保证vfio-pci会在其它图形驱动之前加载。为了确保这一点,我们需要在initramfs中静态绑定它和它的依赖项。按照vfio_pci,vfio,vfio_iommu_type1,vfio_virqfd 的顺序添加到mkinitcpio: ```shell vim /etc/mkinitcpio.conf # vim:set ft=sh # MODULES # The following modules are loaded before any boot hooks are # run. Advanced users may wish to specify all system modules # in this array. For instance: # MODULES=(piix ide_disk reiserfs) MODULES=(vfio_pci vfio vfio_iommu_typ1 vfio_virqfd) # 另外,确保 modconf hook 在mkinitcpio.conf的 HOOKS 列表中: # HOOKS # This is the most important setting in this file. The HOOKS control the # modules and scripts added to the image, and what happens at boot time. # Order is important, and it is recommended that you do not change the # order in which HOOKS are added. Run 'mkinitcpio -H ' for # help on a given hook. # 'base' is _required_ unless you know precisely what you are doing. # 'udev' is _required_ in order to automatically load modules # 'filesystems' is _required_ unless you specify your fs modules in MODULES # Examples: ## This setup specifies all modules in the MODULES setting above. ## No raid, lvm2, or encrypted root is needed. HOOKS=(modconf) ``` 由于新模块已添加到 initramfs 配置中,因此必须重新生成initramfs。如果您在/etc/modprobe.d/vfio.conf修改了设备ID,您同样需要重新生成它。以便在早期启动过程得知需要隔离的设备。 重启并验证vfio-pci是否已经正确加载并绑定到正确的设备: ```shell # 注意:这里只有当需要使用显卡直通的虚拟机启动之后才能查询到结果 dmesg | grep -i vfio ``` ## 3、安装macOS 到kvm ```shell # 安装准备 # (临时) echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs # 克隆(需要在 cd ~ 目录下执行) git clone https://ghproxy.fsofso.com/https://github.com/kholia/OSX-KVM.git cd OSX-KVM/ # 将项目中的 kvm 配置文件拷贝到 系统 sudo cp kvm.conf /etc/modprobe.d/kvm.conf # for intel boxes only, after cloning the repo below # 安装必要的库 (git仓库中) # git 中使用的是ubuntu 的系统,但是这里使用的是 archlinux,所以有些 包 不存在,在这里,只用装这些库就能运行了 sudo pacman -S qemu uml-utilities virt-manager wget libguestfs-tools p7zip-full make # 下载 macOS 官方 安装程序 # 如果现有硬盘中已经有安装好了的 硬盘,可以通过 virt-manager 直接将 /dev/sda 挂载到 虚拟机,可以免去后面的安装步骤 ./fetch-macOS-v2.py # 将下载下来的镜像转换 qemu-img convert BaseSystem.dmg -O raw BaseSystem.img # 创建虚拟机使用的虚拟硬盘 qemu-img create -f qcow2 mac_hdd_ng.img 128G # 启动 macOS 虚拟机 ./OpenCore-Boot.sh # 安装 libvirt 用于控制 qemu sudo pacman -S virt-manager libvirt # 启动服务 systemctl enable --now libvirtd # 这里就是刚刚建议 在 ~ 目录下克隆仓库的原因 # 使用路径替换 libvirt 的默认配置文件 sed "s/CHANGEME/$USER/g" macOS-libvirt-Catalina.xml > macOS.xml # 查看生成的 libvirt 配置文件 vi macOS.xml # 校验 libvirt 的配置文件,并将其添加到 libvirt 之下进行管理 virt-xml-validate macOS.xml # 授予当前用户 kvm 的相关权限,防止 virt-mamager 中权限相关的报错 sudo setfacl -m u:libvirt-qemu:rx /home/$USER sudo setfacl -R -m u:libvirt-qemu:rx /home/$USER/OSX-KVM ```` ## 4、使用virt-mamger 启动 macOS 显卡和其声卡必须在同一个总线(bus),同一个插槽(slot),但是不同功能(function) pci 直通显卡配置 ```xml
``` pci 直通显卡的声卡配置 ```xml
``` ## 5、遇到的一些小问题 ### (1)kvm无法启动 ```shell systemctl start libvirtd # 启动之后会结束运行 #查看系统日志 sudo journalctl -fu libvirtd 5月 27 23:11:33 luoarch systemd[1]: Starting Virtualization daemon... 5月 27 23:11:33 luoarch systemd[1]: Started Virtualization daemon. 5月 27 23:11:33 luoarch dnsmasq[670]: read /etc/hosts - 0 addresses 5月 27 23:11:33 luoarch dnsmasq[670]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses 5月 27 23:11:33 luoarch dnsmasq-dhcp[670]: read /var/lib/libvirt/dnsmasq/default.hostsfile 5月 27 23:11:33 luoarch libvirtd[6178]: libvirt version: 8.2.0 5月 27 23:11:33 luoarch libvirtd[6178]: hostname: luoarch 5月 27 23:11:33 luoarch libvirtd[6178]: Cannot find 'dmidecode' in path: No such file or directory 5月 27 23:11:33 luoarch libvirtd[6178]: configuration file syntax error: /etc/libvirt/qemu.conf:841: expecting a separator in list 5月 27 23:11:33 luoarch libvirtd[6178]: Initialization of QEMU state driver failed: configuration file syntax error: /etc/libvirt/qemu.conf:841: expecting a separator in list 5月 27 23:11:33 luoarch libvirtd[6178]: Driver state initialization failed ``` 发现是841行的配置文件错误,修正之后 ```shell 839 nvram = [ 840 "/usr/share/ovmf/x64/OVMF_CODE.fd:/usr/share/ovmf/x64/OVMF_VARS.fd" # 不能以逗号结尾 841 # 在中间不能有注释 842 ] ``` ### (2)虚拟机无法连接NAT网卡 ![编辑qemu-kvm属性](./images/编辑qemu-kvm属性.png) 手动启动`virt-network` ![手动启动virt-network](./images/手动启动virt-network.png) ## 6、单独安装qemu/kvm+libvirt 物理机上执行 ```shell # 安装 qemu 和 libvirt sudo pacman -Sy qemu libvirt # 把当前用户添加到 libvirt 组中 sudo usermod -aG libvirt luo # 安装网络插件 sudo pacman -S iptables-nft dnsmasq # 查看 libvirtd 状态 systemctl enable --now libvirtd ● libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled) Active: active (running) since Tue 2023-03-21 02:56:03 UTC; 3min 55s ago TriggeredBy: ● libvirtd-ro.socket ● libvirtd.socket ● libvirtd-admin.socket Docs: man:libvirtd(8) https://libvirt.org Main PID: 1487 (libvirtd) Tasks: 19 (limit: 32768) Memory: 16.1M CPU: 470ms CGroup: /system.slice/libvirtd.service └─1487 /usr/bin/libvirtd --timeout 120 ``` 远程主机上执行 ```shell brew install virt-manager # 启动 virt-manager virt-manager ``` ![mac下配置virt-manager连接libvirtd](./images/mac下配置virt-manager连接libvirtd.png) # 三、配置代理 ## 1、下载 clash > 参考:https://github.com/Dreamacro/clash > clash-linux-amd64-v3-v1.12.0.gz > 控制面板地址:https://clash.razord.top/#/proxies ## 2、启动 clash ```shell ./clash -f WestWorldVPN.yml INFO[0000] Start initial compatible provider 自动选择 INFO[0000] Start initial compatible provider Proxy INFO[0000] HTTP proxy listening at: 127.0.0.1:7890 INFO[0000] RESTful API listening at: 127.0.0.1:9090 INFO[0000] SOCKS proxy listening at: 127.0.0.1:7891 WARN[0000] Failed to start Redir UDP Listener: operation not permitted INFO[0000] Redirect proxy listening at: 127.0.0.1:7892 ERRO[0000] Start Redir server error: operation not permitted ``` ## 3、命令行代理 ```shell export http_proxy=socks5://127.0.0.1:7891 https_proxy=socks5://127.0.0.1:7891 http_proxy="http://127.0.0.1:7890" https_proxy="https://127.0.0.1:7890" ``` # 四、arch 安装 wine 运行 QQ > 参考:https://wiki.archlinux.org/title/wine ## 1、启用 pacman 中的 multilib > 参考:https://wiki.archlinux.org/title/Official_repositories#multilib ```shell vim /etc/pacman.conf # 把这一行取消注释 [multilib] Include = /etc/pacman.d/mirrorlist pacman -Syy pacman -Sl multilib ``` ## 2、安装 wine ```shell pacman -S wine wine-gecko wine-mono ``` ## 3、查看wine的控制面板 ```shell # 推荐 wine control # 或者 winecfg ``` ## 4、安装软件 ```shell luo@archiso ~/Downloads> wine TIM3.4.3.22064.exe # 运行已安装好的软件 # 默认下,wine安装的软件都会统一放到 ~/.wine 目录下 luo@archiso ~/.w/d/P/T/T/Bin> pwd /home/luo/.wine/drive_c/Program Files (x86)/Tencent/TIM/Bin # 列出所有的 exe 执行文件 luo@archiso ~/.w/d/P/T/T/Bin> ll | grep ".*\.exe" -rwxr-xr-x 1 luo luo 88K Dec 3日 12:34 QPerfHelper.exe -rwxr-xr-x 1 luo luo 67K Dec 3日 12:34 QQExternal.exe -rwxr-xr-x 1 luo luo 31K Dec 3日 12:34 QQExternalEx.exe -rwxr-xr-x 1 luo luo 305K Dec 3日 12:34 QQPcmgrDownload.exe -rwxr-xr-x 1 luo luo 38K Dec 3日 12:34 QQSafeUD.exe -rwxr-xr-x 1 luo luo 56K Dec 3日 12:34 QQScLauncher.exe -rwxr-xr-x 1 luo luo 246K Dec 3日 12:34 QQUrlMgr.exe -rwxr-xr-x 1 luo luo 115K Dec 3日 12:34 StorageTool.exe -rwxr-xr-x 1 luo luo 70K Dec 3日 12:34 TIM.exe -rwxr-xr-x 1 luo luo 59K Dec 3日 12:34 TIMApp.exe -rwxr-xr-x 1 luo luo 195K Dec 3日 12:34 TXPlatform.exe -rwxr-xr-x 1 luo luo 893K Dec 3日 12:34 Tencentdl.exe -rwxr-xr-x 1 luo luo 217K Dec 3日 12:34 Timsh.exe -rwxr-xr-x 1 luo luo 340K Dec 3日 12:34 Timwp.exe -rwxr-xr-x 1 luo luo 302K Dec 3日 12:34 TxBugReport.exe -rwxr-xr-x 1 luo luo 809K Dec 3日 12:34 auclt.exe -rwxr-xr-x 1 luo luo 360K Dec 3日 12:34 minibrowser.exe # 运行 tim luo@archiso ~/.w/d/P/T/T/Bin> wine TIM.exe ``` # 五、配置无盘系统启动 ```shell yay -S tftp-hpa dhcp syslinux ``` ## 1、配置dhcp指向tftp服务器 > [dhcp配置pxe参考](https://wiki.archlinux.org/title/Dhcpd#Use_for_PXE) ```shell # A slightly different configuration for an internal subnet. subnet 192.168.50.0 netmask 255.255.255.0 { range 192.168.50.150 192.168.50.160; option domain-name-servers 8.8.8.8; option domain-name "internal.example.org"; option routers 192.168.50.2; #option broadcast-address 10.5.5.31; default-lease-time 600; max-lease-time 7200; # 配置 tftp 服务器所在的地址 next-server 192.168.50.200; # 用于引导系统的文件名 filename "/boot/pxelinux.0"; } # 启动dhcp 服务 sudo dhcpd -cf /etc/dhcpd.conf ``` ## 2、启动tftp服务器 ```shell # 寻找 tftp 的配置文件 cat /usr/lib/systemd/system/tftpd.service [Unit] Description=hpa's original TFTP daemon After=network.target [Service] Type=forking EnvironmentFile=/etc/conf.d/tftpd ExecStart=/usr/bin/in.tftpd --listen $TFTPD_ARGS # 查看配置文件 cat /etc/conf.d/tftpd # tftp 服务器的根目录路径 TFTPD_ARGS="--secure /srv/tftp/ " # 启动 tftp 服务 sudo systemctl start tftpd ``` ## 3、准备syslinux > [手动安装syslinux](https://wiki.archlinux.org/title/Syslinux#Manual_install) > > [syslinux 配置 pxe](https://wiki.archlinux.org/title/Syslinux#PXELINUX) ```shell sudo mkdir /srv/tftp/boot # 拷贝 c32 文件 sudo cp /usr/lib/syslinux/bios/*.c32 /srv/tftp/ # 拷贝 pxelinux.0 到 boot 路径下 sudo cp /usr/lib/syslinux/bios/pxelinux.0 /srv/tftp/boot sudo cp /usr/lib/syslinux/bios/ldlinux.c32 /srv/tftp/boot # 创建 pxe 的配置文件所在目录 sudo mkdir /srv/tftp/boot/pxelinux.cfg # 创建配置文件 sudo touch /srv/tftp/boot/pxelinux.cfg/default ``` 编辑`/srv/tftp/boot/pxelinux.cfg/default`配置文件 ```shell # DEFAULT 的名称要和 其中一个 LABEL 标签名称一致 # 注意:根路径是 /srv/tftp/ ,如果不指定路径,则默认使用和 pxelinux.0 在同一个目录下的文件 DEFAULT linux LABEL linux KERNEL vmlinuz-linux APPEND initrd=initramfs-linux.img quiet ip=:::::eth0:dhcp nfsroot=192.168.50.200:/boot ``` 启动时发现`vmlinuz-linux`和`initramfs-linux.img`文件不存在 > `vmlinuz-linux` 内核 > > `initramfs-linux.img` 驱动程序 ```shell # 发现物理机中有所需的 镜像文件 ll /boot total 54M drwxr-xr-x 6 root root 512 Dec 16 03:21 grub/ -rwxr-xr-x 1 root root 34M Feb 16 07:13 initramfs-linux-fallback.img* -rwxr-xr-x 1 root root 9.1M Feb 16 07:13 initramfs-linux.img* drwxr-xr-x 2 root root 512 Mar 28 01:37 syslinux/ -rwxr-xr-x 1 root root 11M Feb 16 07:13 vmlinuz-linux* sudo cp /boot/initramfs-linux.img /srv/tftp/boot/ sudo cp /boot/vmlinuz-linux /srv/tftp/boot/ ``` ## 4、最终效果 ![通过网络启动linux成功](./images/通过网络启动linux成功.png) ## 5、引导http iso镜像 > [memdisk简单配置参考](https://wiki.archlinux.org/title/Multiboot_USB_drive#Using_Syslinux_and_memdisk) > > [memdisk文档](https://wiki.syslinux.org/wiki/index.php?title=MEMDISK) > > [配置dhcp服务 使用 lpxelinux.0 替代 pxelinux.0 (无效)](https://serverfault.com/questions/791217/boot-iso-from-pxe-server-via-http) ```shell # 拷贝 memdisk 模块 sudo cp /usr/lib/syslinux/bios/memdisk /srv/tftp/boot/ # 拷贝菜单(可选) sudo cp /usr/lib/syslinux/bios/menu.c32 /srv/tftp/boot/ ``` 编辑`/srv/tftp/boot/pxelinux.cfg/default` ```shell DEFAULT win7_sp1 # 指定标签 #DEFAULT menu.c32 # 指定菜单 LABEL linux KERNEL vmlinuz-linux APPEND initrd=initramfs-linux.img quiet ip=:::::eth0:dhcp nfsroot=192.168.50.200:/boot LABEL win7_sp1 LINUX memdisk # 要求此模块存在 INITRD http://192.168.50.200:8888/win7_sp1.iso # 这里配置了nginx服务,能正常访问 APPEND iso raw stack=51200 ``` ![提示无法找到http对应的文件](./images/提示无法找到http对应的文件.png) ## 6、通过tftp引导本地iso成功 编辑`/srv/tftp/boot/pxelinux.cfg/default` ```shell LABEL ubuntu LINUX memdisk INITRD ../ubuntu.iso APPEND iso raw stack=51200 ``` ```shell pwd /srv/tftp # 查看 ubuntu.iso 镜像所在位置,在 tftp 服务器的根目录下 # 在 pxelinux.0 的上一层目录 ll total 1.4G drwxr-xr-x 3 root root 4.0K Mar 28 07:08 boot/ -r--r--r-- 1 root root 59K Mar 28 01:54 ldlinux.sys -rwxr-xr-x 1 root root 1.4G Mar 28 03:39 ubuntu.iso* lrwxrwxrwx 1 root root 27 Mar 28 05:39 win7_sp1.iso -> /home/luo/temp/win7_sp1.iso* ``` ![使用tftp传递文件很慢](./images/使用tftp传递文件很慢.png) # 六、headscale 实现点对点通信 > [参考博客](https://icloudnative.io/posts/how-to-set-up-or-migrate-headscale/) > > [tailscale 客户端 v1.38.3](https://github.com/tailscale/tailscale) > > [headscale 服务端 v0.21.0](https://github.com/juanfont/headscale) ## 1、服务端配置 > [配置文档参考](https://github.com/juanfont/headscale/blob/main/docs/running-headscale-linux.md) > > [官方headscale配置文件参考](https://github.com/juanfont/headscale/blob/main/config-example.yaml) > > ⚠️ [ /etc/headscale/config.yaml 配置文件内容 ](./headscale/config.yaml) ```shell # 创建用户 sudo useradd --system headscale # 下载 headscale 二进制文件 wget https://ghproxy.com/https://github.com/juanfont/headscale/releases/download/v0.21.0/headscale_0.21.0_linux_amd64 # 赋予执行权限 sudo chmod +x headscale_0.21.0_linux_amd64 # 移动到 bin 目录下 sudo mv headscale_0.21.0_linux_amd64 /usr/local/bin/ # 变更拥有者 sudo chown headscale:headscale /usr/local/bin/headscale_0.21.0_linux_amd64 # 创建 sqlite 数据库 目录 和套接字目录 sudo mkdir -p /var/lib/headscale # 创建数据库 sudo touch /var/lib/headscale/db.sqlite # 配置拥有者 sudo chown -R headscale:headscale /var/lib/headscale/ sudo mkdir /etc/headscale/ # 创建配置文件(具体内容请往上参考官方模版或我的模版) sudo touch /etc/headscale/config.yaml sudo chown -R headscale:headscale /etc/headscale/ ``` 使用 `systemd` 来后台运行`headscale` 以下为`/usr/lib/systemd/system/headscale.service` ```shell [Unit] Description=headscale controller After=syslog.target After=network.target [Service] Type=simple # 如果不想配置权限那么麻烦,可以把这里的用户和组给注释了 User=headscale Group=headscale # 这里有改动 ExecStart=/usr/local/bin/headscale_0.21.0_linux_amd64 serve Restart=always RestartSec=5 # Optional security enhancements NoNewPrivileges=yes PrivateTmp=yes ProtectSystem=strict ProtectHome=yes WorkingDirectory=/var/lib/headscale ReadWritePaths=/var/lib/headscale /var/run/headscale AmbientCapabilities=CAP_NET_BIND_SERVICE RuntimeDirectory=headscale [Install] WantedBy=multi-user.target ``` 启动`headscale` ```shell sudo systemctl enable --now headscale systemctl status headscale ● headscale.service - headscale controller Loaded: loaded (/lib/systemd/system/headscale.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2023-04-04 10:48:38 CST; 29min ago Main PID: 2282094 (headscale_0.21.) Tasks: 8 (limit: 2262) Memory: 25.3M CGroup: /system.slice/headscale.service └─2282094 /usr/local/bin/headscale_0.21.0_linux_amd64 serve ``` 访问headscale的metrics成功 ![访问headscale的metrics成功](./images/访问headscale的metrics成功.png) ```shell # 注册一个用户 # 这里的用户其实是 namespace 或者一个租户 sudo headscale_0.21.0_linux_amd64 users create arch # 查看用户列表 sudo headscale_0.21.0_linux_amd64 users list ID | Name | Created 1 | arch | 2023-04-04 02:03:33 ``` ## 2、windows连接headscale > [tailscale windows 客户端下载地址](https://tailscale.com/download/windows) 访问`http://1.15.49.156:8083/windows`然后将本机注册到`headscale`的节点列表中 windows注册到headscale教程 ![windows注册到headscale教程](./images/windows注册到headscale教程.png) ### (1)windows命令行注册到head scale ```cmd C:\Users\luo>tailscale login --login-server http://1.15.49.156:8083 To authenticate, visit: http://1.15.49.156:8083/register/nodekey:89af530675bbdd64b682ca9edce55b114497cf35e6973bc14b5147064579971e Success. ``` 提示去headscale中将本机注册到节点列表中 ![提示去headscale中将本机注册到节点列表中](./images/提示去headscale中将本机注册到节点列表中.png) ### (2)headscale中注册tailscale节点 需要在`headscale`中执行 ```shell # 注册 # --user 指定前面创建过的用户名称 # --key 就是上一步浏览器给出的 key,注意需要添加 nodekey: 作为前缀 luo@VM-4-2-ubuntu ~> headscale_0.21.0_linux_amd64 nodes register --user arch --key nodekey:89af530675bbdd64b682ca9edce55b114497cf35e6973bc14b5147064579971e Machine desktop-sl2ssnp registered # 查看节点列表 luo@VM-4-2-ubuntu ~> headscale_0.21.0_linux_amd64 nodes list ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses | Ephemeral | Last seen | Expiration | Online | Expired 2 | DESKTOP-SL2SSNP | desktop-sl2ssnp | [ZX11r] | [ia9TB] | arch | 100.64.0.2, fd7a:115c:a1e0::2 | false | 2023-04-04 02:34:27 | 0001-01-01 00:00:00 | online | no ``` ## 3、添加linux节点到headscale中 > [参考](https://github.com/tailscale/tailscale) ### (1)运行tailscale前后台服务 ```shell # 安装 tailscale 和 tailscaled 服务 go install tailscale.com/cmd/tailscale{,d}@latest # 默认会被安装到 ~/go/bin 目录下 cd ~/go/bin # 启动 tailscaled 服务 sudo ./tailscaled # 将本linux节点添加到 headscale 中 sudo ./tailscale up --login-server http://1.15.49.156:8083 ``` ![linux添加到headscale中的命令提示](./images/linux添加到headscale中的命令提示.png) ### (2)headscale中添加linux节点 在`headscale`中执行 ```shell # 添加节点 headscale_0.21.0_linux_amd64 nodes register --user arch --key nodekey:79acdea719b856843060de0cc0a8156a2df191c40f240757563bb935de10156f Machine archlinux registered # 查看 节点列表 luo@VM-4-2-ubuntu /e/headscale> headscale_0.21.0_linux_amd64 nodes list ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses | Ephemeral | Last seen | Expiration | Online | Expired 1 | archlinux | archlinux | [YEdSg] | [eazep] | arch | 100.64.0.1, fd7a:115c:a1e0::1 | false | 2023-04-04 02:50:55 | 0001-01-01 00:00:00 | online | no 2 | DESKTOP-SL2SSNP | desktop-sl2ssnp | [ZX11r] | [ia9TB] | arch | 100.64.0.2, fd7a:115c:a1e0::2 | false | 2023-04-04 02:50:50 | 0001-01-01 00:00:00 | online | no ``` ## 4、最终效果演示 windows中复制其他节点的ip地址 ![windows中复制其他节点的ip地址](./images/windows中复制其他节点的ip地址.png) windows使用tailscale的ip进行连接 ![windows使用tailscale的ip进行连接](./images/windows使用tailscale的ip进行连接.png) 测试点对点的连接速度 ![点对点连接速度很快](./images/点对点连接速度很快.png) ## 5、使用token来添加节点 `headscale`创建一个`token` ```shell headscale_0.21.0_linux_amd64 preauthkeys create --expiration 24h --user arch --reusable 5ee7588cefb230bb682383b30c4f50a3c6f2a5e9f0a3d8dd ``` 使用`token`注册到`headscale`中 > 格式: > > ``` > tailscale up --login-server --authkey > ``` ![使用token注册到headscale中](./images/使用token注册到headscale中.png) 远程桌面连接测试 ![远程桌面连接测试](./images/远程桌面连接测试.png) # 七、最初的Arch学习笔记 ArchLinux arm 版 archlinux 下载国内镜像源:`https://mirrors.ustc.edu.cn/` 查看可用的块设备 ```shell apt install -y util-linux lsblk ``` ```shell # 使用带图形界面的分区工具 cfdisk # 分区之后,发现只有 root 分区是 ext4 的文件格式, # 如果要挂载一个分区,就必须先将这个分区格式化 # efi 分区没有被格式化,所以不能挂载 # 以下命令将 efi 分区格式化为 ext4 格式 # mkfs.ext4 /dev/sda1 mkfs.fat -F32 /dev/sda1 # 将根分区挂载到 /mnt 我这里的根分区是 /dev/sda3 mount /dev/root_partition(根分区) /mnt # 然后使用 mkdir(1) 创建其他剩余的挂载点(比如 /mnt/efi)并挂载其相应的磁盘卷。 # 创建 efi 文件夹 # 注意: 挂载分区一定要遵循顺序,先挂载根(root)分区(到 /mnt),再挂载引导(boot)分区(到 /mnt/boot 或 /mnt/efi,如果单独分出来了的话),最后再挂载其他分区。否则您可能遇到安装完成后无法启动系统的问题。 mkdir /mnt/efi # 挂载 efi分区 mount /dev/sda1 /mnt/efi # 如果创建了 swap 交换空间卷,请使用 swapon(8) 启用它: ``` > [遇到不能将引导写入efi分区的问题](https://superuser.com/questions/1053388/grub2-install-error-boot-efi-doesnt-look-like-an-efi-partition-on-a-fresh-ge/1053435) > > [官方安装教程](https://wiki.archlinux.org/title/GRUB_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)) > > The answer is simple. EFI System Partition (ESP) should be FAT32 (FAT16 or even FAT12 will also do for most proper UEFI; they are mostly shown as `vfat` in Linux) instead of ext2: > > 将efi分区转为 fat 格式即可 ```shell pacman -Sy grub efibootmgr grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB # grub2-install: error: /boot/efi doesn't look like an EFI partition on a fresh Gentoo install # 此时 efibootmgr 被 安装到了 /efi/EFI/GRUB/grubx64.efi 下 #使用 grub-mkconfig 工具来生成 /boot/grub/grub.cfg: grub-mkconfig -o /boot/grub/grub.cfg ``` ### 修改fat文件系统的卷标 ```shell # 安装 $ sudo apt-get install mtools # 新建配置文件 $ cp /etc/mtools.conf ~/.mtoolsrc # 编辑刚复制的”~/.mtoolsrc”文件,在最後一行加入如下命令行: drive i: file="/dev/sda2" //里面的”/devsda2”应根据实际情况更改为你要改的盘 # 更改命令提示符路径到”i:”盘: $ mcd i: # 查看”i:”当前的卷标 $ sudo mlabel -s i: # 更改”i:”盘原始卷标为你喜欢的新卷标名: $ sudo mlabel i: Volume label is XXX Enter the new volume label : newLabelName ``` ### 设备驱动 默认的 Arch Linux 内核是**模块化**的,,硬件的设备驱动作为[内核模块](https://wiki.archlinux.org/title/Kernel_modules)保存在硬盘上。启动时 [udev](https://wiki.archlinux.org/title/Udev) 会根据硬件加载不同的驱动模块,这就创建了需要的网络接口。 有些无线芯片需要额外的固件,默认安装的 [linux-firmware](https://archlinux.org/packages/?name=linux-firmware) 提供了很多固件。如果缺失需要的固件,请查看 [#安装 driver/firmware](https://wiki.archlinux.org/title/Network_configuration_(简体中文)/Wireless_(简体中文)#安装_driver/firmware). Udev 不是完美的,有些内核模块需要[手动安装](https://wiki.archlinux.org/title/Kernel_modules#Manual_module_handling). 有些时候 Udev 会同时加载相互冲突的多个模块,就需要[屏蔽](https://wiki.archlinux.org/title/Kernel_modules#Blacklisting) 不需要的模块。 ### 检查设备状态 根据设备是 PCI 还是 USB 连接,执行 `lspci -k` 或 `lsusb -v` 检查设备驱动是否已经加载: ``` $ lspci -k 06:00.0 Network controller: Intel Corporation WiFi Link 5100 Subsystem: Intel Corporation WiFi Link 5100 AGN Kernel driver in use: iwlwifi Kernel modules: iwlwifi ``` 如果是 USB 设备,执行 `dmesg | grep usbcore` 可以看到类似下面的输出 `usbcore: registered new interface driver rtl8187`。 通过 `ip link` 查看无线 ([设备名](https://wiki.archlinux.org/title/Network_configuration#Device_names)[[断开的链接](https://wiki.archlinux.org/title/ArchWiki:Requests#Broken_section_links):无效的部分],通常是类似 `wlp2s1`) 的设备。启用设备: ``` # ip link set <设备名> up ``` 如果设备加载,接口正常启用,说明不需要安装额外的驱动和固件。 ```shell ip address add 192.168.50.150/24 dev ens33 ip link set ens33 up # 添加路由表 # 添加到本网段的路由 ip route add 192.168.50.0/24 dev ens33 # 添加到网关的路由 ip route add default via 192.168.50.1 dev ens33 ``` ### 设置dns服务器 `https://wiki.archlinux.org/title/Domain_name_resolution_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)` ```shell #选择其它 DNS 服务器 #要使用 DNS 服务器,请编辑 /etc/resolv.conf,把要使用的服务器放到文件的开头,修改是立即生效的。 vi /etc/resolv.conf # OpenNIC IPv4 nameservers (US) nameserver 8.8.8.8 ``` ### 安装桌面 ```shell pacman -Syy openssh systemctl enable --now sshd # 使用 root 账户登录不上 useradd luo passwd luo pacman -S xorg plasma plasma-wayland-session kde-applications ``` `https://www.linuxprobe.com/arch-linux-kde.html` ### 设置国内镜像源 1. `sudo vim /etc/pacman.d/mirrorlist` 2. 添加`arch linux`官方包的国内镜像源 ```shell Server = http://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch Server = http://mirrors.dgut.edu.cn/archlinux/$repo/os/$arch Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch Server = http://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch ``` 3. `sudo pacman -Syy` 4. 添加国内包的镜像源 `sudo vim /etc/pacman.conf` ```shell # 最后一行加上 [archlinuxcn] SigLevel = Never Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch ``` 5. 更新软件列表,并且下载`Arch Linux CN PGP keyring` ```shell sudo pacman -Syy sudo pacman archlinuxcn-keyring ``` ### luo 不在 sudoers 文件中。此事将被报告 ```shell # 出现这个提示,就是这个用户没法得到超级用户权限。怎么办?变成超级用户: vi /etc/sudoers #增加 ALL=(ALL:ALL) ALL #某账号 ALL=(ALL:ALL) ALL #如果想不输入密码: ALL=(ALL) NOPASSWD: ALL ``` 我的`/etc/sudoers` ```shell root ALL=(ALL) ALL ## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL ## Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL ``` ### 安装输入法 1. 编辑 `sudo nano /etc/pacman.conf `文件 ```shell [archlinuxcn] SigLevel = Optional TrustedOnly Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch ``` 2. 让`pacman`的配置生效 ```shell sudo pacman -Syy && sudo pacman -S archlinuxcn-keyring ``` 3. 安装谷歌浏览器 ```shell sudo pacman -S google-chrome ``` 4. 安装输入法 ```shell sudo pacman -S fcitx-im #默认全部安装 sudo pacman -S fcitx-configtool sudo pacman -S fcitx-sunpinyin #为了保险起见,也可以使用下面的安装个谷歌拼音备用 sudo pacman -S fcitx-googlepinyin ``` 5. 配置输入法: 编辑 `sudo nano ~/.xprofile `文件 ```shell export LC_ALL=zh_CN.UTF-8 export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=“@im=fcitx” ``` 最后重启查看效果 ### [linux 修改home目录下的中文目录名为英文](https://www.cnblogs.com/mysic/p/5955388.html) 1. 编辑`/home/luo/.config/user-dirs.dirs`,把所有的中文名称修改为英文名称 2. 在`home`目录下创建对应的英文名称路径 3. 运行 `xdg-user-dirs-update` 4. 重启机器 ### 安装驱动 ```shell # 安装xorg驱动 pacman -S xorg # 安装显卡驱动 #通用: pacman -S xf86-video-vesa #英伟达: pacman -S xf86-video-nv #ATI: pacman -S xf86-video-ati # 安装笔记本触摸板驱动 pacman -S xf86-input-synaptics # 安装声卡驱动 pacman -S alsa-utils pacman -Sy alsa-lib alsa-utils systemctl --user enable pulseaudio ``` ### 安装网易云 1、去网易云音乐官网下载一个deb包 ```shell pacman -S dpkg dpkg -i xxx.deb ``` ### 安装`windows`微信 ```shell sudo pacman -S yay yay -S deepin-wine-wechat yay -S deepin-wine-qq ``` ### 安装上网利器 ```shell sudo pacman -S shadowsocks-qt5 ``` ### 安装虚拟机 ```shell yay -S --noconfirm virtualbox virtualbox-host-modules-arch virtualbox-ext-oracle # 解决 vmware 无法打开虚拟机 #Ubuntu系统打开Vmware虚拟机出现:could not open /dev/vmmon:?????? please make sure that the kernel moduel vmmon is load #解决方法,在终端执行命令: sudo /etc/init.d/vmware start ``` ### 安装unzip ```shell # 搜索 pacman -Ss zip pacman -Sy extra/unzip sudo mkfs.ext4 /dev/sdb1 # 改变磁盘的 label sudo e2label /dev/sdb1 UNRAID ``` 安装 yay ```shell sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si ``` # 八、安装 NVIDIA 显卡驱动 ## 1、Arch安装 linux-headers 头文件包 > 这里要求头文件的版本和当前linux 的版本一致 > 否则安装驱动的时候将编译失败 > archlinux 没有旧版本的软件安装包,就版本的安装比较麻烦 > 建议先升级系统到最新版本,这样就能和头文件的版本对应上 > ```shell # 更新内核到最新版本 sudo pacman -Syyu # 如果其中遇上PGP签名问题,可先升级 sudo pacman -Sy archlinux-keyring # 查看系统版本 uname -r 6.2.11-arch1-1 # 查看已安装的linux头文件 pacman -Qe linux-headers linux-headers 6.2.11.arch1-1 ``` 安装驱动即可 ```shell sudo bash NVIDIA-Linux-x86_64-525.89.02.run ``` ## 2、Ubuntu安装驱动 1、需要关闭依赖于 x server 的桌面环境,ubuntu环境下,默认的桌面环境是gdm ```shell # sudo systemctl disable --now gdm ``` #### 关闭 ubuntu 的开源驱动 2、修改grub配置文件 打开`/etc/default/grub` 配置文件,并将 `GRUB_CMDLINE_LINUX_DEFAULT` 属性更改为以下内容: ``` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0" ``` 3、更新grub: ``` update-grub ``` 4、重新启动系统: ``` reboot ``` 5、开始安装驱动 ```shell sudo ./NVIDIA-Linux-x86_64-525.116.04.run ``` 6、查看是否安装成功 ```shell luo@ub:~/Downloads$ nvidia-smi Mon Jun 12 09:27:47 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.116.04 Driver Version: 525.116.04 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A | | 45% 36C P5 14W / 150W | 0MiB / 6144MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+ ``` ## 3、安装 NVIDIA Docker 支持 > [参考 github nvidia-docker]((https://github.com/NVIDIA/nvidia-docker)) > > [添加nvidia仓库参考](https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html) > > [安装步骤](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) ```shell # 添加 nvidia apt 仓库 distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g') wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb sudo dpkg -i cuda-keyring_1.0-1_all.deb sudo apt-get update # 安装 sudo apt-get install -y nvidia-container-toolkit-base # 安装结果 nvidia-ctk --version NVIDIA Container Toolkit CLI version 1.13.1 commit: 28b70663f1a2b982e59e83bcf1844177dc745208 # 生成 nvidia cdi (container device interface)配置 # 每次更改了硬件设备或者驱动、cuda配置都需要重新执行这个命令 sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml sudo grep " name:" /etc/cdi/nvidia.yaml name: "0" name: all # 安装 nvidia-container-toolkit sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker INFO[0000] Loading docker config from /etc/docker/daemon.json INFO[0000] Config file does not exist, creating new one INFO[0000] Wrote updated config to /etc/docker/daemon.json INFO[0000] It is recommended that the docker daemon be restarted. sudo systemctl daemon-reload sudo systemctl restart docker ``` 运行一个容器证明nvidia-docker安装成功 ```shell sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi Unable to find image 'nvidia/cuda:11.6.2-base-ubuntu20.04' locally 11.6.2-base-ubuntu20.04: Pulling from nvidia/cuda 846c0b181fff: Pull complete b787be75b30b: Pull complete 40a5337e592b: Pull complete 8055c4cd4ab2: Pull complete { a0c882e23131: Pull complete Digest: sha256:9928940c6e88ed3cdee08e0ea451c082a0ebf058f258f6fbc7f6c116aeb02143 Status: Downloaded newer image for nvidia/cuda:11.6.2-base-ubuntu20.04 Mon Jun 12 02:01:30 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.116.04 Driver Version: 525.116.04 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A | | 45% 36C P5 14W / 150W | 0MiB / 6144MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+ ``` 运行`tensorflow`来验证`nvidia`驱动是否安装成功 ```shell docker run --gpus all -it --rm tensorflow/tensorflow:latest-gpu-jupyter python -c "import tensorflow as tf;print(tf.config.list_physical_devices('GPU'))" 2023-06-12 02:25:38.855538: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:939] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-06-12 02:25:38.876267: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:939] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-06-12 02:25:38.876661: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:939] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')] ``` ## 4、安装CUDA > 环境要求:`Tensorflow 2.12 & CUDA 11.8` on Ubuntu 22.04. > > `Tensorflow 2.12 & CUDA 12.1` on Ubuntu 22.04. 下,`tensorflow`无法识别`cuda`驱动 > > [CUDA 11.8 下载地址参考](https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local) ```shell sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb sudo cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-D95DBBE2-keyring.gpg /usr/share/keyrings/ sudo apt update sudo apt install -y cuda ``` 编辑`fish`的环境变量 ```shell vim ~/.config/fish/config.fish # 配置 cudnn 的环境依赖 set -x LD_LIBRARY_PATH /usr/local/cuda/lib64 $LD_LIBRARY_PATH # 添加 cuda 到环境变量中 set -x PATH $PATH /usr/local/cuda/bin /home/luo/.local/bin ``` 验证安装成功 ```shell nvcc --version (base) nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 # 查看 nvidia 控制面板 nvidia-smi (base) Fri Jun 16 13:27:38 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 520.61.05 Driver Version: 520.61.05 CUDA Version: 11.8 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... On | 00000000:01:00.0 Off | N/A | | 45% 38C P8 6W / 150W | 4MiB / 6144MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+ ``` ## 5、安装cuDNN > `cuDNN`必须要对应`CUDA`的版本才能正常运行 > > 因为上面安装的是`cuda 11.8`,所以这里的`cuDNN`要对应上`cuda 11.8` > > [参考](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html) > > [cudnn下载地址](https://developer.nvidia.com/rdp/cudnn-download) ![下载cudnn](./images/下载cudnn.png) ```shell sudo dpkg -i cudnn-local-repo-ubuntu2204-8.9.2.26_1.0-1_amd64.deb sudo cp /var/cudnn-local-repo-ubuntu2204-8.9.2.26/cudnn-local-D7CBF0C2-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt install libcudnn8-samples=8.9.2.26-1+cuda11.8 sudo apt install libcudnn8-dev=8.9.2.26-1+cuda11.8 sudo apt install libcudnn8=8.9.2.26-1+cuda11.8 ``` ## 6、验证cuda、cudnn安装 ```shell cp -r /usr/src/cudnn_samples_v8/ ~/temp cd ~/temp/cudnn_samples_v8/mnistCUDNN/ make clean make # 运行编译完成的程序 ./mnistCUDNN (base) Executing: mnistCUDNN cudnnGetVersion() : 8902 , CUDNN_VERSION from cudnn.h : 8902 (8.9.2) Host compiler version : GCC 11.3.0 There are 1 CUDA capable devices on your machine : device 0 : sms 10 Capabilities 6.1, SmClock 1809.5 Mhz, MemSize (Mb) 6078, MemClock 4004.0 Mhz, Ecc=0, boardGroupID=0 Using device 0 # 省略 Result of classification: 1 3 5 Test passed! # 验证通过 ``` 编译时发现问题 ```shell # 编译 nvidia 官方demo,发现缺失 依赖头文件FreeImage.h make CUDA_VERSION is 11010 Linking agains cublasLt = true CUDA VERSION: 11010 TARGET ARCH: x86_64 HOST_ARCH: x86_64 TARGET OS: linux SMS: 35 50 53 60 61 62 70 72 75 80 86 test.c:1:10: fatal error: FreeImage.h: No such file or directory 1 | #include "FreeImage.h" | ^~~~~~~~~~~~~ ———————————————— ``` 解决方案:安装依赖 ```shell sudo apt install -y libfreeimage3 libfreeimage-dev ``` ## 7、验证pytorch是否识别到GPU ```shell python -c "import torch;print(torch.cuda.is_available());print(torch.cuda.get_device_name(0));print(torch.version.cuda)" True NVIDIA GeForce GTX 1060 6GB 11.3 ``` ## 8、验证tensorflow是否识别GPU ```shell python -c "import tensorflow as tf;print(tf.config.list_physical_devices('GPU'))" (ldm) 2023-06-16 12:25:08.239305: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-06-16 12:26:00.186207: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-06-16 12:27:01.681241: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2023-06-16 12:27:09.350846: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2023-06-16 12:27:09.351825: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')] ``` # 九、在Docker中运行wine,wine运行GUI程序,并通过X11把界面渲染到宿主机 > [参考](https://medium.com/geekculture/run-a-gui-software-inside-a-docker-container-dce61771f9) > [参考](https://www.baeldung.com/linux/docker-container-gui-applications) ```shell # 运行 x server 接收请求 # 每次物理机开机都需要执行,不能通过SSH执行 xhost +local: docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix 镜像名称 ``` # 十、kubeadm 使用阿里云k8s容器镜像快速构建k8s集群 ```shell sudo kubeadm init --control-plane-endpoint 192.168.1.130 --v=5 --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers ``` # 十一、基于clonezilla克隆Linux磁盘为镜像,使用pxe批量自动部署到任意多台主机 > ubuntu20.4作为服务端,批量克隆kylin操作系统 ## 1、安装环境 ```shell sudo apt install -y tftpd-hpa isc-dhcp-server nginx syslinux pxelinux ``` ## 2、配置DHCP服务器跳转pxe服务 编辑 `/etc/dhcp/dhcpd.conf` ```conf subnet 192.168.25.0 netmask 255.255.255.0 { range 192.168.25.3 192.168.25.199; option routers 192.168.25.2; option subnet-mask 255.255.255.0; option domain-name-servers 223.5.5.5; filename "pxelinux.0"; next-server 192.168.25.200; # PXE服务器IP } ``` 重启服务 ```shell systemctl restart isc-dhcp-server ``` ## 3、配置tftp服务 ### 修改 tftp 的默认路径为 `/var/lib/tftpboot` ```conf cat /etc/default/tftpd-hpa # /etc/default/tftpd-hpa TFTP_USERNAME="tftp" # 核心修改 tftp 路径 TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS=":69" TFTP_OPTIONS="--secure" ``` 重启服务 ```shell systemctl status tftpd-hpa ``` ## 3、配置pxe启动项 > [clonezilla 参考文档](https://clonezilla.org/livepxe.php) > > [pxe启动clonezilla详细参数说明](https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/99_Misc) ### 1.拷贝bios ```shell sudo cp /usr/lib/syslinux/modules/bios/* /var/lib/tftpboot/ ``` ### 2.下载 clonezilla [下载地址](https://clonezilla.org/downloads/download.php?branch=stable) ```shell ``` ### 3.编辑`/var/lib/tftpboot/pxelinux.cfg/default` ```conf DEFAULT vesamenu.c32 PROMPT 0 TIMEOUT 30 MENU TITLE PXE Deployment LABEL Clonezilla-live MENU LABEL Clonezilla Live (Ramdisk) KERNEL vmlinuz INITRD initrd.img APPEND boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales=en_US.UTF-8 keyboard-layouts=us ocs_live_run="ocs-live-restore" ocs_live_extra_param=" -g auto -e2 -c -j2 -batch -k0 -plu -p poweroff restoredisk 2025-07-14-15-img sda" ocs_live_batch=yes ocs_repository="smb://luo:1234@192.168.25.200/luo_home/kylin" net.ifnames=0 nosplash noprompt fetch=http://192.168.25.200/filesystem.squashfs ``` > 拷贝`clonezilla-live-3.2.2-15-amd64.iso`下的`live/vmlinuz`到`/var/lib/tftpboot/`中 > > 拷贝`clonezilla-live-3.2.2-15-amd64.iso`下的`live/initrd.img`到`/var/lib/tftpboot/`中 > > 需要配置nginx使得能正常访问`fetch=http://192.168.25.200/filesystem.squashfs`, > nginx 配置比较简单,不在这里演示 > 拷贝的原因是为了pxe启动的时候能找到 内核、根文件系统等 > > 拷贝 `pxelinux.0` > > ```PowerShell scp H:\live\vmlinuz u20:~/kylin scp H:\live\initrd.img u20:~/kylin scp H:\live\filesystem.squashfs u20:~/kylin ``` ```shell sudo cp /usr/lib/PXELINUX/pxelinux.0 /var/lib/tftpboot/ ``` # 十二、在老ubuntu上通过docker,使得vscode能通过ssh访问 > 问题描述 > > vs code 直接通过ssh连接 ubuntu18的时候报错 ```shell find GLIBC >= v2.28.0 (but found v2.27.0 instead) for GNU environments ``` > 解决方案 > > 使用docker运行一个 ubuntu22, > vscode 通过ssh连接这个 docker 中的 ubuntu22 ```shell docker run -it -v $HOME:/home/luo --name ubuntu -p 2222:22 ubuntu:22.04 bash -c "apt update && apt install -y openssh-server && service ssh start && useradd -p 1234 luo && bash" ``` # 十三、使用grub通过chainloader加载win10 编辑 `/etc/grub.d/40_custom ` ```conf #!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "win10" { insmod chain insmod ntfs set root=(hd0,gpt1) chainloader /EFI/Microsoft/Boot/bootmgfw.efi } ``` 更新crub核心配置文件 ```shell grub-mkconfig -o /boot/grub/grub.cfg ``` # 十四、uefi 通过 pxe 引导 grubx64.efi 然后启动clonezilla ## 1、手动创建并配置grubx64.efi ```shell sudo apt install -y grub-efi-amd64 sudo mkdir -p /var/lib/tftpboot/efi/ubuntu/ # 拷贝 grub 所需的插件 sudo cp -r cd /usr/lib/grub/x86_64-efi /var/lib/tftpboot/efi/ubuntu/ # 构建grubx64.efi # 需要在这个目录下面生成grubx64.efi cd /var/lib/tftpboot/efi/ubuntu/ # -p = --prefix 这里指定的路径是在TFTP服务器下的相对路径 # grub 以这里为基础开始运行 sudo grub-mkimage \ -O x86_64-efi \ -o grubx64.efi \ -p /efi/ubuntu \ --format=x86_64-efi \ normal part_gpt part_msdos ext2 fat iso9660 configfile tftp efinet # 配置 grub.cfg sudo vi /var/lib/tftpboot/efi/ubuntu/grub.cfg ``` ```conf # 编辑 /var/lib/tftpboot/efi/ubuntu/grub.cfg set root=(tftp,192.168.100.20) set net_default_server=192.168.100.20 #root=(tftp,192.168.194.20) menuentry "Clonezilla Live (PXE)" { linux (tftp)/vmlinuz \ boot=live \ union=overlay \ config \ noswap \ username=user components quiet edd=on nomodeset nodmraid locales=en_US.UTF-8 keyboard-layouts=us ocs_live_run="ocs-live-general" ocs_live_extra_param=" -g auto -e2 -c -j2 -batch -k0 -plu -p poweroff restoredisk 2025-08-12-11-img sda" ocs_live_batch=yes ocs_repository="smb://luo:1234@192.168.100.20/luo/images" net.ifnames=0 nosplash noprompt fetch=http://192.168.100.20/Downloads/filesystem.squashfs initrd (tftp)/initrd.img } ``` ```shell # 查看最终目录结构 tree tftpboot/ tftpboot/ ├── efi │   └── ubuntu │   ├── grub.cfg │   ├── grubx64.efi │   └── x86_64-efi │   ├── acpi.mod │   ├── adler32.mod │   ├── affs.mod │   # 省略 ├── initrd.img └── vmlinuz ``` ## 2、修改dhcp服务器指向tftp服务器中的grubx64.efi `/etc/dhcp/dhcpd.conf` ```conf subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.21 192.168.100.199; option routers 192.168.100.2; option subnet-mask 255.255.255.0; option domain-name-servers 223.5.5.5; # 不能写绝对路径 # 指向tftp服务器下的 grubx64.efi filename "efi/ubuntu/grubx64.efi"; next-server 192.168.100.20; # PXE服务器IP } ``` # 十五、配置 client从 pxe uefi 启动到 clonezilla 的client模式, clonezilla server 组播部署客户机 ## 1、配置服务端 vmware直接通过`clonezilla-live-3.2.2-15-amd64.iso`启动,然后选择server模式,然后下一步 ![](./images/select_to_start_clonezilla_server.png) ![clonezilla server 的日志](./images/clonezilla_server_日志.png) ## 2、修改`grub.cfg`让client启动并等待达到server指定的client数量之后开始组播安装 ```conf # 编辑 /var/lib/tftpboot/efi/ubuntu/grub.cfg set root=(tftp,192.168.100.20) set net_default_server=192.168.100.20 #root=(tftp,192.168.194.20) menuentry "multicast client Clonezilla (PXE)" { # 关键区别 # 1、删掉 ocs_live_extra_param=" -g auto -e2 -c -j2 -batch -k0 -plu -p poweroff restoredisk 2025-08-12-11-img sda" \ # 2、配置client开机后执行 ocs-live-get-img [ clonezilla server 所在 # 的 server 地址] # ocs_live_run="ocs-live-get-img 192.168.20.222" # 3、删掉 ocs_repository="smb://luo:1234@192.168.100.20/luo/images" # server通过组播发送镜像到每一台client,所以client不需要访问smb共享镜像 linux (tftp)/vmlinuz \ boot=live \ union=overlay \ config \ noswap \ username=user components quiet edd=on nomodeset nodmraid \ locales=en_US.UTF-8 keyboard-layouts=us \ ocs_live_run="ocs-live-get-img 192.168.20.222" \ ocs_live_batch=yes \ net.ifnames=0 nosplash noprompt \ fetch=http://192.168.100.20/Downloads/filesystem.squashfs initrd (tftp)/initrd.img } ``` # 十六、三层交换机vlanif路由,并实现子网汇聚 > 上级路由使用 `10.22.22.0/23` 同时指向 `10.22.22.0/24`和`10.22.23.0/24` ![](./network_enginer/子网汇聚_交换机各自设置自己的vlanif%20ip地址_实现三层路由.png)