Alpine setup scripts: Difference between revisions

From Alpine Linux
m (→‎Keyboard Layout: DOCUMENTATION BUG)
m (→‎Video packages (optional): Remove outdated intel information.)
 
(65 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Feature descriptions for available Alpine Linux setup scripts ({{Path|/sbin/setup-*}}).
Feature descriptions for available Alpine Linux setup scripts ({{Path|/sbin/setup-*}}).


These scripts can be installed from alpine-conf package using apk.
These scripts can be installed by using <code>apk</code> to install the <code>alpine-conf</code> package.


(Some particular example usages can be seen at [[Alpine_newbie_install_manual#Ways_to_install_Alpine_into_machines_or_virtuals|Alpine for new users install manuals]].)
If you don't have an Alpine Linux install, you can find and examine the scripts in their [https://github.com/alpinelinux/alpine-conf git repository].


== setup-alpine ==
== setup-alpine ==
Line 17: Line 17:
# [[#setup-hostname|setup-hostname]] [-n alpine-test]
# [[#setup-hostname|setup-hostname]] [-n alpine-test]
# [[#setup-interfaces|setup-interfaces]] [-i < interfaces-file]
# [[#setup-interfaces|setup-interfaces]] [-i < interfaces-file]
# <code>/etc/init.d/networking --quiet start &</code>
# <code>rc-service networking --quiet start &</code>
# if none of the networking interfaces were configured using dhcp, then: <code>[[#setup-dns|setup-dns]]</code> [-d example.com -n "192.168.0.1 [...]"]
# if none of the networking interfaces were configured using dhcp, then: <code>[[#setup-dns|setup-dns]]</code> [-d example.com -n "192.168.0.1 [...]"]
# set the root password
# set the root password
# if not in quick mode, then: <code>[[#setup-timezone|setup-timezone]]</code> [-z UTC | -z America/New_York | -p EST+5]
# if not in quick mode, then: <code>[[#setup-timezone|setup-timezone]]</code> [-z UTC | -z America/New_York | -p EST+5]
# enable the new hostname (<code>/etc/init.d/hostname --quiet restart</code>)
# enable the new hostname (<code>rc-service hostname --quiet restart</code>)
# add <code>networking</code> and <code>urandom</code> to the '''boot''' rc level, and <code>acpid</code> and <code>cron</code> to the '''default''' rc level, and start the '''boot''' and '''default''' rc services
# add <code>networking</code> and <code>seedrng</code> (also referred to as <code>urandom</code> in versions prior to OpenRC 0.45) to the '''boot''' rc level, and <code>acpid</code> and <code>crond</code> to the '''default''' rc level, and start the '''boot''' and '''default''' rc services
# extract the fully-qualified domain name and hostname from {{Path|/etc/resolv.conf}} and <code>hostname</code>, and update {{Path|/etc/hosts}}
# extract the fully-qualified domain name and hostname from {{Path|/etc/resolv.conf}} and <code>hostname</code>, and update {{Path|/etc/hosts}}
# <code>[[#setup-proxy|setup-proxy]]</code> [-q <nowiki>"http://webproxy:8080"</nowiki>], and activate proxy if it was configured
# <code>[[#setup-proxy|setup-proxy]]</code> [-q <nowiki>"http://webproxy:8080"</nowiki>], and activate proxy if it was configured
# <code>setup-apkrepos</code> [-r (to select a mirror randomly)]
# <code>setup-apkrepos</code> [-r (to select a mirror randomly)]
# [[#setup-user|setup-user]]
# if not in quick mode, then: <code>[[#setup-sshd|setup-sshd]]</code> [-c openssh | dropbear | none]
# if not in quick mode, then: <code>[[#setup-sshd|setup-sshd]]</code> [-c openssh | dropbear | none]
# if not in quick mode, then: <code>setup-ntp</code> [-c chrony | openntpd | busybox | none]
# if not in quick mode, then: <code>setup-ntp</code> [-c chrony | openntpd | busybox | none]
# if not in quick mode, then: <code>DEFAULT_DISK=none</code> <code>[[#setup-disk|setup-disk]]</code> <code>-q</code> [-m data /dev/sda] (see [[Installation#Installation_Overview]] about the disk modes)
# if not in quick mode, then: <code>DEFAULT_DISK=none</code> <code>[[#setup-disk|setup-disk]]</code> <code>-q</code> [-m data /dev/sda] (see [[Installation#Installation_Overview]] about the disk modes)
# if installation mode selected during setup-disk was "data" instead of "sys", then: <code>setup-lbu</code> [/media/sdb1]
# if installation mode selected during setup-disk was "data" instead of "sys", then: <code>setup-lbu</code> [{{Path|/media/sdb1}}]
# if installation mode selected during setup-disk was "data" instead of "sys", then: <code>setup-apkcache</code> [/media/sdb1/cache | none]
# if installation mode selected during setup-disk was "data" instead of "sys", then: <code>setup-apkcache</code> [{{Path|/media/sdb1/cache}} | none]




<code>setup-alpine</code> itself accepts the following command-line switches
<code>setup-alpine</code> itself accepts the following command-line switches:


{{Define|-h|Shows the up-to-date usage help message.}}
{{Define|-h|Shows the up-to-date usage help message.}}
Line 39: Line 40:
{{Define|-a|Create an overlay file: this creates a temporary directory and saves its location in ROOT; however, the script doesn't export this variable so I think this feature isn't currently functional.}}
{{Define|-a|Create an overlay file: this creates a temporary directory and saves its location in ROOT; however, the script doesn't export this variable so I think this feature isn't currently functional.}}
;-c <var>answerfile</var>
;-c <var>answerfile</var>
:Create a new "answerfile", with default choices. You can edit the file and then invoke <code>setup-alpine -f <var>answerfile</var></code>.
:Create a new answerfile with default choices. You can edit the file and then invoke <code>setup-alpine -f <var>answerfile</var></code>.
;-f <var>answerfile</var>
;-f <var>answerfile</var>
:Use an existing "answerfile", which may override some or all of the interactive prompts.
:Use an existing answerfile, which may override some or all of the interactive prompts. You can also specify a HTTP(S) or FTP URL for <code>setup-alpine</code> to [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/merge_requests/22 download] an answerfile from. Doing so will spin up a temporary networking config if one is not already active.
{{Define|-q|Run in "quick mode".}}
{{Define|-q|Run in "quick mode".}}


 
<br>


== setup-hostname ==
== setup-hostname ==
Line 58: Line 59:
This script allows quick and easy setup of the system hostname by writing it to {{Path|/etc/hostname}}.  The script prevents you from writing an invalid hostname (such as one that used invalid characters or starts with a '-' or is too long).
This script allows quick and easy setup of the system hostname by writing it to {{Path|/etc/hostname}}.  The script prevents you from writing an invalid hostname (such as one that used invalid characters or starts with a '-' or is too long).
The script can be invoked manually or is called as part of the <code>setup-alpine</code> script.
The script can be invoked manually or is called as part of the <code>setup-alpine</code> script.
<br>


== setup-interfaces ==
== setup-interfaces ==
Line 64: Line 67:
Note that the contents of <var>interfaces-file</var> has to be supplied as stdin, rather than naming the file as an additional argument. The contents should have the format of {{Path|/etc/network/interfaces}}, such as:
Note that the contents of <var>interfaces-file</var> has to be supplied as stdin, rather than naming the file as an additional argument. The contents should have the format of {{Path|/etc/network/interfaces}}, such as:


auto lo
{{Cat|/etc/network/interfaces|auto lo
iface lo inet loopback
iface lo inet loopback
 
auto eth0
auto eth0
iface eth0 inet dhcp
iface eth0 inet dhcp
    hostname alpine-test
    hostname alpine-test
}}


== setup-dns ==
== setup-dns ==
Line 91: Line 95:
Example {{Path|/etc/resolv.conf}}:
Example {{Path|/etc/resolv.conf}}:


search example.org
{{Cat|/etc/resolv.conf|search example.org
nameserver 192.168.0.1
nameserver 192.168.0.1
}}


It can be run manually but is also invoked in the <code>setup-alpine</code> script unless interfaces are configured for DHCP.
It can be run manually but is also invoked in the <code>setup-alpine</code> script unless interfaces are configured for DHCP.
<br>


== setup-timezone ==
== setup-timezone ==
Line 104: Line 111:


'''-p''' <var>POSIX TZ format</var>
'''-p''' <var>POSIX TZ format</var>
<br>


== setup-proxy ==
== setup-proxy ==
Line 115: Line 124:


This script requests the system proxy to use in the form <code>http://<proxyurl>:<port></code> for example:
This script requests the system proxy to use in the form <code>http://<proxyurl>:<port></code> for example:
<code>http://10.0.0.1:8080</code>
<code><nowiki>http://10.0.0.1:8080</nowiki></code>


To set no system proxy use <code>none</code>.
To set no system proxy use <code>none</code>.
Line 128: Line 137:
where <code>$proxyurl</code> is the value input.   
where <code>$proxyurl</code> is the value input.   
If <code>none</code> was chosen then the value it is set to a blank value (and so no proxy is used).
If <code>none</code> was chosen then the value it is set to a blank value (and so no proxy is used).
<br>
== setup-apkrepos ==
:<code>setup-apkrepos</code> [-fhr] [REPO...]
Setup <code>apk</code> repositories.
options:
'''-c'''  <var>Enable the community repo</var>
'''-f'''  <var>Detect and add fastest mirror</var>
'''-h'''  <var>Show help</var>
'''-r'''  <var>Add a random mirror and do not prompt</var>
'''-1'''  <var>Add first mirror on the list (normally a CDN)</var>
This is run as part of the <code>setup-alpine</code> script.
<br>
== setup-user ==
:<code>setup-user</code> [-h] [-a] [-u] [-f FULLNAME] [-g GROUPS] [-k SSHKEY] [USERNAME]
Options:
'''-h''' <var>Show help</var>
'''-a''' <var>Create admin user. Add to wheel group and setup doas.</var>
'''-u''' <var>Unlock the user automatically (eg. create the user non-interactively with an ssh key for login)</var>
'''-f''' <var>Set the full name for the user</var>
'''-g''' <var>Comma or space separated list of groups to add user to</var>
'''-k''' <var>ssh key or URL to ssh key (eg. https://gitlab.alpinelinux.org/user.keys) or <code>none</code> for no key</var>
If USERNAME is not specified user will be prompted.
The setup-user script is stored in {{Path|/sbin/setup-user}} and allows quick and simple setup of user accounts.
It can be run manually but is also invoked in the <code>setup-alpine</code> script.
<br>


== setup-sshd ==
== setup-sshd ==
Line 150: Line 207:
It can be run manually but is also invoked in the <code>setup-alpine</code> script.
It can be run manually but is also invoked in the <code>setup-alpine</code> script.


== setup-apkrepos ==
<br>
:<code>setup-apkrepos</code> [-fhr] [REPO...]
 
== setup-ntp ==
 
''From [https://en.wikipedia.org/wiki/Network_Time_Protocol Wikipedia]'':
 
The '''Network Time Protocol (NTP)''' is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.
 
<br>
 
{{Cmd|usage: setup-ntp [-h] [busybox{{!}}openntpd{{!}}chrony{{!}}none]


Setup <code>apk</code> repositories.
Setup NTP time synchronization


options:
options:
-h  Show this help


'''-f''' <var>Detect and add fastest mirror</var>
  User is prompted if no NTP daemon is specified}}


'''-r'''  <var>Add a random mirror and do not prompt</var>
<code>setup-ntp</code> script is stored in {{Path|/sbin/setup-ntp}} and allows quick and simple setup of the NTP client,
It can be run manually but is also invoked in the <code>setup-alpine</code> script.


'''-1'''  <var>Add first mirror on the list (normally a CDN)</var>
<br>
 
This is run as part of the <code>setup-alpine</code> script.


== setup-disk ==
== setup-disk ==


:<code>DEFAULT_DISK=none setup-disk -q</code> [-m data | sys] [<var>mountpoint directory</var> | /dev/sda ...]
:<code>DEFAULT_DISK=none setup-disk -q</code> [-m data | sys] [<var>mountpoint directory</var> | {{Path|/dev/sda}} ...]


In "sys" mode, it's an installer, it permanently installs Alpine on the disk, in "data" mode, it provides a larger and persistent /var volume.
In "sys" mode, it's an installer, it permanently installs Alpine on the disk, in "data" mode, it provides a larger and persistent {{Path|/var}} volume.


This script accepts the following command-line switches:
This script accepts the following command-line switches:
Line 194: Line 260:


<code>ROOTFS</code>
<code>ROOTFS</code>
:Filesystem to use for the / volume; defaults to ext4. Only used if '''-m sys''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.
:Filesystem to use for the {{Path|/}} volume; defaults to ext4. Only used if '''-m sys''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 [[Btrfs|btrfs]] xfs.


<code>BOOTFS</code>
<code>BOOTFS</code>
:Filesystem to use for the /boot volume; defaults to ext4. Only used if '''-m sys''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.
:Filesystem to use for the {{Path|/boot}} volume; defaults to ext4. Only used if '''-m sys''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 [[Btrfs|btrfs]] xfs.


<code>VARFS</code>
<code>VARFS</code>
:Filesystem to use for the /var volume; defaults to ext4. Only used if '''-m data''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.
:Filesystem to use for the {{Path|/var}} volume; defaults to ext4. Only used if '''-m data''' is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 [[Btrfs|btrfs]] xfs.


<code>SYSROOT</code>
<code>SYSROOT</code>
Line 225: Line 291:


==== RAID ====
==== RAID ====
<code>setup-disk</code> will automatically build a RAID array if you supply the '''-r''' switch, or if you specify more than one device. The array will always be [https://en.m.wikipedia.org/wiki/Standard_RAID_levels#RAID_1 RAID1] (and [https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-0.90_Superblock_Format --metadata=0.90]) for the /boot volumes, but will be [https://en.m.wikipedia.org/wiki/Standard_RAID_levels#RAID_5 RAID5] (and [https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-1_Superblock_Format --metadata=1.2] for non-boot volumes when 3 or more devices are supplied.
<code>setup-disk</code> will automatically build a RAID array if you supply the '''-r''' switch, or if you specify more than one device. The array will always be [https://en.m.wikipedia.org/wiki/Standard_RAID_levels#RAID_1 RAID1] (and [https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-0.90_Superblock_Format --metadata=0.90]) for the {{Path|/boot}} volumes, but will be [https://en.m.wikipedia.org/wiki/Standard_RAID_levels#RAID_5 RAID5] (and [https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#The_version-1_Superblock_Format --metadata=1.2] for non-boot volumes when 3 or more devices are supplied.


If you instead want to build your RAID array manually, see [[Setting up a software RAID array]]. Then format and mount the disks, and supply the root mountpoint to <code>setup-disk</code>.
If you instead want to build your RAID array manually, see [[Setting up a software RAID array]]. Then format and mount the disks, and supply the root mountpoint to <code>setup-disk</code>.
Line 276: Line 342:
sys:
sys:
   This mode is a traditional disk install. The following partitions will be
   This mode is a traditional disk install. The following partitions will be
   created on the disk: /boot, / (filesystem root) and swap.
   created on the disk: {{Path|/boot}}, {Path|/}} (filesystem root) and swap.
      
      
   This mode may be used for development boxes, desktops, virtual servers, etc.
   This mode may be used for development boxes, desktops, virtual servers, etc.
Line 291: Line 357:


-->
-->
<br>


== setup-lbu ==
== setup-lbu ==
Line 296: Line 364:
This script will only be invoked for by <code>setup-alpine</code> when installing <code>data</code> installation types (ramdisk)
This script will only be invoked for by <code>setup-alpine</code> when installing <code>data</code> installation types (ramdisk)


In the previous step, we set up the disk used for the swap partition and for mounting <code>/var</code>. Here we set up where <code>lbu commit</code> will store its backup configuration. See [[Alpine local backup]] for more information.
It configures where <code>lbu commit</code> will store the .apkovl backup. See [[Alpine local backup]] for more information.


When started, <code>setup-lbu</code> will prompt where to store your data. The options it will prompt for will be taken from the directories found in <code>/media</code> (except for <code>cdrom</code>). [not sure how these are mounted: are they automatically mounted by setup-lbu? Does the user have to manually mount using another tty?]
When started, <code>setup-lbu</code> will prompt where to store your data. The options it will prompt for will be taken from the directories found in <code>/media</code> (except for <code>cdrom</code>). [not sure how these are mounted: are they automatically mounted by setup-lbu? Does the user have to manually mount using another tty?]
<br>


== setup-apkcache ==
== setup-apkcache ==
Line 304: Line 374:
This script will only be invoked for by <code>setup-alpine</code> when installing <code>data</code> installation types (ramdisk)
This script will only be invoked for by <code>setup-alpine</code> when installing <code>data</code> installation types (ramdisk)


In the previous steps, we setup the disk partitions, and told Alpine where it can save its configuration for ramdisk installations. Here we tell Alpine where to save the apk files that you will want to persist across boots. The apkcache is where apk stores cached packages, such that the system does not need to download them at each boot, and doesn't have to depend on the network. See [[Local APK cache]] for a detailed explanation.
It configures where to save the apk package files. The apkcache is where apk stores downloaded packages, such that the system does not need to download them again on each reboot, and doesn't have to depend on the network. See [[Local APK cache]] for a detailed explanation.


You should be able to use a partition that you set up in the previous steps.
You should be able to use a partition that you set up in the previous steps.
<br>


== setup-bootable ==
== setup-bootable ==
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.


It allows to create boot media that boots the system running from RAM memory (diskless) like the installation images, but uses a writable (i.e. not iso9660) filesystem. So that it can also serve to store local customizations (e.g. apkovl files and cached packages).  
It allows to create boot media that boots the system running from RAM memory (diskless) like the installation images, but using a writable (i.e. not iso9660) filesystem. So that it can also serve to store local customizations (e.g. apkovl files and cached packages).  


The script first copies the contents of an ISO onto a USB key, CF, SDCard, etc., or harddisk partition. And then installs the syslinux bootloader to make the device bootable.
First, the script copies files from an ISO image (as file on a CD/DVD/USB etc.) onto a USB-Stick/CompactFlash/SDCard etc., or harddisk partition. And then, it installs the syslinux bootloader to make the device bootable.


However, the syslinux install currently seems to fail on non-FAT partitions, so, you may use <code>setup-bootable</code> with the <code>-u</code> option to skip the syslinux install.
However, its current syslinux installation seems to fail on non-FAT32 partitions. So in these cases, you may start over with a FAT32 filesystem, or rather with the desired filesystem and using <code>setup-bootable</code> only with the <code>-u</code> option, to skip the syslinux install, and then refer to the [[Create_a_Bootable_Device#Manually_copying_Alpine_files|manual method]] to fix the problem, or use one of the other bootloader options, instead.


{{Tip| The [[Bootloaders]] page shows different ways to setup booting and boot menus.}}   
{{Tip| The [[Bootloaders]] page shows different ways to setup booting, and multi-boot menus!}}   






The script accepts the following arguments and command-line switches (you can run <code>setup-bootable -h</code> to see a usage message).
The setup-bootable script accepts the following arguments and command-line switches (you can run <code>setup-bootable -h</code> to see a usage message).


{{Cmd|setup-bootable <var>source</var> [<var>dest</var>]}}
{{Cmd|setup-bootable <var>source</var> [<var>dest</var>]}}
Line 335: Line 407:
The script will ensure that <var>source</var> and <var>dest</var> are available; will copy the contents of <var>source</var> to <var>dest</var>, ensuring first that there's enough space; and unless '''-u''' was specified, will make <var>dest</var> bootable.
The script will ensure that <var>source</var> and <var>dest</var> are available; will copy the contents of <var>source</var> to <var>dest</var>, ensuring first that there's enough space; and unless '''-u''' was specified, will make <var>dest</var> bootable.


Suppose the target device is {{Path|/dev/sdXY}}, then this partition can be prepared for booting with
 
{{Cmd|# setup-bootable -v /media/<installation-media-device> /dev/sdXY
For other ways to set up boot media (manually) see [[Create a Bootable USB#Creating_a_bootable_Alpine_Linux_USB_Stick_from_the_command_line|Creating a bootable Alpine Linux USB Stick from the command line]].
}}


<!--
For the manual way to set up boot media see [[Create_a_Bootable_Device#Manually_copying_Alpine_files|Manually_copying_Alpine_files]].
== setup-cryptswap ==
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
 
:<code>setup-cryptswap</code> [<var>partition</var> | none]
 
{{Todo|Does this script still work? At what stage can it be run: only after setup-alpine?}}
-->


<br>


== setup-xorg-base ==
== setup-xorg-base ==
Line 353: Line 419:
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.


It configures a graphical environment with basic Xorg packages and udev (replacing mdev), and is also required for Wayland sessions.
It configures a graphical environment, installing basic Xorg packages and [[eudev]] (replacing [[mdev]]), and is also required for Wayland sessions.
 
The script installs, among other packages, e.g.: <code>xorg-server xf86-input-libinput xinit eudev</code>.


The script installs, e.g. among other packages: <code>xorg-server xf86-video-vesa xf86-input-evdev xf86-input-mouse xf86-input-keyboard udev</code>.
Additional packages to install may be supplied as arguments.
{{cmd|setup-xorg-base [additional package(s) to install]}}


Additional packages to install may be supplied as arguments to <code>setup-xorg-base</code>.


For example, if you only want to start the graphical environment manually, from the command line, instead of running a display manager (service), you may add <code>xinit</code>. 
==== Video packages (optional) ====


You may install specific xf86 xorg driver packages for your video card's chipset, as they may support specific features, effects and acceleration modes, and avoid error messages during X initialization.


==== Video packages ====
However, the most basic X features should work fine with just using the default kernel video-modesetting drivers.
You will most likely want to install driver packages with specific support for your video chipset. Otherwise, X will resort to the rather slow and cumbersome VESA standard driver.


Info about the particular video cards that are installed in the computer may be found in the list of PCI devices:
Info about the particular video cards that are installed in the computer may be found in the list of PCI devices:
{{cmd|$ lspci}}
{{cmd|# apk add pciutils
$ lspci}}


To see available video driver packages run:
To see available video driver packages run:
Line 376: Line 445:


Others:
Others:
* For Intel video chipsets install 'xf86-video-intel' and see [[Intel Video]].
* For Intel video chipsets see [[Intel Video]].
{{Tip|In some cases, freezes on suspend/resume stop happening when changing the video port the monitor is connected to.}}
* For AMD Radeon Video see [[Radeon_Video]]
* For AMD Radeon Video see [[Radeon_Video]]
* For Alix1D use xf86-video-geode.
* For Alix1D use xf86-video-geode.
* In KVM/Qemu guests see [[Qemu#Using_Xorg_inside_Qemu|Xorg within KVM/Qemu]]
* In KVM/QEMU guests see [[QEMU#Using_Xorg_inside_Qemu|Xorg within KVM/QEMU]]
* In Virtualbox guests use xf86-video-vboxvideo, and install the [[VirtualBox_guest_additions|VirtualBox guest additions]] as well. They contain important parts for the driver.
* In VirtualBox guests use xf86-video-vboxvideo, and install the [[VirtualBox_guest_additions|VirtualBox guest additions]] as well. They contain important parts for the driver.
* In VMware guests use xf86-video-vmware
* In VMware guests use xf86-video-vmware
* In Hyper-V guests use xf86-video-fbdev and install the [[Hyper-V_guest_services|Hyper-V guest services]] as well.
* In Hyper-V guests use xf86-video-fbdev and install the [[Hyper-V_guest_services|Hyper-V guest services]] as well.
Line 386: Line 456:
==== Input packages ====
==== Input packages ====


To search for xf86-input driver packages run:
If the <b>Numlock</b> settings are not working, or getting <b>'setleds not found'</b> errors:
 
{{cmd|# apk add kbd}}
 
If some input device is not working at all, the available xf86-input drivers can be listed with:
{{cmd|$ apk search xf86-input}}
{{cmd|$ apk search xf86-input}}


As good choice for the start is:
You probably at least want {{cmd| xf86-input-libinput}} or {{cmd| xf86-input-evdev}}
 
libinput is for Wayland with wrapper for Xorg. evdev is Xorg only.<br><br>
 
Typical legacy drivers (not packaged. at least as of 2/2022):


{{cmd|# apk add xf86-input-mouse xf86-input-keyboard}}
{{cmd|# apk add xf86-input-mouse xf86-input-keyboard}}
Line 397: Line 475:
{{Cmd|# apk add xf86-input-synaptics}}
{{Cmd|# apk add xf86-input-synaptics}}


Also libinput is a good choice, as it's integrated best with GNOME and offers advanced functionality (e.g. palm rejection for touchpads).
==== Configure xorg-server (optional) ====


{{cmd|# apk add xf86-input-libinput}}
On most systems, xorg should be able to autodetect all devices. However you can still configure xorg-server by hand by launching:
{{Cmd|# Xorg -configure}}
This will create a {{Path|/root/xorg.conf.new}} file. You can modify this file to fit your needs.<BR>
(When finished modifying and testing the above configuration file, move it to {{Path|/etc/X11/xorg.conf}} for normal usage.)


If the <b>Numlock</b> service is added but does not start, or if <b>'setleds not found'</b> appears during the boot sequence:
==== Keyboard Layout (optional) ====


{{cmd|# apk add kbd}}
If you use a keyboard layout different than "us", and you are using a window manager or desktop environment that does not support to configure the keyboard layout itself, then you need to


==== Configure xorg-server (optional) ====
* [[Repositories#Enabling_the_community_repository|Enable the "community" repository]]
 
On most systems, xorg should be able to autodetect all devices. However you can still configure xorg-server by hand by launching:
{{Cmd|# Xorg -configure}}
This will create a `/root/xorg.conf.new` file. You can modify this file to fit your needs.<BR>
(When finished modifying and testing the above configuration file, move it to `/etc/X11/xorg.conf` for normal usage.)


==== Keyboard Layout ====
and install setxkbmap:


<big>:!: FIXME There is no such thing like "setxkbmap" with Alpine Linux 3.13 by 2021-05-09. PLEASE UPDATE. FIXME</big>
{{Cmd|# apk add setxkbmap}}


Then try
{{Cmd|# setxkbmap <%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>}}




If you use a layout different than "us", you need to:
In order to make it persistent add this section to {{Path|/etc/X11/xorg.conf}}:
{{Cmd|# apk add setxkbmap
setxkbmap <%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>}}
In order to make it persistent add this section to /etc/X11/xorg.conf:
{{Cmd|Section "InputClass"
{{Cmd|Section "InputClass"
Identifier "Keyboard Default"
Identifier "Keyboard Default"
MatchIsKeyboard "yes"
MatchIsKeyboard "yes"
Option "XkbLayout" "<%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>"
Option "XkbLayout" "<%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>"
EndSection}}
EndSection
}}
 
Another way to change the keymap when logging into X is to use {{Path|~/.xinitrc}}.  The following example loads a British keymap, simply add this line to the beginning of the file:
<code>setxkbmap gb &</code>
 
 
If you need to create the {{Path|~/.xinitrc}} file, you may also want to add a second line like <code>exec openbox-session</code> to still start the window manager with <code>startx</code> or <code>xinit</code>.
 
<br>


== setup-desktop ==


Another way to change the keymap when logging into X is to use ~/.xinitrc.  The following example loads a British keymap, simply add this line to the beginning of the file:
This script is used to set up a desktop environment. This is a replacement for the now-removed <code>alpine-desktop</code> package.
<code>setxkbmap gb &</code>


Note that you will need the "setxkbmap" package for this to work!
The script will ask you to select the desktop environment to install: gnome, plasma, xfce, or none. Type the desktop environment you want to install and hit enter. The script will install all of the necessary packages and add the necessary services to run on startup. You can reboot when complete and the system will boot into a graphical login screen with the desktop environment.


If you need to create the ~/.xinitrc file, you may also add a second line like <code>exec startxfce4</code> to start your desktop environment or window manager with <code>xinit</code>.
<br>


== Documentation needed ==
== Documentation needed ==
Line 440: Line 524:
=== setup-xen-dom0 ===
=== setup-xen-dom0 ===


=== setup-gparted-desktop ===
<br>
Uses openbox.
 
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.


=== setup-mta ===
=== setup-mta ===
Line 449: Line 530:


This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
<br>


=== setup-acf ===
=== setup-acf ===
:<code>setup-acf</code> [-ahn] [-e email] [-l address] [PACKAGE...]
Options:
'''-a''' <var>Which acf-* packages to install</var>
'''-h''' <var>Show help</var>
'''-n''' <var>Don't create {{path|/etc/acf/passwd}}</var>
'''-e''' <var>email address (for TLS certificate)</var>
'''-l''' <var>hostname for mini_httpd</var> 
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.
This is a standalone script; it's not invoked by <code>setup-alpine</code> but must be run manually.


Line 457: Line 554:
See [[:Category:ACF|ACF pages]] for more information.
See [[:Category:ACF|ACF pages]] for more information.


=== setup-ntp ===
= See also =
 
* [[Installation]]
 
* [[Installation#Post-Install|Post Install]]
= =
* [https://docs.alpinelinux.org/ beta.docs.alpinelinux.org]


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

Latest revision as of 05:14, 30 December 2023

Feature descriptions for available Alpine Linux setup scripts (/sbin/setup-*).

These scripts can be installed by using apk to install the alpine-conf package.

If you don't have an Alpine Linux install, you can find and examine the scripts in their git repository.

setup-alpine

This is the main Alpine configuration and installation script.

The script interactively walks the user through executing several auxiliary setup-* scripts, in the order shown below.

The bracketed options represent example configuration choices, formatted as they may be supplied when manually calling the auxiliary setup scripts, or using a setup-alpine "answerfile" (see below).


  1. setup-keymap [us us]
  2. setup-hostname [-n alpine-test]
  3. setup-interfaces [-i < interfaces-file]
  4. rc-service networking --quiet start &
  5. if none of the networking interfaces were configured using dhcp, then: setup-dns [-d example.com -n "192.168.0.1 [...]"]
  6. set the root password
  7. if not in quick mode, then: setup-timezone [-z UTC | -z America/New_York | -p EST+5]
  8. enable the new hostname (rc-service hostname --quiet restart)
  9. add networking and seedrng (also referred to as urandom in versions prior to OpenRC 0.45) to the boot rc level, and acpid and crond to the default rc level, and start the boot and default rc services
  10. extract the fully-qualified domain name and hostname from /etc/resolv.conf and hostname, and update /etc/hosts
  11. setup-proxy [-q "http://webproxy:8080"], and activate proxy if it was configured
  12. setup-apkrepos [-r (to select a mirror randomly)]
  13. setup-user
  14. if not in quick mode, then: setup-sshd [-c openssh | dropbear | none]
  15. if not in quick mode, then: setup-ntp [-c chrony | openntpd | busybox | none]
  16. if not in quick mode, then: DEFAULT_DISK=none setup-disk -q [-m data /dev/sda] (see Installation#Installation_Overview about the disk modes)
  17. if installation mode selected during setup-disk was "data" instead of "sys", then: setup-lbu [/media/sdb1]
  18. if installation mode selected during setup-disk was "data" instead of "sys", then: setup-apkcache [/media/sdb1/cache | none]


setup-alpine itself accepts the following command-line switches:

-h
Shows the up-to-date usage help message.

-a
Create an overlay file: this creates a temporary directory and saves its location in ROOT; however, the script doesn't export this variable so I think this feature isn't currently functional.

-c answerfile
Create a new answerfile with default choices. You can edit the file and then invoke setup-alpine -f answerfile.
-f answerfile
Use an existing answerfile, which may override some or all of the interactive prompts. You can also specify a HTTP(S) or FTP URL for setup-alpine to download an answerfile from. Doing so will spin up a temporary networking config if one is not already active.

-q
Run in "quick mode".


setup-hostname

setup-hostname [-h] [-n hostname]

Options:

-h Show help

-n Specify hostname

This script allows quick and easy setup of the system hostname by writing it to /etc/hostname. The script prevents you from writing an invalid hostname (such as one that used invalid characters or starts with a '-' or is too long). The script can be invoked manually or is called as part of the setup-alpine script.


setup-interfaces

setup-interfaces [-i < interfaces-file]

Note that the contents of interfaces-file has to be supplied as stdin, rather than naming the file as an additional argument. The contents should have the format of /etc/network/interfaces, such as:

Contents of /etc/network/interfaces

auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp hostname alpine-test

setup-dns

setup-dns [-h] [-d domain name] [-n name server]

Options:

-h Show help

-d specify search domain name

-n name server IP

The setup-dns script is stored in /sbin/setup-dns and allows quick and simple setup of DNS servers (and a DNS search domain if required). Simply running setup-dns will allow interactive use of the script, or the options can be specified.

The information fed to this script is written to /etc/resolv.conf

Example usage (with 192.168.0.1 being the local router/dns-forwarder):

setup-dns -d example.org -n 192.168.0.1

Example /etc/resolv.conf:

Contents of /etc/resolv.conf

search example.org nameserver 192.168.0.1

It can be run manually but is also invoked in the setup-alpine script unless interfaces are configured for DHCP.


setup-timezone

setup-timezone [-z UTC | -z America/New_York | -p EST+5]

Can pre-select the timezone using either of these switches:

-z subfolder of /usr/share/zoneinfo

-p POSIX TZ format


setup-proxy

setup-proxy [-hq] [PROXYURL]

Options:

-h Show help

-q Quiet mode prevents changes from taking effect until after reboot

This script requests the system proxy to use in the form http://<proxyurl>:<port> for example: http://10.0.0.1:8080

To set no system proxy use none. This script exports the following environmental variables:

http_proxy=$proxyurl

https_proxy=$proxyurl

ftp_proxy=$proxyurl

where $proxyurl is the value input. If none was chosen then the value it is set to a blank value (and so no proxy is used).


setup-apkrepos

setup-apkrepos [-fhr] [REPO...]

Setup apk repositories.

options:

-c Enable the community repo

-f Detect and add fastest mirror

-h Show help

-r Add a random mirror and do not prompt

-1 Add first mirror on the list (normally a CDN)

This is run as part of the setup-alpine script.


setup-user

setup-user [-h] [-a] [-u] [-f FULLNAME] [-g GROUPS] [-k SSHKEY] [USERNAME]

Options:

-h Show help

-a Create admin user. Add to wheel group and setup doas.

-u Unlock the user automatically (eg. create the user non-interactively with an ssh key for login)

-f Set the full name for the user

-g Comma or space separated list of groups to add user to

-k ssh key or URL to ssh key (eg. https://gitlab.alpinelinux.org/user.keys) or none for no key

If USERNAME is not specified user will be prompted.

The setup-user script is stored in /sbin/setup-user and allows quick and simple setup of user accounts. It can be run manually but is also invoked in the setup-alpine script.


setup-sshd

setup-sshd [-h] [-c choice of SSH daemon]

Options:

-h Show help

-c SSH daemon where SSH daemon can be one of the following:

openssh install the openSSH daemon

dropbear install the dropbear daemon

none Do not install an SSH daemon

Example usage:

setup-sshd -c dropbear

The setup-sshd script is stored in /sbin/setup-sshd and allows quick and simple setup of either the OpenSSH or Dropbear SSH daemon & client. It can be run manually but is also invoked in the setup-alpine script.


setup-ntp

From Wikipedia:

The Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.


usage: setup-ntp [-h] [busybox|openntpd|chrony|none] Setup NTP time synchronization options: -h Show this help User is prompted if no NTP daemon is specified

setup-ntp script is stored in /sbin/setup-ntp and allows quick and simple setup of the NTP client, It can be run manually but is also invoked in the setup-alpine script.


setup-disk

DEFAULT_DISK=none setup-disk -q [-m data | sys] [mountpoint directory | /dev/sda ...]

In "sys" mode, it's an installer, it permanently installs Alpine on the disk, in "data" mode, it provides a larger and persistent /var volume.

This script accepts the following command-line switches:

-k kernel flavor
-o apkovl file
Restore system from apkovl file
-m data | sys
Don't prompt for installation mode. With -m data, the supplied devices are formatted to use as a /var volume.

-r
Use RAID1 with a single disk (degraded mode)

-L
Create and use volumes in a LVM group

-s swap size in MB
Use 0 to disable swap

-q
Exit quietly if no disks are found

-v
Verbose mode

The script also honors the following environment variables:

BOOT_SIZE

Size of the boot partition in MB; defaults to 100. Only used if -m sys is specified or interactively selected.

SWAP_SIZE

Size of the swap volume in MB; set to 0 to disable swap. If not specified, will default to twice RAM, up to 4096, but won't be more than 1/3 the size of the smallest disk, and if less than 64 will just be 0. Only used if -m sys is specified or interactively selected.

ROOTFS

Filesystem to use for the / volume; defaults to ext4. Only used if -m sys is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.

BOOTFS

Filesystem to use for the /boot volume; defaults to ext4. Only used if -m sys is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.

VARFS

Filesystem to use for the /var volume; defaults to ext4. Only used if -m data is specified or interactively selected. Supported filesystems are: ext2 ext3 ext4 btrfs xfs.

SYSROOT

Mountpoint to use when creating volumes and doing traditional disk install (-m sys). Defaults to /mnt.

MBR

Path of MBR binary code, defaults to /usr/share/syslinux/mbr.bin.

BOOTLOADER

Bootloader to use, defaults to syslinux. Supported bootloaders are: grub syslinux zipl.

DISKLABEL

Disklabel to use, defaults to dos. Supported disklabels are: dos gpt eckd.


Partitioning

If you have complex partitioning needs, that go beyond above alpine-disk options, you can partition, format, and mount your volumes manually, and then just supply the root mountpoint to setup-disk. Doing so implicitly behaves as though -m sys had also been specified.

See Setting up disks manually for more information.


RAID

setup-disk will automatically build a RAID array if you supply the -r switch, or if you specify more than one device. The array will always be RAID1 (and --metadata=0.90) for the /boot volumes, but will be RAID5 (and --metadata=1.2 for non-boot volumes when 3 or more devices are supplied.

If you instead want to build your RAID array manually, see Setting up a software RAID array. Then format and mount the disks, and supply the root mountpoint to setup-disk.

LVM

setup-disk will automatically build and use volumes in a LVM group if you supply the -L switch. The group and volumes created by the script will have the following names:

  • volume group: vg0
  • swap volume: lv_swap (only created when swap size > 0)
  • root volume: lv_root (only created when -m sys is specified or interactively selected)
  • var volume: lv_var (only created when -m data is specified or interactively selected)

The lv_var or lv_root volumes are created to occupy all remaining space in the volume group.

If you need to change any of these settings, you can use vgrename, lvrename, lvreduce or lvresize.

If you instead want to build your LVM system manually, see Setting up Logical Volumes with LVM. Then format and mount the disks, and supply the root mountpoint to setup-disk.



setup-lbu

This script will only be invoked for by setup-alpine when installing data installation types (ramdisk)

It configures where lbu commit will store the .apkovl backup. See Alpine local backup for more information.

When started, setup-lbu will prompt where to store your data. The options it will prompt for will be taken from the directories found in /media (except for cdrom). [not sure how these are mounted: are they automatically mounted by setup-lbu? Does the user have to manually mount using another tty?]


setup-apkcache

This script will only be invoked for by setup-alpine when installing data installation types (ramdisk)

It configures where to save the apk package files. The apkcache is where apk stores downloaded packages, such that the system does not need to download them again on each reboot, and doesn't have to depend on the network. See Local APK cache for a detailed explanation.

You should be able to use a partition that you set up in the previous steps.


setup-bootable

This is a standalone script; it's not invoked by setup-alpine but must be run manually.

It allows to create boot media that boots the system running from RAM memory (diskless) like the installation images, but using a writable (i.e. not iso9660) filesystem. So that it can also serve to store local customizations (e.g. apkovl files and cached packages).

First, the script copies files from an ISO image (as file on a CD/DVD/USB etc.) onto a USB-Stick/CompactFlash/SDCard etc., or harddisk partition. And then, it installs the syslinux bootloader to make the device bootable.

However, its current syslinux installation seems to fail on non-FAT32 partitions. So in these cases, you may start over with a FAT32 filesystem, or rather with the desired filesystem and using setup-bootable only with the -u option, to skip the syslinux install, and then refer to the manual method to fix the problem, or use one of the other bootloader options, instead.

Tip: The Bootloaders page shows different ways to setup booting, and multi-boot menus!


The setup-bootable script accepts the following arguments and command-line switches (you can run setup-bootable -h to see a usage message).

setup-bootable source [dest]

The argument source can be a directory or an ISO (will be mounted to MNT or /mnt) or a URL (will be downloaded with WGET or wget). The argument dest can be a directory mountpoint, or will default to /media/usb if not supplied.

-k
Keep alpine_dev in syslinux.cfg; otherwise, replace with UUID.

-u
Upgrade mode: keep existing syslinux.cfg and don't run syslinux

-f
Overwrite syslinux.cfg even if -u was specified.

-s
Force the running of syslinux even if -u was specified.

-v
Verbose mode

The script will ensure that source and dest are available; will copy the contents of source to dest, ensuring first that there's enough space; and unless -u was specified, will make dest bootable.

Suppose the target device is /dev/sdXY, then this partition can be prepared for booting with

# setup-bootable -v /media/<installation-media-device> /dev/sdXY

For the manual way to set up boot media see Manually_copying_Alpine_files.


setup-xorg-base

This is a standalone script; it's not invoked by setup-alpine but must be run manually.

It configures a graphical environment, installing basic Xorg packages and eudev (replacing mdev), and is also required for Wayland sessions.

The script installs, among other packages, e.g.: xorg-server xf86-input-libinput xinit eudev.

Additional packages to install may be supplied as arguments.

setup-xorg-base [additional package(s) to install]


Video packages (optional)

You may install specific xf86 xorg driver packages for your video card's chipset, as they may support specific features, effects and acceleration modes, and avoid error messages during X initialization.

However, the most basic X features should work fine with just using the default kernel video-modesetting drivers.

Info about the particular video cards that are installed in the computer may be found in the list of PCI devices:

# apk add pciutils $ lspci

To see available video driver packages run:

$ apk search xf86-video

For example,

  • For an Sis video chipset install 'xf86-video-sis'.

# apk add xf86-video-sis

Others:

Tip: In some cases, freezes on suspend/resume stop happening when changing the video port the monitor is connected to.

Input packages

If the Numlock settings are not working, or getting 'setleds not found' errors:

# apk add kbd

If some input device is not working at all, the available xf86-input drivers can be listed with:

$ apk search xf86-input

You probably at least want

xf86-input-libinput

or

xf86-input-evdev

libinput is for Wayland with wrapper for Xorg. evdev is Xorg only.

Typical legacy drivers (not packaged. at least as of 2/2022):

# apk add xf86-input-mouse xf86-input-keyboard

And for touchpad tapping support on many laptops, also:

# apk add xf86-input-synaptics

Configure xorg-server (optional)

On most systems, xorg should be able to autodetect all devices. However you can still configure xorg-server by hand by launching:

# Xorg -configure

This will create a /root/xorg.conf.new file. You can modify this file to fit your needs.
(When finished modifying and testing the above configuration file, move it to /etc/X11/xorg.conf for normal usage.)

Keyboard Layout (optional)

If you use a keyboard layout different than "us", and you are using a window manager or desktop environment that does not support to configure the keyboard layout itself, then you need to

and install setxkbmap:

# apk add setxkbmap

Then try

# setxkbmap <%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>


In order to make it persistent add this section to /etc/X11/xorg.conf:

Section "InputClass" Identifier "Keyboard Default" MatchIsKeyboard "yes" Option "XkbLayout" "<%a language layout from /usr/share/X11/xkb/rules/xorg.lst%>" EndSection

Another way to change the keymap when logging into X is to use ~/.xinitrc. The following example loads a British keymap, simply add this line to the beginning of the file: setxkbmap gb &


If you need to create the ~/.xinitrc file, you may also want to add a second line like exec openbox-session to still start the window manager with startx or xinit.


setup-desktop

This script is used to set up a desktop environment. This is a replacement for the now-removed alpine-desktop package.

The script will ask you to select the desktop environment to install: gnome, plasma, xfce, or none. Type the desktop environment you want to install and hit enter. The script will install all of the necessary packages and add the necessary services to run on startup. You can reboot when complete and the system will boot into a graphical login screen with the desktop environment.


Documentation needed

setup-xen-dom0


setup-mta

Uses ssmtp.

This is a standalone script; it's not invoked by setup-alpine but must be run manually.


setup-acf

setup-acf [-ahn] [-e email] [-l address] [PACKAGE...]

Options:

-a Which acf-* packages to install

-h Show help

-n Don't create /etc/acf/passwd

-e email address (for TLS certificate)

-l hostname for mini_httpd

This is a standalone script; it's not invoked by setup-alpine but must be run manually.

This script was named setup-webconf before Alpine 1.9 beta 4.

See ACF pages for more information.

See also