{"id":2296,"date":"2023-02-21T14:27:51","date_gmt":"2023-02-21T06:27:51","guid":{"rendered":"https:\/\/km94.com\/?p=2296"},"modified":"2023-02-21T14:27:51","modified_gmt":"2023-02-21T06:27:51","slug":"vultr-vps%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8archlinux%e7%b3%bb%e7%bb%9f%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/dy208.cn\/index.php\/2023\/02\/21\/vultr-vps%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8archlinux%e7%b3%bb%e7%bb%9f%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b\/","title":{"rendered":"Vultr VPS\u5b89\u88c5\u548c\u4f7f\u7528ArchLinux\u7cfb\u7edf\u8be6\u7ec6\u6559\u7a0b"},"content":{"rendered":"<p>ArchLinux\u662f\u4e00\u6b3e\u4ee5\u8f7b\u91cf\u7b80\u6d01\u4e3a\u8bbe\u8ba1\u7406\u5ff5\u7684\u901a\u7528 x86-64 GNU\/Linux \u53d1\u884c\u7248\uff0c\u5b83\u91c7\u7528\u6eda\u52a8\u5347\u7ea7\u6a21\u5f0f\uff0c\u80fd\u5c3d\u91cf\u4fdd\u6301\u6240\u5b89\u88c5\u7684\u8f6f\u4ef6\u59cb\u7ec8\u5904\u4e8e\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u4f7f\u7528\u8d77\u6765\u975e\u5e38\u65b9\u4fbf\u3002\u672c\u6559\u7a0b\u4e3b\u8981\u4ecb\u7ecd\u4e0b\u5728Vultr\u4e91\u670d\u52a1\u5668\u4e0a\u5b89\u88c5ArchLinux\u7684\u65b9\u6cd5\u6b65\u9aa4\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\n\t<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-2298\" alt=\"ArchLinux\u5b89\u88c5\u6559\u7a0b\" src=\"https:\/\/km94.com\/wp-content\/uploads\/2023\/02\/1-94.jpg\"><\/figure>\n\t<\/p>\n<p>1\u3001\u6211\u4eec\u53ef\u4ee5\u4eceVultr ISO\u5e93\u4e2d\u5b89\u88c5ArchLinux\uff0c\u8fd9\u662f\u6bd4\u8f83\u7b80\u5355\u7684\u65b9\u6cd5\u3002\u9996\u5148\u767b\u5f55\u5230Vultr\u8d26\u6237\uff0c\u8bbf\u95ee\u5ba2\u6237\u95e8\u6237\u7f51\u7ad9\u90e8\u7f72\u4e00\u4e2a\u65b0\u7684Vultr VPS\u5b9e\u4f8b\uff08\u5982\u7f8e\u56fdVPS\uff09\uff0c\u7136\u540e\u5728Server Type\u90e8\u5206\uff0c\u70b9\u51fbISO Library\u9009\u9879\u5361\uff0c\u9009\u62e9\u6700\u65b0\u7684Arch\u7248\u672c\u6765\u90e8\u7f72\u670d\u52a1\u5668\u3002<\/p>\n<p>2\u3001\u63a5\u7740\u6267\u884c\u4e0b\u9762\u547d\u4ee4\u6765\u66f4\u65b0\u7cfb\u7edf\u65f6\u95f4\uff0c\u4ee5\u786e\u4fdd\u7cfb\u7edf\u65f6\u95f4\u662f\u51c6\u786e\u65e0\u8bef\u7684\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># timedatectl set-ntp true<\/code><\/pre>\n<p>3\u3001\u5bf9\u78c1\u76d8\u5206\u533a\u3002\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u67e5\u770b\u53ef\u7528\u7684\u5757\u8bbe\u5907\u60c5\u51b5\uff1a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># lsblk<\/code><\/pre>\n<p>\u8bc6\u522b\u78c1\u76d8\u540e\uff0c\u6211\u4eec\u4f7f\u7528fdisk\u6216parted\u547d\u4ee4\u5c06\u5176\u5206\u5272\u3002\u8fd9\u91cc\u5047\u8bbe\u90e8\u7f72\u7684Vultr VPS\u5b9e\u4f8b\u662f\u5e26\u6709\u5355\u4e2a\u786c\u76d8\u7684\u670d\u52a1\u5668\uff0c\u786c\u76d8\u540d\u79f0\u4e3avda\u3002<\/p>\n<p>\u2460\u521b\u5efa\u5206\u533a\u8868<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># parted \/dev\/vda &#8211; mklabel msdos<\/code><\/pre>\n<p>\u2461\u6dfb\u52a0\u6839\u5206\u533a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># parted \/dev\/vda &#8211;mkpart primary 1MiB -8GiB<\/code><\/pre>\n<p>\u2462\u6dfb\u52a0\u4ea4\u6362\u5206\u533a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># parted \/dev\/vda &#8211;mkpart primary linux-swap -8GiB 100%<\/code><\/pre>\n<p>4\u3001\u683c\u5f0f\u5316\u3002\u5728\u78c1\u76d8\u4e0a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u7cfb\u7edf-L\uff1a<\/p>\n<blockquote>\n<p># mkfs.ext4 -L arch \/dev\/vda1<\/p>\n<p># mkswap -L swap \/dev\/vda2<\/p>\n<\/blockquote>\n<p>\u6587\u4ef6\u7cfb\u7edf\u521b\u5efa\u5b8c\u6bd5\u540e\u8fdb\u884c\u6302\u8f7d\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># mount \/dev\/ disk\/by-label\/arch \/mnt<\/code><\/pre>\n<p>\u6253\u5f00\u4ea4\u6362\u8bbe\u5907\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># swapon \/dev\/vda2<\/code><\/pre>\n<p>5\u3001\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff08\u8fd9\u91cc\u5b89\u88c5\u4e86nano\u548cvim\u6587\u672c\u7f16\u8f91\u5668\uff09\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># pacstrap \/mnt base linux linux-firmware base-devel vi nano<\/code><\/pre>\n<p>\u751f\u6210\u4e00\u4e2afstab\u6587\u4ef6\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># genfstab -U \/mnt &gt;&gt; \/mnt\/etc\/fstab<\/code><\/pre>\n<p>\u7136\u540e\u5207\u6362\u5230\u65b0\u7cfb\u7edfArchLinux\u4e0a\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># arch-chroot \/mnt<\/code><\/pre>\n<p>6\u3001\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u767b\u5f55\u5230ArchLinux\u7cfb\u7edf\uff0c\u7136\u540e\u53ef\u4ee5\u8bbe\u7f6e\u65f6\u533a\u5e76\u540c\u6b65\u65f6\u95f4\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># ls\/usr\/share\/zoneinfo\/America\/<\/code><\/pre>\n<p>\u4ece\u5217\u8868\u4e2d\u9009\u62e9\u4e00\u4e2a\u57ce\u5e02\uff0c\u4f8b\u5982New York<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># ln-SF\/usr\/share\/zoneinfo\/America\/New _ York\/etc\/local time # hwclock\u2013systohc<\/code><\/pre>\n<p>\u7136\u540e\u5c06\u7cfb\u7edf\u533a\u57df\u8bbe\u7f6e\u4e3aUTF-8\u3002<\/p>\n<blockquote>\n<p># nano \/etc\/locale.gen<\/p>\n<p># echo &#8216;LANG=en_US.UTF-8&#8217; &gt; \/etc\/locale.conf<\/p>\n<\/blockquote>\n<p>7\u3001\u7cfb\u7edf\u57fa\u7840\u8bbe\u7f6e\u5b8c\u6210\u540e\uff0c\u5f00\u59cb\u8fdb\u884c\u7f51\u7edc\u914d\u7f6e\uff0c\u627e\u5230\u5f53\u524d\u6d3b\u52a8\u7684\u7f51\u7edc\u9002\u914d\u5668\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># ip addr<\/code><\/pre>\n<p>\u7f16\u5199\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># nano \/etc\/systemd\/network\/enp1s0.network<\/code><\/pre>\n<p>\u542f\u7528DHCP\u548cDNS\u89e3\u6790\u4ee5\u4fbf\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<blockquote>\n<p># systemctl enable systemd-networkd<\/p>\n<p># systemctl enable systemd-resolved<\/p>\n<\/blockquote>\n<p>\u8bbe\u7f6eArchLinux\u7cfb\u7edf\u4e3b\u673a\u540d\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># echo &#8216;&lt;YOUR_HOSTNAME&gt;&#8217; &gt; \/etc\/hostname<\/code><\/pre>\n<p>\u901a\u8fc7\u66ff\u6362\u4e3b\u673a\u540d\u548c\u9759\u6001IP\u5730\u5740\u6765\u8bbe\u7f6e\u76f8\u5173\u7684\u4e3b\u673a\u6587\u4ef6\uff1a<\/p>\n<blockquote>\n<p># cat &lt;&lt;EOF &gt; \/etc\/hosts<\/p>\n<p>&lt;YOUR_STATIC_IP&gt; localhost<\/p>\n<p>&gt; ::1 localhost<\/p>\n<p>&gt; &lt;YOUR_STATIC_IP&gt; &lt;YOUR_HOSTNAME&gt;.localdomain &lt;YOUR_HOSTNAME&gt;<\/p>\n<p>&gt; EOF<\/p>\n<\/blockquote>\n<p>\u8bbe\u7f6e\u5b8c\u6bd5\u540e\uff0c\u8fd0\u884c\u547d\u4ee4ip addr\u67e5\u770b\u9759\u6001IP\u5730\u5740\u3002<\/p>\n<p>8\u3001\u5b89\u88c5grub\u52a0\u8f7d\u7a0b\u5e8f\uff0c\u5e76\u7f16\u5199\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<blockquote>\n<p># pacman -S grub<\/p>\n<p># grub-install &#8211;target=i386-pc \/dev\/vda<\/p>\n<\/blockquote>\n<p>\u8fd9\u91cc\u7684\u53c2\u6570\u662f\u78c1\u76d8\u672c\u8eab\uff0c\u800c\u4e0d\u662f\u7cfb\u7edf\u5206\u533a\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># grub-mkconfig -o \/boot\/grub\/grub.cfg<\/code><\/pre>\n<p>9\u3001\u8bbe\u7f6e\u6839\u5bc6\u7801\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># passwd<\/code><\/pre>\n<p>10\u3001\u9000\u51fachroot\uff0c\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf\u3002<\/p>\n<blockquote>\n<p># exit<\/p>\n<p># systemctl poweroff<\/p>\n<\/blockquote>\n<p>11\u3001\u91cd\u65b0\u56de\u5230Vultr\u5ba2\u6237\u95e8\u6237\u9875\u9762\uff0c\u5220\u9664ISO\uff0c\u91cd\u65b0\u542f\u52a8VPS\u670d\u52a1\u5668\uff0c\u7136\u540e\u8fde\u63a5\u5230\u63a7\u5236\u53f0\u3002<\/p>\n<p>12\u3001\u73b0\u5728ArchLinux\u7cfb\u7edf\u5df2\u7ecf\u6210\u529f\u542f\u52a8\uff0c\u7136\u540e\u6211\u4eec\u53ef\u4ee5\u7528\u521a\u8bbe\u7f6e\u7684\u5bc6\u7801\u4ee5root\u7528\u6237\u8eab\u4efd\u767b\u5f55\uff0c\u5e76\u5b89\u88c5sudo\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># pacman -S sudo<\/code><\/pre>\n<p>\u7ed9\u6dfb\u52a0\u5230\u7ec4\u4e2d\u7684\u7528\u6237wheel\u5206\u914dsudo\u6743\u9650\u3002<\/p>\n<blockquote>\n<p># cp \/etc\/sudoers \/etc\/sudoers.new<\/p>\n<p># sed &#8216;s\/# %wheel ALL=(ALL) ALL\/%wheel ALL=(ALL) ALL\/&#8217; -i \/etc\/sudoers.new<\/p>\n<p># visudo -c -f \/etc\/sudoers.new &amp;&amp; mv \/etc\/sudoers.new \/etc\/sudoers<\/p>\n<\/blockquote>\n<p>\u7136\u540e\u8bbe\u7f6e\u4e00\u4e2a\u7528\u6237\u5bc6\u7801\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># passwd &lt;yourusername&gt;<\/code><\/pre>\n<p>\u9000\u51faroot\u8d26\u6237\uff0c\u7136\u540e\u7528\u521a\u521b\u5efa\u7684\u5177\u6709sudo\u6743\u9650\u7684\u65b0\u7528\u6237\u767b\u5f55\u5230\u670d\u52a1\u5668\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># exit<\/code><\/pre>\n<p>\u597d\u4e86\u5230\u8fd9\u91cc\u4e3a\u6b62\uff0c\u6211\u4eec\u4fbf\u6210\u529f\u5730\u5728Vultr VPS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86ArchLinux\u7cfb\u7edf\u5e76\u4e14\u521b\u5efa\u4e86\u65b0\u7528\u6237\uff0c\u540e\u7eed\u4fbf\u53ef\u4ee5\u4f7f\u7528\u8be5\u7528\u6237\u8fde\u63a5\u5e76\u7ba1\u7406\u670d\u52a1\u5668\u3002<\/p>\n\n<div>\n<div>\n\n\n\n<\/div>\n<div>\n\n\n\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>ArchLinux\u662f\u4e00\u6b3e\u4ee5\u8f7b\u91cf\u7b80\u6d01\u4e3a\u8bbe\u8ba1\u7406\u5ff5\u7684\u901a\u7528 x86-64 GNU\/Linux \u53d1\u884c\u7248\uff0c\u5b83\u91c7\u7528\u6eda\u52a8\u5347\u7ea7\u6a21&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,2],"tags":[],"class_list":["post-2296","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-zjjc","category-jc","entry"],"_links":{"self":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts\/2296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2296"}],"version-history":[{"count":0,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts\/2296\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}