Arch Linux on a VPS

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

From 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.

This article discusses the use of Arch Linux on Virtual Private Servers, and includes some fixes and installation instructions specific to VPSes.

Warning:
  • Since many container-based virtualization environments rely on older kernels, it may be impossible to keep an Arch Linux install up-to-date in such an environment. Linux 2.6.32, used by OpenVZ 6, is not supported by systemd since version 205 (and will not work with systemd-212 or higher). OpenVZ does sometimes backport newer kernel features into its kernel, but as of 2018-06-27, a fresh installation of Arch does not work on OpenVZ 6 kernel version 2.6.32-042stab131.1 . Arch can be installed on OpenVZ 7, with a minor workaround, as of OpenVZ 7 kernel version 3.10.0-693-21.1.vz7.48.2 .

Official Arch Linux cloud image

Arch Linux provides an official cloud image as part of the arch-boxes project. The image comes with Cloud-init preinstalled and should work with most cloud providers.

The image can be downloaded from the mirrors under the images directory. Instructions for tested providers is listed below:

Provider Locations Note
Digital Ocean Global
  1. Find the cloud image on a mirror, ex: https://mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg-yyyymmdd.12345.qcow2 (check here for the latest link: https://mirror.pkgbuild.com/images/latest/)
  2. Add the image as a custom image by importing it
  3. Create a new VM from the custom image
  4. SSH to the VM: ssh root@<ip>
Hetzner Cloud Nuremberg, Falkenstein (Germany), Helsinki (Finland)
  1. Create a new VM with this user data:
    #cloud-config
    vendor_data: {'enabled': false}
    The vendor_data from Hetzner overrides the distro and sets the default user to root without setting disable_root: false, meaning you can not login
  2. Boot the VM in rescue mode
  3. SSH to the VM and download the cloud image from a mirror, ex: curl -O https://mirror.pkgbuild.com/images/vyyyymmdd.12345/Arch-Linux-x86_64-cloudimg-yyyymmdd.12345.qcow2
  4. Write the image to the disk: qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-cloudimg-yyymmdd.12345.qcow2 /dev/sda
  5. Reboot the VM
  6. SSH to the VM: ssh arch@<ip>
Linode Multiple international locations
  1. Create a new VM and select Arch as the distro (to use the Linode-provided image, stop here; otherwise proceed with the rest of the steps)
  2. Boot the VM in rescue mode
  3. Connect to the VM via the Lish console and download the basic image from a mirror, ex: curl -O https://mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-basic-yyyymmdd.0.qcow2
  4. Install the qemu-utils package: apt update && apt install qemu-utils
  5. Write the image to the disk: qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-basic-yyyymmdd.0.qcow2 /dev/sda
  6. In the Linode manager, go to the VM's configurations menu and edit the config to change the kernel option to "Direct Disk"
  7. Reboot the VM
  8. SSH to the VM: ssh arch@<ip>
Proxmox N/A
  1. Create a new VM
  2. Select "Do not use any media" in OS section.
  3. Remove created hard disk from your VM after VM creation completes.
  4. Add the downloaded image to your VM using qm importdisk, ex:
    qm importdisk 100 Arch-Linux-x86_64-cloudimg-20210315.17387.qcow2 local
  5. Add a cloudinit drive and make your configurations in Cloud-Init section.
  6. Start the VM!

Providers that offer Arch Linux

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Inconsistency, some language issues (Discuss in Talk:Arch Linux on a VPS)
Warning: We cannot vouch for the honesty or quality of any provider. Please conduct due diligence before ordering.
Note: This list is for providers with a convenient Arch Linux template. Using Arch on other providers is possible but requires more work. Example methods include:
Provider Archiso release Virtualization Locations Notes
1984hosting.com 2016.x Xen Iceland (IS) Hardware will provide any image you request, has Arch in default image list.
4smart.cz 2013.08 OpenVZ Prague, CZ (Czech language site only) when updating system make sure you use [tredaelli-systemd] in pacman.conf (see Unofficial user repositories
affinity.net.nz 2013.08.01 KVM Auckland, New Zealand (NZ) IRC channel is #affinity on ircs.kiwicon.org
Atlantic.Net 2016.03.01 KVM NYC/SF/Toronto/Dallas/Orlando, US & Canada 100% SSD 1-click Arch Linux, ready in 30 seconds. It is also easy to update Arch to the current version because the pre-provisioned Arch image is relatively current.
BuyVM 2017.08.01 KVM Buffalo, (US-NY); Las Vegas, (US-NV); Luxembourg, Germany (DE) Cannot select Arch at purchase. Once purchased, use Stallion control panel to install Arch manually from ISO.
CloudVIP Latest KVM Brussels, Belgium French site and support.
Coinshost 2015.04 Xen Zurich, Switzerland Bitcoin and other cryptocurrencies accepted.
Cherry Host[dead link 2021-11-07 ⓘ] Latest KVM Santee, US-CA Must submit a support ticket to get Arch installed.
Contabo Latest KVM Germany Only place to get 500 GB for 7€ - Decent speed. Other cheaps plans add snapshots, which is useful if you VPS runs a rolling release distro.
DirectVPS 2014.01.xx OpenVZ Amsterdam, NL; Rotterdam, NL (Dutch language site only)
Edis 2019.02.01 vServer, KVM, OpenVZ Multiple international locations. Also offer dedicated server options as well as an "off-shore" location at the Isle of Man (IM). Requires mounting an Arch ISO for a full manual install.
Hetzner 2020.06.01 KVM Nuremberg, DE; Falkenstein, DE; Helsinki, FI You cannot choose Arch Linux directly on the order form. Order Ubuntu or something first, then go to ISO Images, mount Arch Linux, reboot server, and log in to web console to complete installation.
GigaTux 2013.06.01 Xen Chicago, US-IL; Frankfurt, DE; London, GB; San Jose, US-CA Currently, when changing to the US$ currency, the page breaks and it is not possible to provision a server.
Leapswitch Networks 2013.10.xx OpenVZ/KVM USA, India, Portugal, Spain, Ukraine, Germany Arch Linux currently available in Control Panel for reinstall, not on order form.
Linevast.de Latest OpenVZ, KVM Germany Arch Linux is possible on openvz and on KVM with the one click os installer.
Linode Latest KVM Multiple international locations Linode instances are configured to run Arch's kernel by default. Linode provides custom kernels which can be selected in the manager settings. There are also community-supported kernels in the AUR, such as linux-linodeAUR.
LYLIX 2014.01.xx[dead link 2021-05-09 ⓘ] OpenVZ Multiple US; Europe 32-bit and 64-bit available
Netcup 2020.09.01 KVM Germany (DE) German language: Netcup
MedHaHosting Latest KVM Buffalo, NY, USA; Atlanta, GA, USA; Chicago, IL, USA; Los Angeles, CA, USA Arch Linux available on request. Many Linux and Windows hosting options.
MonoVM Latest VMware USA - Canada - Netherlands - Germany - UK - France - Denmark VMware Based VPS Server Provider.
OnePoundWebHosting 2014.01 Xen PV, Xen HVM United Kingdom (UK) They are a registrar too. Unable to verify server locations.
PacmanVPS 2014.01 KVM Canada (CA), Poland (PL) Arch image is very old and PacmanVPS repos are broken. Not possible to update Arch. Site appears unmaintained.
Proplay Latest OpenVZ, KVM Germany (DE) (German language site only)
Rackspace Cloud 2013.6 Xen Multiple international locations[dead link 2020-12-19 ⓘ] Billed per hour. Use their "next gen" VPSes (using the mycloud.rackspace.com panel); the Arch image on the first gen Rackspace VPSes is out of date.
RamHost.us 2013.05.01 OpenVZ, KVM Los Angeles, US-CA; Great Britain (GB); Atlanta, US-GA; Germany (DE) You can request a newer ISO on RamHost's IRC network.
RamNode 2016.01.01 SSD and SSD Cached: KVM Alblasserdam, NL; Atlanta, GA-US; Los Angeles, CA-US; New York, NY-US; Seattle, WA-US You can request Host/CPU passthrough with KVM service.[1] Frequent use of discount promotions.[2], Must install Arch manually from an ISO using VNC viewer.
RoseHosting Latest OpenVZ, KVM St. Louis, Missouri, USA SSD powered hosting plans with free fully-managed 24/7 support. No unmanaged VPS offerings.
SeedVPS Latest OpenVZ, KVM Amsterdam, Netherlands Linux VPS and Windows VPS Hosting in The Netherlands (NL). Newer ISO can be requested by opening a support ticket.
Server Cheap Latest OpenVZ, KVM Chicago, Illinois, USA Arch Linux available on request. Windows, BSD, and many Linux distribution hosting options.
SkyHost Latest LXC Moscow, Yaroslavl, Russia
Tilaa 2016.03.01 KVM[dead link 2020-03-28 ⓘ] Amsterdam, NL
TransIP latest KVM Amsterdam, NL For latest image, submit ticket. Also registrar.
upCUBE[dead link 2021-05-09 ⓘ] Latest Docker Germany Different prepared arch linux templates available
Virpus 2014.11.07 Xen Kansas City, US-KS; Los Angeles, US-CA Arch is not offered as a choice when creating a server (even though the Arch logo is prominently featured on the site). As of 2018, the most recent version of Ubuntu offered is 14.04, and the limited-time promo code for new sign ups is over two years old. None of this generates much trust.
Virtual Master 2012-08 ?? Prague, CZ
VPS6.NET 2013.01.xx OpenVZ, Xen, HVM-ISO Multiple US; Frankfurt, DE; Bucharest, RO; Istanbul, TR Registrar.
VPSBG.eu 2013.10 OpenVZ Sofia, Bulgaria Offshore VPS in Bulgaria - anonymous registrations and Bitcoin are accepted.
VPSCHEAP 2016.10 NVM KVM Dallas, TX, USA Has one plan that allows you to select Arch Linux, but does not appear in any other plan, but available on request. The system is severely outdated. To fix it install archlinux-keyring, then run pacman -Syu.
VPSSERVER 2015.07 KVM Chicago, US-IL; Dallas, US-TX; Miami, US-FL; New York, US-NY; Silicon Valley, US-CA; Amsterdam, NL; Frankfurt, DE; London, UK Currently the latest Arch Linux OS version we are providing is 2015.07 x64 and you cannot update the OS version to the new version.
Vultr Latest KVM Multiple International locations When deploying a new server just select the Arch install ISO from Vultr ISO Library. Then just manually run through the standard Arch installation guide.
World4You 2015.10.28 OpenVZ Austria (AT) Internet hosting provider; quick setup; 24/7 support; shared web hosting; also CentOS, Debian, Ubuntu, Fedora and Arch OpenVZ servers; supports newest systemd (227 atm)
XenVZ 2009.12.07 OpenVZ, Xen United Kingdom (UK), United States (US) Hardware
ZappieHost Latest LXC Auckland, New Zealand (NZ) Hosted on redundant SSDs. Kernel 4.X using LXC
Misaka.io / zeptoVM Latest KVM Multiple International locations Images are built every 24 hrs
VPSDime Latest KVM Dallas, Seattle, Los Angeles, New Jersey, London, Amsterdam Premium VPS line supports manual install. Just Choose ArchLinux in the order or reinstall form. If you want ArchLinux on Linux VPS line, then simply submit a ticket.

Providers with Community provided Arch Linux support

Warning: We cannot vouch for the honesty or quality of any provider. Please conduct due diligence before ordering.
Note: Arch Linux is not officially supported by these providers. The images and scripts listed here are created by the community.
Provider Installation Type Locations Notes
Amazon Web Services Custom Images Global
Digital Ocean Official Arch cloud image, Conversion Script or Custom Image Global IPv6 does not work with custom images, but works with conversion script
Google Cloud Platform Custom Image Global

Installation

KVM

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Are there instructions specific to VPSes? (Discuss in Talk:Arch Linux on a VPS)

See QEMU#Preparing an Arch Linux guest.

OpenVZ

Installing the latest Arch Linux on any OpenVZ container provider

Warning: Please refer to the warning about the older kernel version and systemd at the top of the page, and note the workaround for OpenVZ 7 below.

It is possible to directly copy an installation of Arch Linux over the top of a working OpenVZ VPS. This tutorial explains how to create a basic installation of Arch Linux with pacstrap (as used in a standard install) and then replace the contents of a target VPS with it using rsync.

This process (with minor modification) also works to migrate existing Arch installations between various environments and has been confirmed to work in migrating from OpenVZ to Xen and from Xen to OpenVZ. For an install to Xen, other hardware-virtualized platforms, or even to physical hardware, extra steps (basically running mkinitcpio and installing a boot loader) are needed.

Prerequisites
  • A working Arch Linux installation
    • To keep things simple, it should match the architecture you want to install on your VPS (x86_64 or i686).
    • To build from other distributions, arch-bootstrap.sh can be used in place of pacstrap.
  • The arch-install-scripts, rsync, and openssh packages from the official repositories
    • SSH is not strictly required, but rsync over SSH is the method used here.
  • A VPS running any distribution, with rsync and a working SSH server
    • Its architecture (x86_64 or i686) does not matter as long as the OpenVZ installation can support your target architecture.
  • OpenVZ's serial console feature (usually accessible via your provider's control panel)
    • Without this, any network configuration for the target VPS will have to be done immediately after the "Build" step below.
Building a clean Arch Linux installation

As root, build the installation (optionally replacing build with your preferred target directory):

# mkdir build
# pacstrap -cd build

Other tweaks for the pacstrap command:

  • -C custom-pacman-config.conf - Use a custom pacman configuration file. By default, pacstrap builds according to your local pacman.conf. This determines the architecture (i686 or x86_64) of the build, the mirror list, etc.
  • -G - Prevent pacstrap from copying your system's pacman keyring to the new build. If you use this option, you will need to run pacman-key --init and pacman-key --populate archlinux in the Configuration step to set up the keyring.
  • -M - Prevent pacstrap from copying your system's pacman mirror list to the new build.
  • You can pass a list of packages to pacstrap to add them to your install, instead of the default base group. For example: pacstrap -cd build base openssh dnsutils gnu-netcat traceroute vim
Preparing the Arch build for use on an OpenVZ 7 container

OpenVZ 7 will fail to start a container if some expected network configuration files do not exist. The easiest way to get around this is as follows:

  1. Create the OpenVZ 7 container as Debian 8 (Debian 9 would probably work as well).
  2. Create the required blank network configuration files inside the Arch build, as follows:
# mkdir build/etc/network
# touch build/etc/network/interfaces
# mkdir -p build/etc/resolvconf/resolv.conf.d
# touch build/etc/resolvconf/resolv.conf.d/base
Replacing everything on the VPS with the Arch build

Replace all files, directories, etc. on your target VPS with the contents of your build directory (replacing "YOUR.VPS.IP.ADDRESS" below):

Warning: Be careful with the following command. By design, rsync is very destructive, especially with any of the --delete options.
# rsync -axH --numeric-ids --delete-delay -e ssh --stats -P build/ YOUR.VPS.IP.ADDRESS:/

Explanation of options:

  • -a - Required. Preserves timestamps, permissions, etc.
  • --delete - Required. Deletes anything in the target that does not exist in the source
  • -x - Important. Prevents the crossing of filesystem boundaries (other partitions, /dev, etc.) during the copy
  • -H - Important. Preserves hardlinks
  • --numeric-ids - Important. Does not assign user/group ownership of files based on matching user and group names and instead uses the numeric IDs directly, ensuring proper file ownership on the target system
  • --delete-delay - Recommended. Enables alternate deletion mode which waits to delete anything until the synchronization is otherwise complete, which may reduce the risk of a slow transfer causing the target VPS to lock-up
  • -e ssh - Recommended. Uses rsync over SSH (recommended for simplicity compared to setting up an rsync server)
  • -P - Recommended. Shows partial progress information during transfer
  • --stats - Recommended. Shows transfer statistics at the end
Configuration
  1. Reboot the VPS externally (using your provider's control panel, for example).
  2. Using OpenVZ's serial console feature, configure the network and basic system settings (ignoring fstab generation and arch-chroot steps).
    • If you do not have access to the serial console feature, you will need to preconfigure your network settings before synchronizing Arch to the VPS.
    • On some VPS configuration you will not have a gateway to connect to, here is an example netctl configuration for this setup. It configures static IP addresses and default routes on venet0 and uses Google Public DNS.
/etc/netctl/venet
Description='VPS venet connection'
Interface=venet0
Connection=ethernet

IP=static
Address=('192.0.2.42/32')
Routes=('default')

IP6=static
Address6=('2001:db8::1234:5678/128')
Routes6=('default')

DNS=('2001:4860:4860::8888' '2001:4860:4860::8844' '8.8.8.8' '8.8.4.4')

Xen

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Are there instructions specific to VPSes? (Discuss in Talk:Arch Linux on a VPS)

See Xen.