VPS 上的 Arch Linux
外觀
摘自 Wikipedia:Virtual private server:
- Virtual private server (VPS) is a term used by Internet hosting services to refer to a virtual machine. The term is used for emphasizing that the virtual machine, although running in software on the same physical computer as other customers' virtual machines, is in many respects functionally equivalent to a separate physical computer, is dedicated to the individual customer's needs, has the privacy of a separate physical computer, and can be configured to run server software.
本文主要討論 Arch Linux 在 VPS 上的應用,並且包括了一些適用於 VPS 的安裝與維護指南.
Arch Linux 官方雲映像[編輯 | 編輯原始碼]
作為 arch-boxes 項目的一部分,Arch Linux 提供了官方雲映像。映像預裝了 Cloud-init,應可用於多數雲服務供應商。
可以從鏡像源的 images
目錄下找到該映像,具體使用步驟參考下方。
DigitalOcean[編輯 | 編輯原始碼]
位置:全球
創建 Arch Linux VM 的步驟:
- 在鏡像源上找到雲映像的位置,例如:https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2
- 將其導入為自定義映像
- 從自定義映像創建新 VM
- 通過 SSH 連接到 VM:
ssh root@ip
Hetzner Cloud[編輯 | 編輯原始碼]
位置:紐倫堡,法爾肯施泰因(德國),赫爾辛基(芬蘭)
創建 Arch Linux VM 的步驟:
- 使用該用户數據創建新 VM:
#cloud-config
vendor_data: {'enabled': false}Hetzner 的
vendor_data
會覆蓋掉發行版
中設定的值,並在將默認用户設定為root
的同時沒有設置disable_root: false
,使得你無法登陸到機子上。 - 以恢復模式啟動 VM
- 通過 SSH 連接到 VM,然後從鏡像源下載雲映像,例如:
curl -O https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2
- 將映像寫入到硬盤:
qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-cloudimg.qcow2 /dev/sda
- 重啟 VM
- 通過 SSH 連接到 VM:
ssh arch@ip
Linode[編輯 | 編輯原始碼]
網站:Linode
位置:全球多地
創建 Arch Linux VM 的步驟:
- 創建一台新 VM,並選擇 Arch 作為發行版(如果要使用 Linode 提供的映像,到這一步就行;如果要使用官方映像,繼續下列步驟)
- 以恢復模式啟動 VM
- 通過 Lish 控制台連接到 VM,然後從鏡像源下載基礎映像,例如:
curl -O https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-basic.qcow2
- 安裝 qemu-utils包:
apt update && apt install qemu-utils
- 將映像寫入到硬盤:
qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-basic.qcow2 /dev/sda
- 在 Linode 控制台上,進入到 VM 配置菜單,然後將內核選項修改為 」Direct Disk「
- 重啟 VM
- 通過 SSH 連接到 VM:
ssh arch@ip
OVH Eco[編輯 | 編輯原始碼]
位置:加拿大,法國
基於官方文檔的 Arch Linux VM 創建步驟如下:
- Navigate to the Dedicated Servers section in your OVH management panel, then select the server you want to deploy Arch Linux to.
- Click the ... button next to "Last operating system (OS) installed by OVHcloud" and choose "Install"
- Select "Install from custom image"
- For "Image URL" put
https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2
- For "Image type" select
qcow2
- For "Checksum type" select
sha256
- For "Image checksum" put the fingerprint value from https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2.SHA256
- Enable "ConfigDrive" to enter "Server host name" and your public "SSH key" (both are mandatory for Arch Cloud Init install)
- Click "Install the system"
- Wait (it takes a while) for an email from OVH titled "Installation of your image", it will say "Congratulations! Your dedicated server has just been installed! Connect to your server with ssh key provided during your installation."
- Use
ssh arch@ip
to log in.
Proxmox[編輯 | 編輯原始碼]
網站:Proxmox
位置:N/A
創建 Arch Linux VM 的步驟:
- 創建一台新 VM
- 在 OS 選擇步驟選中 「Do not use any media」
- 在 VM 創建完成後從 VM 移除剛創建的硬盤
- 使用
qm disk import
將剛下載好的映像連接到 VM,例如:
qm disk import 100 Arch-Linux-x86_64-cloudimg.qcow2 local
. - 在 Options 下,編輯啟動順序,添加剛創建的硬盤
- 添加 cloudinit 盤,在 Cloud-Init 一項中添加你的配置
- 啟動 VM!