diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 137 |
1 files changed, 96 insertions, 41 deletions
@@ -1,67 +1,122 @@ -## Arch Linux Image Builder for GCE +## Arch Linux Image Builder for Google Compute Engine -This project is a collection of scripts that create an Arch Linux OS image that -can run on [Google Compute Engine](https://cloud.google.com/compute/). +This project provides a script that creates an [Arch +Linux](https://www.archlinux.org/) image that can run on [Google Compute +Engine](https://cloud.google.com/compute/). -The image is configured close to the recommendations listed on -[Building an image from scratch](https://developers.google.com/compute/docs/images#buildingimage). +The image is configured to be as close as possible to a base Arch Linux +installation, while still allowing it to be fully functional and optimized for +Compute Engine. Notable choices made and differences compared to a standard +Arch Linux installation are the following: -These scripts are written in Python3. +- GRUB is used with BIOS-based boot and a GPT partition table. +- Serial console logging is enabled from kernel command line and journald is + configured to forward to it. +- Block multiqueue and elevator noop are configured from kernel command line to + optimize Compute Engine disk performance. +- A minimal initcpio is configured for booting on Compute Engine virtual + machines. +- Root filesystem is ext4. +- Locale is set to en_US.UTF-8 and timezone is set to UTC. +- Network is configured through dhclient. +- Systemd-timesyncd is enabled and configured to use the Compute Engine metadata + server. +- Rng-tools are installed and enabled to provide entropy. +- Pacman keyring is configured to be built and initialized on first boot. +- Pacman mirror list is taken fresh from Arch Linux servers at the time the + image is built. +- [Linux Guest Environment for Google Compute + Engine](https://github.com/GoogleCloudPlatform/compute-image-packages) is + installed and enabled. +- An OpenSSH server is installed and enabled, with root login and password + authentication forbidden. User SSH keys are deployed and managed + automatically by the Linux Guest Environment as described in the + [corresponding + documentation](https://cloud.google.com/compute/docs/instances/connecting-to-instance). +- Sudo is installed. Permission to use sudo is managed automatically by Linux + Guest Environment. +- Root partition and filesystem are automatically extended at boot using + [growpart](https://launchpad.net/cloud-utils), to support dynamic disk + resizing. +- An additional Pacman repository is used to install and keep the Linux Guest + Environment and growpart packages up to date. -## Prebuilt Images - * arch-v20160502 - [gs://gce-arch-images/arch-v20160502.tar.gz](https://storage.googleapis.com/gce-arch-images/arch-v20160502.tar.gz) - * arch-v20151203 - [gs://gce-arch-images/arch-v20151203.tar.gz](https://storage.googleapis.com/gce-arch-images/arch-v20151203.tar.gz) - * arch-v20151103 - [gs://gce-arch-images/arch-v20151103.tar.gz](https://storage.googleapis.com/gce-arch-images/arch-v20151103.tar.gz) - * arch-v20151023 - [gs://gce-arch-images/arch-v20151023.tar.gz](https://storage.googleapis.com/gce-arch-images/arch-v20151023.tar.gz) - * arch-v20150903 - [gs://gce-arch-images/arch-v20150903.tar.gz](https://storage.googleapis.com/gce-arch-images/arch-v20150903.tar.gz) -You can add these images using the -[Developers Console](https://console.developers.google.com/compute/imagesAdd). +## Prebuilt Images -You can use [Cloud SDK](https://cloud.google.com/sdk/) to add the prebuilt -images to your project. To do that run the following command. +You can use [Cloud SDK](https://cloud.google.com/sdk/docs/) to create instances +with the latest prebuilt Arch Linux image. To do that follow the SDK +installation procedure, and then run the [following +command](https://cloud.google.com/sdk/gcloud/reference/compute/instances/create): -``` -gcloud compute images create arch-v20160502 \ - --source-uri gs://gce-arch-images/arch-v20160502.tar.gz \ - --description "Arch Linux built on 2016-05-02" - --family "arch" +```console +$ gcloud compute instances create INSTANCE_NAME \ + --image-project=arch-linux-gce --image-family=arch ``` -## Usage -### Install and Configure Cloud SDK (one time setup) -``` -# Install Cloud SDK (https://developers.google.com/cloud/sdk/) -# For linux: -curl https://sdk.cloud.google.com | bash +## Build Your Own Image -gcloud auth login -gcloud config set project <project> -# Your project ID in Cloud Console, https://console.developers.google.com/ -``` +You can build the Arch Linux image yourself with the following procedure: -### On a Compute Engine VM (recommended) -``` -./build-arch-on-gce.sh --upload gs://${BUCKET}/archlinux.tar.gz +1. Make sure you have required dependencies installed: + + ```console + $ sudo pacman -S arch-install-scripts e2fsprogs + ``` + +2. Run the image building script: + + ```console + $ sudo ./build-arch-gce + ``` + + If the script is successful, this will create an image file named + arch-vDATE.tar.gz in the current directory, where DATE is the current date. + +3. Install and configure the [Cloud SDK](https://cloud.google.com/sdk/docs/). -# You will need a Cloud Storage bucket. -# List buckets owned by your project. -gsutil ls gs:// -# Create a new bucket -gsutil mb gs://${BUCKET} +4. Copy the image file to Google Cloud Storage: + + ```console + $ gsutil mb gs://BUCKET_NAME + $ gsutil cp arch-vDATE.tar.gz gs://BUCKET_NAME + ``` + +5. Import the image file to Google Cloud Engine as a new custom image: + + ```console + $ gcloud compute images create IMAGE_NAME \ + --source-uri=gs://BUCKET_NAME/arch-vDATE.tar.gz \ + --guest-os-features=VIRTIO_SCSI_MULTIQUEUE + ``` + +You can now create new instances with your custom image: + +```console +$ gcloud compute instances create INSTANCE_NAME --image=IMAGE_NAME ``` +The Google Cloud Storage file is no longer needed, so you can delete if you +want: + + ```console + $ gsutil rm gs://BUCKET_NAME/arch-vDATE.tar.gz + ``` + + ## Contributing Changes * See [CONTRIB.md](CONTRIB.md) ## Licensing -All files in this repository are under the -[Apache License, Version 2.0](LICENSE) unless noted otherwise. + +All files in this repository are under the [Apache License, Version +2.0](LICENSE) unless noted otherwise. ## Support + Google Inc. does not provide any support, guarantees, or warranty for this project or the images provided. |
