Installation: Difference between revisions

From Alpine Linux
(cited two times the more complete reference for install manual)
(Reverting as of https://lists.alpinelinux.org/~alpine/devel/<20201002143513.yco7vwx2ci3lqezm@wolfsden.cz> Second time user Mckaygerhard pulled stunt on this page. (Aug.13/19 & Jul.12/20))
Line 1: Line 1:
While Alpine Linux is often used as base image for linux containers, it can of course be also installed on bare metal machine as well. That is the focus of this document.


So remenber, this first document is a general use case, '''[[Alpine newbie install manual]]''' is the main reference to more ways to perform installation or permanent data saving on a device, for others hardware and use case
[[Image:hdd_mount.png|left|link=]]
<br />


__TOC__
__FORCETOC__


= Quick Requirements =


Nearly any hardware should run Alpine Linux but the following basic requirements are recommended:


* At least 128MB of RAM for server without GUI, or at least 1.6GB for graphical desktop
This page will get you started, but it can also help to skim through the [[Alpine_Linux:FAQ| Frequenty Asked Questions (FAQ)]] (also part of the left sidebar).
* At least 1GB storage device for server without GUI, or at least 10GB for graphical desktop with web browsing
== Typical Hardware Requirements ==


For more information, see [[Requirements]].
* At least 100 MB of RAM (A graphical desktop system may require up to 1 GB minimum.)
* A writable storage device. Optional for saving data and configuration of systems running in "diskless" mode. Required for running in "sys" or "data" mode (explained below).


[[File:Installation-alpine-alpine-setup-2-boot.png|350px|thumb|right|Installation : setup-alpine : booting process until login prompt]]
== Installation Overview ==
(To install on ARM systems that do not support .iso images refer to [[Alpine_on_ARM|Alpine on ARM]] instead.)


= Installation Overview =
As with most linux distributions, the first installation steps usually consist of:<br>
([[Installation#additional details|additional details]] below)


The following steps are brief and intended for the common case; for complete info and other architectures, '''[[Alpine newbie install manual]]''' is the main reference to more ways to perform installation or permanent data saving on a device, for others hardware and use cases.


== 1. Download the installation image ==
'''1.)''' Downloading and verifying the proper [http://alpinelinux.org/downloads stable-release ISO image] for your computer's architecture, and the corresponding <code>sha256</code> (checksum) and <code>GPG</code> (signature) files.


You need to acquire installation image, usually from [http://alpinelinux.org/downloads]. Most likely you will want the standard edition. Make sure you download the image for correct architecture.
'''2.)''' Either burning the ISO image onto a blank CD/DVD/Blue-ray disk with your favorite disk burning software, or flashing the image onto a bootable storage device (USB-device, CF-/MMC-/SD-card, floppy, ...).


== 2. Create the installation medium ==
'''3.)''' Booting the computer from the prepared disk or storage device.


Either you can burn the image onto CD/DVD, you use usb stick for the installation.


Under linux, you can use the dd for that:
The boot process first copies the entire system into the RAM memory, and then runs it completely from RAM, so that the started command line environment does not depend on reading from the (slow) initial boot media anymore.


<code><nowiki>dd if=<source iso> of=<target device> bs=4M; sync</nowiki></code>
Log-in as the user <code>root</code> with its initially empty password.


Make sure that the device '''does not''' include partition number, so example from my machine:
Now an interactive script called <code>[[Alpine_setup_scripts#setup-alpine|setup-alpine]]</code>, as well as more specific [[Alpine_setup_scripts|setup-scripts]], the [[Alpine_Linux_package_management|apk package manager]], and all the general command line tools of course, can be used to configure the initial Alpine Linux system, to install further packages, and to prepare the system for the next boot.


<code><nowiki>dd if=~/Downloads/alpine-standard-3.10.2-x86_64.iso of=/dev/sdb bs=4M</nowiki></code>
Note that <code>[[Alpine_setup_scripts#setup-alpine|setup-alpine]]</code> supports to configure the system to boot into one of three general '''Alpinelinux runtime modes''':


The target device '''will be erased''', so make sure you use something without any data you do not
'''diskless mode''' This is the default boot mode of the .iso images. <code>[[Alpine_setup_scripts#setup-alpine|setup-alpine]]</code> configures this if selecting to install to "disk=none", and it means that the whole  operating system and the applications run extremely fast from within RAM (saving unnecessary disk spin-ups, power and wear). A customized configuration and package selection may still be completely preserved on permanent storage media by using the "local backup utility" <code>[[Alpine_local_backup|lbu]]</code> and a [[Alpine_Linux_package_management#Local_Cache|local package cache]]. [Fixme: <code>setup-alpine</code> still needs [[Alpine_local_backup#Saving_and_loading_ISO_image_customizations| this detour]] to prepare a partition for this:] In setup-alpine, select to store configs and the package cache on a partition. (That mounted partition may later also be used by configuring some important applications to keep their data on it.)
want to lose.


== 3. Boot and install process ==
'''data mode''' This mode is still accelerated by running the system from RAM, however swap storage and the whole {{Path|/var}} directory tree gets mounted from a persistent storage device (two newly created partitions). This location holds e.g. all log files, mailspools, databases, etc., as well as <code>[[Alpine_local_backup|lbu]]</code> backup commits and the package cache. The mode is useful for having RAM accelerated servers with amounts of variable user-data that exceed the available RAM size, and to let the entire current system state (not just the boot state) survive a system crash according to the particular filesystem's guarantees. [Fixme: Storing lbu configs to disk is not auto-configured after configuring the data partition, one still has to select saving configs to "none" first (the new data partition is not listed), and to manually set e.g. LBU_MEDIA=sda2 in /etc/lbu/lbu.conf and <code>echo "/dev/sda2 /media/sda2 vfat rw 0 0" >> /etc/fstab</code> afterwards.] The boot device may remain to be the one initially used, and can even be immutable (read-only).


Log in as the user <code>root</code> and execute [[Alpine_setup_scripts#setup-alpine|setup-alpine]] and answer all the questions asked. Quick step-by-step walkthrough (go read [[Alpine_setup_scripts#setup-alpine|setup-alpine]] for more in-depth explanation):
'''sys mode''' This is a traditional hard-disk install. If this mode is selected, the <code>[[setup-alpine]]</code> script defaults to create three partitions on the selected storage device, {{Path|/boot}}, {{Path|swap}} and {{Path|/}} (the filesystem root). This mode may be used for generic [[Desktops|desktop]] and development machines, for example.


[[File:Installation-alpine-alpine-setup-3-setup-scripts.png|350px|thumb|right|Installation : setup-alpine : complete process single install]]
== Questions asked by <code>setup-alpine</code> ==


===== Keyboard layout and variant =====
The <code>[[setup-alpine]]</code> script offers to configure:


As you would expect, this is keyboard layout you want. If you are not sure, answering <code>us</code> to both layout and variant will get you started and you can change it later.
* Keyboard map (e.g. ''us'' and variant of ''us-nodeadkeys'')
* Hostname (The name for the computer.)
* Network (e.g. automatic DHCP IP address discovery)
* DNS Servers (For privacy reasons, it is NOT recommended to use servers like google's 8.8.8.8 etc.)
* Timezone
* Proxy ("None" for direct connections to the internet.)
* SSH (Openssh is part of the default images.)
* NTP (Chrony is part of the default images.)
* Runtime Mode (Select between "diskless" (disk=none), "data" or "sys", all described above.)


===== System hostname =====
== Additional Details ==


Pick the name of your computer, while not mandatory, something unique if prefered. Or you can just use <code>localhost</code> if you do not care.
{{Expand|  }}


===== Network configuratinon =====
This "Additional Details" section needs to be consolidated with the work at '''[https://docs.alpinelinux.org https://docs.alpinelinux.org] (not finished)'''
(Restructuring things there, moving and linking from here or there?).


You will be asked ''which'' network interface you want to configure, if you are not sure, picking the offered default would likely work. Once selected, you will be asked <code>Ip address for XXX?</code>, you can either assign an IP address or write <code>dhcp</code>, which will mean take configuration from the network (the <code>dhcp</code> works great for home networks where you do not care about IP of your machine).
=== Verifying the downloaded image file ===


Assuming you decided to configure network yourself with IP address, you will also be asked for netmask, gateway, dns domain name and dns server IP. Correct values for there are beyond the scope of this document, please refer to your network administrator for guidance instead.
{|  class="wikitable" style="width:95%; align=center"
|+ Commands to verify the checksum and GPG signature of a downloaded image file on different systems.
|-
! width=100px |  OS type
!  <code>sha265</code> check !! <code>sha265</code> calculation (to be compared manually) !! <code>GPG</code> signature verification
|-
! Linux
| <code>sha256sum -c alpine-*.iso.sha256</code> ||        || <code>curl https://alpinelinux.org/keys/ncopa.asc &#124; gpg --import ;</code>
<code> gpg --verify alpine-<version>.iso.asc alpine-<version>.iso</code>
|-
! Windows (PowerShell installed)
|                - ? -            || <code>Get-FileHash .\alpine-<image-version>.iso -Algorithm SHA256</code> || - ? -
|}


===== Password for root =====
=== Booting from external devices ===


Well this one is obvious.
Insert the boot media to a proper drive or port of the computer and turn the machine on, or restart it, if already running.


===== Timezone =====
If the computer does not automatically boot from the desired device, one needs to bring up the boot menu selection for choosing the media to boot from. Depending on the computer the menu may be accessed by quickly (repeatedly) pressing a key when booting starts, or sometimes it is needed to press the button before starting the computer and keep holding it when it boots. Typical keys are:  `F9`-`F12`, sometimes `F7` or `F8`. If these don't bring up the boot menu, it may be necessary to enter the BIOS configuration and adjust the boot settings, for which typical keys are: `Del.` `F1` `F2` `F6` or `Esc.`


For servers, it is common to use UTC, for non-server machines, your local timezone should be likely used. Notice that you can use <code>?</code> to list the timezone.
=== Rebooting and testing the new system ===


===== HTTP/FTP Proxy =====
After the installation is completed, the system may be power-cycled or rebooted to confirm that everything is working.
If the configured runtime mode was "sys", then remove the initial installation media to boot the newly installed system.


Most likely default (<code>none</code>) is the correct choice.
The relevant commands for this are <code>reboot</code> or  <code>poweroff</code>.


===== NTP client =====
= Further Documentation =
 
Which client to use for keeping the system clock in sync, default works for most people.


===== Mirror =====
=== Installing ===


Pick mirror from which to download updates, <code>1</code> is CDN backed by Fastly, so reasonable choice for most people.
* [[Directly booting an ISO file]] ''(without flashing it to a disk or device)''
* [[Tutorials_and_Howtos#Networking|Setting up Networking]] ''(incl. non-standard configurations)''


===== SSH server =====


Which SSH server do you want to configure on your machine. If you know that you will '''not''' connect to your machine remotely (most laptops for example), <code>none</code> should be used. Otherwise, the default (<code>openssh</code>) is a good pick.
=== Post-Install ===


===== Disk setup =====
<!-- If you edit post-install, also consider [[Tutorials_and_Howtos#Post-Install]], [[Developer_Documentation#Package_management]] and the Handbook. These are not exact duplicates. -->


Here your can pick the device to install the system on and also the mode in which it should be installed. For overview of the modes, see [[Alpine_setup_scripts#setup-modes|this]]. If you are not sure or just starting up, <code>sys</code> is likely what you want, it is the same mode that other distributions use for installation.


'''All data on the chosen device will be erased!'''
* [[Setting up a new user]]


===== Reboot =====
* [[Enable Community Repository]] ''(Providing additional packages)''
* [[Alpine Linux package management|Package Management (apk)]] ''(general search/add/del packages etc.)''
* [[Alpine setup scripts#setup-xorg-base|<code>setup-xorg-base</code>]] ''(display graphics, if required)''
** [[Xfce_Setup]] / [[Desktop-notes]] / [[Xfce_Desktop]]


After the script finishes installing the system, it will tell you to reboot. Note that:
* [[Alpine_local_backup|Local backup utility <code>lbu</code>]] ''(persisting RAM system configurations)''
** [[Back Up a Flash Memory Installation]] ''("diskless mode" systems)''
** [[Manually_editing_a_existing_apkovl]] ''(the stored custom configs)''
* [[Alpine Linux Init System|Init System (OpenRC)]] ''(Configure a service to automatically boot at next reboot)''
** [[Multiple Instances of Services]]
** [[Writing Init Scripts]]


* If the configured [[Alpine_setup_scripts#sys_mode|runtime mode was "sys"]], then remove the initial installation media to boot the newly installed system.
* [[Hosting services on Alpine]] ''(Links to several mail/web/ssh server setup pages)''
* If the configured [[Alpine_setup_scripts#diskless_mode|runtime mode was "data"]], then keep the installation media inserted to boot the newly installed system.
* Runnig programs and services in their own [[Firejail Security Sandbox]]


Then execute <code>reboot</code> and once the machine restarts and finishes booting up, you should see login prompt of your new Alpine Linux installation.
* [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading Alpine]] ''(checking for and installing updates)''
* [[How_to_make_a_custom_ISO_image_with_mkimage]]


The installation script only installs the base operating system. Applications such as a web server, mail server, desktop environment, or web browser are not installed and <code>root</code> is the only normal user. For instructions on proceeding after installation, please see [[Tutorials_and_Howtos#Post-Install|Tutorials_and_Howtos Post-Install section]].
=== Further Help and Information ===


= Further Documentation =
* [[Running glibc programs]] ''(Installation and development)''


More specific instructions and instructions for other architectures or machines (e.g. ARM, RPi, etc) are defined in [[Tutorials_and_Howtos#Installation:_Use_cases|Installation:_Use_cases]]. Also see the following wiki pages for more information:
<!-- * [[setup-acf]] ''(Configures ACF (webconfiguration) so you can manage your box through https)''
* [[Changing passwords for ACF|Changing passwords]]
-->


* [[FAQ|FAQs]]
* [[FAQ|FAQs]]
* [[Tutorials and Howtos]]
* [[Tutorials and Howtos]]
* [[Contribute|How to Contribute]]
* [[Contribute|How to Contribute]]
* [[Developer Documentation]]
* [[Developer Documentation]]
* [[Newbie Alpine Ecosystem]]
* [[Alpine_Linux:Wiki_etiquette|Wiki etiquette]] ''to collaborate on this documentation''
 
 
 
{{Tip| Alpine linux packages stay close to the upstream design. Therefore, all upstream documentation about configuring a software package, as well as good configuration guides from other distributions that stay close to upstream, like e.g. in the [https://wiki.archlinux.org/ Arch Wiki], are to a large degree also well applicable to configure the software on alpine linux, thus can be very useful.}}
 
= See Also =


== External links ==
There may still be something useful to find and sort out of the newbie's install notes in this wiki, moving godd things into the structured handbook style documentation.


* [https://mckayemu.github.io/alpineinstalls/ More information, in Spanish]
# [[Newbie_Alpine_Ecosystem]]
# [[Alpine newbie install manual]]
# [[Alpine_newbie#Install|Alpine_newbie Install section]]
# [https://mckayemu.github.io/alpineinstalls/ https://mckayemu.github.io/alpineinstalls/ All informatin for Spanish users]


[[Category:Installation]]
[[Category:Installation]]

Revision as of 12:40, 12 December 2020




This page will get you started, but it can also help to skim through the Frequenty Asked Questions (FAQ) (also part of the left sidebar).

Typical Hardware Requirements

  • At least 100 MB of RAM (A graphical desktop system may require up to 1 GB minimum.)
  • A writable storage device. Optional for saving data and configuration of systems running in "diskless" mode. Required for running in "sys" or "data" mode (explained below).

Installation Overview

(To install on ARM systems that do not support .iso images refer to Alpine on ARM instead.)

As with most linux distributions, the first installation steps usually consist of:
(additional details below)


1.) Downloading and verifying the proper stable-release ISO image for your computer's architecture, and the corresponding sha256 (checksum) and GPG (signature) files.

2.) Either burning the ISO image onto a blank CD/DVD/Blue-ray disk with your favorite disk burning software, or flashing the image onto a bootable storage device (USB-device, CF-/MMC-/SD-card, floppy, ...).

3.) Booting the computer from the prepared disk or storage device.


The boot process first copies the entire system into the RAM memory, and then runs it completely from RAM, so that the started command line environment does not depend on reading from the (slow) initial boot media anymore.

Log-in as the user root with its initially empty password.

Now an interactive script called setup-alpine, as well as more specific setup-scripts, the apk package manager, and all the general command line tools of course, can be used to configure the initial Alpine Linux system, to install further packages, and to prepare the system for the next boot.

Note that setup-alpine supports to configure the system to boot into one of three general Alpinelinux runtime modes:

diskless mode This is the default boot mode of the .iso images. setup-alpine configures this if selecting to install to "disk=none", and it means that the whole operating system and the applications run extremely fast from within RAM (saving unnecessary disk spin-ups, power and wear). A customized configuration and package selection may still be completely preserved on permanent storage media by using the "local backup utility" lbu and a local package cache. [Fixme: setup-alpine still needs this detour to prepare a partition for this:] In setup-alpine, select to store configs and the package cache on a partition. (That mounted partition may later also be used by configuring some important applications to keep their data on it.)

data mode This mode is still accelerated by running the system from RAM, however swap storage and the whole /var directory tree gets mounted from a persistent storage device (two newly created partitions). This location holds e.g. all log files, mailspools, databases, etc., as well as lbu backup commits and the package cache. The mode is useful for having RAM accelerated servers with amounts of variable user-data that exceed the available RAM size, and to let the entire current system state (not just the boot state) survive a system crash according to the particular filesystem's guarantees. [Fixme: Storing lbu configs to disk is not auto-configured after configuring the data partition, one still has to select saving configs to "none" first (the new data partition is not listed), and to manually set e.g. LBU_MEDIA=sda2 in /etc/lbu/lbu.conf and echo "/dev/sda2 /media/sda2 vfat rw 0 0" >> /etc/fstab afterwards.] The boot device may remain to be the one initially used, and can even be immutable (read-only).

sys mode This is a traditional hard-disk install. If this mode is selected, the setup-alpine script defaults to create three partitions on the selected storage device, /boot, swap and / (the filesystem root). This mode may be used for generic desktop and development machines, for example.

Questions asked by setup-alpine

The setup-alpine script offers to configure:

  • Keyboard map (e.g. us and variant of us-nodeadkeys)
  • Hostname (The name for the computer.)
  • Network (e.g. automatic DHCP IP address discovery)
  • DNS Servers (For privacy reasons, it is NOT recommended to use servers like google's 8.8.8.8 etc.)
  • Timezone
  • Proxy ("None" for direct connections to the internet.)
  • SSH (Openssh is part of the default images.)
  • NTP (Chrony is part of the default images.)
  • Runtime Mode (Select between "diskless" (disk=none), "data" or "sys", all described above.)

Additional Details

This material needs expanding ...

This "Additional Details" section needs to be consolidated with the work at https://docs.alpinelinux.org (not finished) (Restructuring things there, moving and linking from here or there?).

Verifying the downloaded image file

Commands to verify the checksum and GPG signature of a downloaded image file on different systems.
OS type sha265 check sha265 calculation (to be compared manually) GPG signature verification
Linux sha256sum -c alpine-*.iso.sha256 curl https://alpinelinux.org/keys/ncopa.asc | gpg --import ;

gpg --verify alpine-<version>.iso.asc alpine-<version>.iso

Windows (PowerShell installed) - ? - Get-FileHash .\alpine-<image-version>.iso -Algorithm SHA256 - ? -

Booting from external devices

Insert the boot media to a proper drive or port of the computer and turn the machine on, or restart it, if already running.

If the computer does not automatically boot from the desired device, one needs to bring up the boot menu selection for choosing the media to boot from. Depending on the computer the menu may be accessed by quickly (repeatedly) pressing a key when booting starts, or sometimes it is needed to press the button before starting the computer and keep holding it when it boots. Typical keys are: `F9`-`F12`, sometimes `F7` or `F8`. If these don't bring up the boot menu, it may be necessary to enter the BIOS configuration and adjust the boot settings, for which typical keys are: `Del.` `F1` `F2` `F6` or `Esc.`

Rebooting and testing the new system

After the installation is completed, the system may be power-cycled or rebooted to confirm that everything is working. If the configured runtime mode was "sys", then remove the initial installation media to boot the newly installed system.

The relevant commands for this are reboot or poweroff.

Further Documentation

Installing


Post-Install

Further Help and Information



Tip: Alpine linux packages stay close to the upstream design. Therefore, all upstream documentation about configuring a software package, as well as good configuration guides from other distributions that stay close to upstream, like e.g. in the Arch Wiki, are to a large degree also well applicable to configure the software on alpine linux, thus can be very useful.

See Also

There may still be something useful to find and sort out of the newbie's install notes in this wiki, moving godd things into the structured handbook style documentation.

  1. Newbie_Alpine_Ecosystem
  2. Alpine newbie install manual
  3. Alpine_newbie Install section
  4. https://mckayemu.github.io/alpineinstalls/ All informatin for Spanish users