2024-04-23 16:41:21 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<title>Dich'blog</title>
|
|
|
|
|
|
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5">
|
|
|
|
|
<meta name="robots" content="noodp"/>
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://blog.dich.ink/style.css">
|
|
|
|
|
<link rel="stylesheet" href="https://blog.dich.ink/color/blue.css">
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://blog.dich.ink/color/background_dark.css">
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://blog.dich.ink/font-hack-subset.css">
|
|
|
|
|
|
|
|
|
|
<meta name="description" content="">
|
|
|
|
|
|
|
|
|
|
<meta property="og:description" content="">
|
|
|
|
|
<meta property="og:title" content="Dich'blog">
|
|
|
|
|
<meta property="og:type" content="article">
|
|
|
|
|
<meta property="og:url" content="https://blog.dich.ink/awesome-arch-linux/">
|
|
|
|
|
|
|
|
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
|
|
|
<meta name="twitter:description" content="">
|
|
|
|
|
<meta name="twitter:title" content="Dich'blog">
|
|
|
|
|
<meta property="twitter:domain" content="blog.dich.ink">
|
|
|
|
|
<meta property="twitter:url" content="https://blog.dich.ink/awesome-arch-linux/">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="alternate" type="application/atom+xml" title="RSS" href="https://blog.dich.ink/atom.xml">
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body class="">
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
|
|
<header class="header">
|
|
|
|
|
<div class="header__inner">
|
|
|
|
|
<div class="header__logo">
|
|
|
|
|
|
|
|
|
|
<a href="https://blog.dich.ink" style="text-decoration: none;">
|
|
|
|
|
<div class="logo">
|
|
|
|
|
|
|
|
|
|
Dich'blog
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="menu">
|
|
|
|
|
<ul class="menu__inner">
|
|
|
|
|
<li class="active"><a href="https://blog.dich.ink">blog</a></li>
|
|
|
|
|
|
|
|
|
|
<li><a href="https://blog.dich.ink/tags">tags</a></li>
|
|
|
|
|
|
|
|
|
|
<li><a href="https://blog.dich.ink/archive">archive</a></li>
|
|
|
|
|
|
|
|
|
|
<li><a href="https://blog.dich.ink/about">about me</a></li>
|
|
|
|
|
|
|
|
|
|
<li><a href="https://blog.dich.ink/links">links</a></li>
|
|
|
|
|
|
|
|
|
|
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
|
|
|
|
<div class="post">
|
|
|
|
|
|
|
|
|
|
<h1 class="post-title"><a href="https://blog.dich.ink/awesome-arch-linux/">综合工程:Arch从入门到入土</a></h1>
|
|
|
|
|
<div class="post-meta-inline">
|
|
|
|
|
|
|
|
|
|
<span class="post-date">
|
|
|
|
|
2023-08-16
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="post-tags-inline">
|
|
|
|
|
:: tags:
|
|
|
|
|
<a class="post-tag" href="https://blog.dich.ink/tags/tech/">#Tech</a>
|
2024-06-06 10:41:27 +08:00
|
|
|
|
<a class="post-tag" href="https://blog.dich.ink/tags/zong-he-gong-cheng/">#综合工程</a></span>
|
2024-04-23 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-content">
|
|
|
|
|
<p>前言 Arch linux是一个轻量、灵活、滚动更新的 Linux 发行版,衍生了诸多优秀的桌面端linux。其官方Wiki更是被称为技术界的“武林秘籍”;
|
|
|
|
|
但由于该Wiki的中文版比较陈旧,安装教程不太清楚,故先以虚拟机安装Arch为例实际操作一番。</p>
|
|
|
|
|
<span id="continue-reading"></span>
|
|
|
|
|
<hr />
|
2024-05-04 11:46:32 +08:00
|
|
|
|
<p>准备工作:需要</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>
|
|
|
|
|
<p>虚拟机环境,这里推荐使用VMware Workstation Pro.</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p>ISO镜像</p>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>VM学习版:https://www.ahhhhfs.com/33472/</p>
|
|
|
|
|
<p>官方镜像: https://geo.mirror.pkgbuild.com/iso/2023.08.01/</p>
|
2024-04-23 16:41:21 +08:00
|
|
|
|
<hr />
|
|
|
|
|
<h2 id="yi-xin-jian-xu-ni-ji"><strong>一、新建虚拟机</strong></h2>
|
|
|
|
|
<p>1.打开VM,文件—新建虚拟机—典型—下一步,对于硬盘要求建议至少20G,作为后续分区使用;CPU及内存根据实际需求分配,一般取半数。
|
|
|
|
|
注意:完成后需先在编辑虚拟机设置—选项中设置引导为UEFI,否则会导致奇怪的Boot问题。</p>
|
|
|
|
|
<p>2.开启此虚拟机,随后进入界面,回车,跑码后进入tty1。</p>
|
|
|
|
|
<h2 id="er-lian-wang-bing-fen-qu"><strong>二、联网并分区</strong></h2>
|
2024-05-04 11:46:32 +08:00
|
|
|
|
<p>1.使用 <strong>dhcpcd</strong> 命令获取IP地址,由于虚拟机使用NAT故联网容易。</p>
|
|
|
|
|
<p>2.使用 <strong>ping www.baidu.com</strong> 命令检查是否联网,若出现ttl,time=xx ms等数据说明成功,随后再 <strong>Ctrl+C</strong> 停止命令运行,<del>避免百度被DDOS攻击死掉。</del></p>
|
|
|
|
|
<p>3.使用 <strong>timedatectl set-ntp true</strong> 命令更新系统时间,该命令无输出,正所谓无事发生就是最好的。</p>
|
|
|
|
|
<p>4.使用 <strong>fdisk -l</strong> 命令查看系统分区,由于虚拟机的存在只会显示一块硬盘。</p>
|
|
|
|
|
<p>5.接下来是Arch安装中较难的一部分,以20G硬盘空间为例,我们需要划分出512MB的引导分区,15G的根分区以及5G左右的交换分区。由于纯命令行分区比较繁琐,这里使用 <strong>cfdisk</strong> 命令打开分区工具。</p>
|
2024-04-23 16:41:21 +08:00
|
|
|
|
<p>回车选择gpt类型,可以看到如下界面:</p>
|
|
|
|
|
<p>使用左右方向键移动至<strong>New</strong>,新建一个分区,大小为<strong>512MB</strong>,回车确认,并移动至<strong>type</strong>将其类型改为<strong>EFI system</strong>,随后如法炮制,建立根分区(类型为linux filesystem)和交换分区(linux swap)。
|
|
|
|
|
注意:上诉操作完成后需在<strong>Write</strong>中选择<strong>yes</strong>,否则无法保存分区,随后<strong>quit</strong>回到命令行。</p>
|
|
|
|
|
<p>6.分区结束后分别对其进行格式化,命令为</p>
|
2024-05-04 11:46:32 +08:00
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>mkfs.fat -F32 /dev/sda1
|
2024-04-23 16:41:21 +08:00
|
|
|
|
</span><span>mkfs.ext4 /dev/sda2
|
2024-05-04 11:46:32 +08:00
|
|
|
|
</span><span>mkswap -f /dev/sda3
|
2024-04-23 16:41:21 +08:00
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>注意不同分区类型与格式所用命令不同。
|
|
|
|
|
7.格式完成后进行挂载,使用如下命令:</p>
|
2024-05-04 11:46:32 +08:00
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>swapon /dev/sda3
|
2024-04-23 16:41:21 +08:00
|
|
|
|
</span><span>mount /dev/sda2 /mnt
|
|
|
|
|
</span><span>mkdir /dev/sda2 /mnt/home
|
|
|
|
|
</span><span>ls /mnt
|
|
|
|
|
</span><span>mkdir /mnt/boot
|
|
|
|
|
</span><span>mkdir /mnt/boot/EFI
|
|
|
|
|
</span><span>mount /dev/sda1 /mnt/boot/EFI
|
2024-05-04 11:46:32 +08:00
|
|
|
|
</span><span>ls /mnt
|
2024-04-23 16:41:21 +08:00
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>完成后即可开始组件下载。</p>
|
|
|
|
|
<hr />
|
|
|
|
|
<h2 id="san-an-zhuang-ji-ben-zu-jian"><strong>三、安装基本组件</strong></h2>
|
|
|
|
|
<p>1.使用大名鼎鼎的<strong>vim</strong>编辑器,将下载镜像源改为国内,提高下载速度<strong>vim /etc/pacman.d/mirrorlist</strong></p>
|
|
|
|
|
<p>推荐使用清华源,在首行中改为如下命令:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>随后<strong>ESC</strong>,<strong>: wq</strong> 保存退出。</p>
|
|
|
|
|
<p>2.安装基本包,使用命令</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>pacstrap /mnt base base-devel linux linux-firmware dhcpcd
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>一路回车下载。</p>
|
|
|
|
|
<p>3.生成<strong>fstab</strong>文件 ,使用命令</p>
|
2024-05-04 11:46:32 +08:00
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>genfstab -U /mnt > /mnt/etc/fstab
|
2024-04-23 16:41:21 +08:00
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>自动挂载分区,并用<strong>cat /mnt/etc/fstab</strong>观察分区情况。
|
|
|
|
|
4.使用<strong>arch-chroot /mnt</strong>命令切换至系统环境下,此时可以设置时区,语言和主机名(hostname)。
|
|
|
|
|
设置上海为系统时区:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>设置主机名: <strong>vim /etc/hostname</strong>,写入任意你想要的名字。随后在<strong>vim /etc/hosts</strong>中输入如下内容,将<strong>name</strong>改为主机名。</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>127.0.0.1 localhost
|
|
|
|
|
</span><span>::1 localhost
|
|
|
|
|
</span><span>127.0.1.1 name.localdomain name
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>设置语言:使用<strong>vim /etc/locale.gen</strong>命令去掉 <strong>en_US.UTF-8 UTF-8</strong> 以及 <strong>zh_CN.UTF-8 UTF-8</strong> 行前的注释符号,并用<strong>locale-gen</strong>生成新locale,用<strong>echo 'LANG=en_US.UTF-8' > /etc/locale.conf</strong>命令确认输出。</p>
|
|
|
|
|
<p>4.设置root密码:使用<strong>passwd</strong>命令,设置并重复密码。
|
|
|
|
|
5.安装微码:根据硬件选择命令:
|
|
|
|
|
<strong>pacman -S intel-ucode # Intel
|
|
|
|
|
pacman -S amd-ucode # AMD</strong>
|
|
|
|
|
6.安装引导程序:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>pacman -S grub efibootmgr os-prober
|
|
|
|
|
</span><span>grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>生成配置文件:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>grub-mkconfig -o /boot/grub/grub.cfg
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>7.退出并重启虚拟机:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>exit # 退回安装环境
|
|
|
|
|
</span><span>umount -R /mnt # 卸载新分区
|
|
|
|
|
</span><span>reboot # 重启
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>若成功进入登录界面即为成功,可使用<strong>neofetch</strong>命令打印系统信息。</p>
|
|
|
|
|
<hr />
|
|
|
|
|
<h2 id="si-an-zhuang-tu-xing-jie-mian"><strong>四、安装图形界面</strong></h2>
|
|
|
|
|
<p>为便于在虚拟机中操作,我们可以安装KDE-plasma,Xfce等桌面环境。
|
2024-05-04 11:46:32 +08:00
|
|
|
|
1.使用<strong>dhcpcd</strong>获得地址。</p>
|
|
|
|
|
<p>2.新建普通用户<strong>useradd -m -G wheel username</strong> (替换username为你的用户名)并设置密码<strong>passwd username</strong> 。</p>
|
|
|
|
|
<p>3.配置Sudo,使用<strong>pacman -S sudo</strong>安装并在<strong>ln -s /usr/bin/vim /usr/bin/vi/visudo</strong> 中删除 <strong>%wheel ALL=(ALL)ALL</strong> 前的注释符。</p>
|
|
|
|
|
<p>4.reboot后开始安装驱动。由于~~NVIDIA fuck you~~ 众所周知的原因,独显驱动比较难以安装,建议先只上核显。</p>
|
2024-04-23 16:41:21 +08:00
|
|
|
|
<p>以此为例,若为AMD核显,命令为</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sudo pacman -S xf86-video-amdgpu
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>OpenGL和mesa:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sudo pacman -S mesa xf86-video-amdgpu vulkan-radeon libva-mesa-driver mesa-vdpau
|
|
|
|
|
</span><span>sudo pacman -S opencl-mesa lib32-vulkan-radeon lib32-mesa
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>5.使用命令</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>pacman -S plasma-meta konsole dolphin
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>安装KDE组件。
|
|
|
|
|
6.开启sddm守护进程:</p>
|
|
|
|
|
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>systemctl enable sddm
|
|
|
|
|
</span><span>systemctl start sddm
|
|
|
|
|
</span></code></pre>
|
|
|
|
|
<p>7.reboot后进入桌面环境,安装完成。</p>
|
|
|
|
|
<h2 id="hou-ji"><strong>后记</strong></h2>
|
|
|
|
|
<p>设备的多样导致安装中可能会出现一些奇怪的问题,需要自行搜索学习,以不断提高技术水平。</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="pagination">
|
|
|
|
|
<div class="pagination__title">
|
|
|
|
|
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
|
|
|
|
|
<hr />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="pagination__buttons">
|
|
|
|
|
<span class="button previous">
|
|
|
|
|
<a href="https://blog.dich.ink/awesome-chromebook/">
|
|
|
|
|
<span class="button__icon">←</span>
|
|
|
|
|
<span class="button__text">综合工程:ChromeBook研究记</span>
|
|
|
|
|
</a>
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="button next">
|
|
|
|
|
<a href="https://blog.dich.ink/awesome-nas-dsm/">
|
|
|
|
|
<span class="button__text">综合工程:黑群辉NAS极速安装</span>
|
|
|
|
|
<span class="button__icon">→</span>
|
|
|
|
|
</a>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="footer">
|
|
|
|
|
<div class="footer__inner">
|
|
|
|
|
<div class="copyright">
|
|
|
|
|
<span>©
|
|
|
|
|
2024
|
|
|
|
|
Dichgrem</span>
|
|
|
|
|
<span class="copyright-theme">
|
|
|
|
|
<span class="copyright-theme-sep">:: </span>
|
|
|
|
|
Theme: <a href="https://github.com/pawroman/zola-theme-terminimal/">Terminimal</a> by pawroman
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
|
|
<script async defer src="http://173.249.208.93:12345/tracker.js" data-website-id="cluckwxwg0005qf4n55m737sz"></script>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|