<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sodface</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sodface"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Sodface"/>
	<updated>2026-04-30T08:02:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29683</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29683"/>
		<updated>2025-04-13T23:10:52Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* HTTP and web services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions. Howto&#039;s have been organized in the below page based on the topics.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The [[#Tutorials|tutorials]] are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* Contributors are requested to refer to [[Help:Editing]] first and make use of resources like [[How to write a HOWTO]].&lt;br /&gt;
* Contributions must be complete articles. &lt;br /&gt;
* Don&#039;t override already made contributions, unless there is a mistake. &lt;br /&gt;
* If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].}}&lt;br /&gt;
&lt;br /&gt;
== Desktop ==&lt;br /&gt;
&lt;br /&gt;
* {{:Daily driver guide}}&lt;br /&gt;
=== Power management ===&lt;br /&gt;
&lt;br /&gt;
* [[Configure action when power-button is pressed]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Configure Wake-on-LAN]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]] - Instructions for installing and configuring Bluetooth&lt;br /&gt;
* [[Bonding]] - Bond (or aggregate) multiple ethernet interfaces&lt;br /&gt;
* [[Bridge]] - Configuring a network bridge&lt;br /&gt;
** [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* Modem&lt;br /&gt;
** [[Using HSDPA modem]]&lt;br /&gt;
** [[Using serial modem]]&lt;br /&gt;
* [[mDNS]] - Howto implement multicast DNS resolution in Alpine. &lt;br /&gt;
* [[Multi ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
* Wi-Fi&lt;br /&gt;
** [[Wi-Fi|Connecting to a wireless access point]]&lt;br /&gt;
** [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[VLAN]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
&lt;br /&gt;
* [[Securing Alpine Linux]] How to Secure Alpine Linux using Security Technical Implementation Guides (STIGs)&lt;br /&gt;
* Understand [[UEFI]] and enable [[UEFI Secure Boot]]&lt;br /&gt;
&lt;br /&gt;
=== Backup and data migration ===&lt;br /&gt;
&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Rsnapshot]] - setting up periodic backups&lt;br /&gt;
&lt;br /&gt;
=== Other topics ===&lt;br /&gt;
&lt;br /&gt;
* [[Gaming on Alpine]]&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Default applications|How to change default application]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
* [[Mimalloc]]&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[How to build the Alpine Linux kernel]]&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
* [[Desktop environments and Window managers|List of supported Desktop environments and Window managers]]&lt;br /&gt;
&lt;br /&gt;
== Diskless ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]]&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
== Other Architectures ==&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
==== Raspberry Pi ====&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi main page]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker|Raspberry Pi - Bluetooth Speaker]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi|Raspberry Pi - Router with VPN]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)|Raspberry Pi - Router with VPN (IPv6)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi|Raspberry Pi - Sys mode install]]&lt;br /&gt;
* [[Raspberry Pi LVM on LUKS|Raspberry Pi - Sys mode install - LVM on LUKS]]&lt;br /&gt;
* [[RPI Video Receiver|Raspberry Pi - Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[How to set up Alpine as a wireless router|Raspberry Pi Zero W - Wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[RPI Video Receiver]]&lt;br /&gt;
&lt;br /&gt;
=== IBM Z (IBM z Systems) ===&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x - Installation]]&lt;br /&gt;
&lt;br /&gt;
=== PowerPC ===&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le - Installation]]&lt;br /&gt;
&lt;br /&gt;
== Services == &lt;br /&gt;
&lt;br /&gt;
{{Note| Services are arranged in alphabetical order.}}&lt;br /&gt;
&lt;br /&gt;
=== Content management systems ===&lt;br /&gt;
&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[Moodle]] &#039;&#039;(Online Learning Management system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Database === &lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]] or [[MySQL|MySQL]]&lt;br /&gt;
&lt;br /&gt;
=== DNS ===&lt;br /&gt;
&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[Small-Time DNS with BIND9]] &#039;&#039;(A simple configuration with ad blocking for your home network)&#039;&#039;&lt;br /&gt;
* Unbound&lt;br /&gt;
** [[Setting up unbound DNS server]]&lt;br /&gt;
** [[Using Unbound as an Ad-blocker]] &#039;&#039;(Setup ad blocking for your network)&#039;&#039;&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
&lt;br /&gt;
=== File server ===&lt;br /&gt;
&lt;br /&gt;
* [[Setting up an NFS server|nfs-server]]&lt;br /&gt;
* [[Setting up a Samba server|samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc|samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall and VPN ===&lt;br /&gt;
&lt;br /&gt;
* Alpine Wall &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
** [[Alpine Wall]]&lt;br /&gt;
** [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
** [[How-To Alpine Wall]]&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
* [[IGMPproxy]]&lt;br /&gt;
* [[Setting up a OpenVPN server|OpenVPN server]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[Tor]]&lt;br /&gt;
* [[Uncomplicated Firewall|Uncomplicated Firewall or UFW]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)|Wireguard]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP and web services ===&lt;br /&gt;
&lt;br /&gt;
* [[Althttpd]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Advanced security]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
** [[Nginx with PHP]]&lt;br /&gt;
* Squid Proxy&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
** [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
** [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎|Production LAMP system: Lighttpd + PHP + MariaDB/MySQL‎‎]]&lt;br /&gt;
&lt;br /&gt;
=== IRC ===&lt;br /&gt;
&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
* [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* Exim/Dovecot&lt;br /&gt;
** [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
** [[Setting up dovecot with imap and tls]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
* [[relay email (nullmailer)]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* Server protection&lt;br /&gt;
** [[Setting up clamsmtp]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Logcheck]] &#039;&#039;(log file monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Matomo]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Rasdaemon]] &#039;&#039;(Platform Reliability, Availability and Serviceability monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance; for alpine 3.10-3.12 only)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
** [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
=== Remote Administration ===&lt;br /&gt;
&lt;br /&gt;
* ACF&lt;br /&gt;
** [[Changing passwords for ACF|ACF - changing passwords]]&lt;br /&gt;
** [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
** [[setup-acf| ACF - setup]] &#039;&#039;(Configures ACF (webconfiguration/webmin) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator |OpenSSH 2FA]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
&lt;br /&gt;
* [[FreePBX|FreePBX on Alpine Linux]]&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
&lt;br /&gt;
* [[apcupsd]] &#039;&#039;(UPS Monitoring with apcupsd)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[nut-ups|NUT UPS]] &#039;&#039;(UPS Monitoring with Network UPS Tools)&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
* [[Configure OpenLDAP | OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a LLDAP server|lldap-server]] &#039;&#039;(Directory Server)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software development ==&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java|Oracle Java (installation)]]&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually|Manual partitioning]]&lt;br /&gt;
* [[Disk Replication with DRBD|DRBD: Disk Replication]]&lt;br /&gt;
* [[Filesystems]]&lt;br /&gt;
** [[Burning ISOs]]&lt;br /&gt;
* [[Setting up iSCSI|iSCSI Setup]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
** [[Linux iSCSI Target (TCM)|iSCSI Target (TCM)/LinuxIO (LIO)]]&lt;br /&gt;
** [[Linux iSCSI Target (tgt)|User space iSCSI Target (tgt)]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM|LVM Setup]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks|LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM|LVM on GPT-labeled disks (updated)]]&lt;br /&gt;
** [[LVM on LUKS]]&lt;br /&gt;
* RAID&lt;br /&gt;
** [[Raid Administration]]&lt;br /&gt;
** [[Setting up a software RAID array]]&lt;br /&gt;
* [[ZFS]]&lt;br /&gt;
** [[Root on ZFS with native encryption]]&lt;br /&gt;
** [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[CEPH|CEPH]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Installing Alpine in a virtual machine]]&lt;br /&gt;
** [[Install Alpine on VMware ESXi]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* Xen&lt;br /&gt;
** [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
** [[Xen Dom0 on USB or SD]]&lt;br /&gt;
** [[Create Alpine Linux PV DomU|Xen DomU (paravirtualized)]]&lt;br /&gt;
** [[Xen LiveCD]]&lt;br /&gt;
** [[Xen PCI Passthrough]]&lt;br /&gt;
** [[K8s]] Building a K8s Kubernetes Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* [[TTY_Autologin|TTY Autologin]]&lt;br /&gt;
* [[Kexec|Faster rebooting with kexec]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[ISP Mail Server 3.x HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-service ISP mail server)&#039;&#039;&lt;br /&gt;
* [[Grommunio Mail Server]] &#039;&#039;(Mariadb+Postfix+Rspamd+Grommunio - Full-service mail server as MS exchange replacement)&#039;&#039;&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Install Alpine on a btrfs filesystem with refind as boot manager]]&lt;br /&gt;
* [[Compile software from source|How to Compile a software from source in Alpine Linux]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Althttpd&amp;diff=29682</id>
		<title>Althttpd</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Althttpd&amp;diff=29682"/>
		<updated>2025-04-13T23:10:05Z</updated>

		<summary type="html">&lt;p&gt;Sodface: Created page with &amp;quot;From the [https://sqlite.org/althttpd/doc/trunk/althttpd.md althttpd home page]:   Althttpd is a simple web-server that has run the https://sqlite.org/ website, among others, since 2004. Althttpd strives for simplicity, security, and low resource usage.  == Features ==  * Virtual Hosts * Brotli and GZip content compression * Request URIs sanitized for security * Basic authentication * Client IP blocking * CGI/SCGI support * TLS support * Runs in chroot jail by default *...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;From the [https://sqlite.org/althttpd/doc/trunk/althttpd.md althttpd home page]:&lt;br /&gt;
&lt;br /&gt;
 Althttpd is a simple web-server that has run the https://sqlite.org/ website, among others, since 2004. Althttpd strives for simplicity, security, and low resource usage.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* Virtual Hosts&lt;br /&gt;
* Brotli and GZip content compression&lt;br /&gt;
* Request URIs sanitized for security&lt;br /&gt;
* Basic authentication&lt;br /&gt;
* Client IP blocking&lt;br /&gt;
* CGI/SCGI support&lt;br /&gt;
* TLS support&lt;br /&gt;
* Runs in chroot jail by default&lt;br /&gt;
* Files or directories beginning with . or - are ignored&lt;br /&gt;
* and more ...&lt;br /&gt;
&lt;br /&gt;
== Quick Start ==&lt;br /&gt;
&lt;br /&gt;
 # apk add althttpd&lt;br /&gt;
&lt;br /&gt;
In a working directory, create a test index.html file:&lt;br /&gt;
&lt;br /&gt;
{{Cat|index.html|&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Hello World!&amp;lt;/title&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;Hello, World!&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
From the working directory, start althttpd:&lt;br /&gt;
&lt;br /&gt;
 ~/althttpd-wiki $ althttpd .&lt;br /&gt;
 Listening for HTTP requests on TCP port 8080&lt;br /&gt;
&lt;br /&gt;
Open up your browser and navigate to http://127.0.0.1:8080 and you should see your Hello World! page.&lt;br /&gt;
&lt;br /&gt;
== Running as a Service ==&lt;br /&gt;
&lt;br /&gt;
Install the openrc service scripts:&lt;br /&gt;
 # apk add althttpd-openrc&lt;br /&gt;
&lt;br /&gt;
Review the startup options documented in /etc/conf.d/althttpd and edit $ALTHTTPD_OPTS as required for your environment.&lt;br /&gt;
&lt;br /&gt;
Use the rc-service command as usual to start|stop|restart althttpd:&lt;br /&gt;
 # rc-service althttpd start&lt;br /&gt;
 # rc-service althttpd restart&lt;br /&gt;
 # rc-service althttpd stop&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
The [https://sqlite.org/althttpd/doc/trunk/althttpd.md althttpd home page]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Desktop_environments_and_Window_managers&amp;diff=28592</id>
		<title>Desktop environments and Window managers</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Desktop_environments_and_Window_managers&amp;diff=28592"/>
		<updated>2024-12-29T13:47:37Z</updated>

		<summary type="html">&lt;p&gt;Sodface: fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- COMMENT FOR EDITORS&lt;br /&gt;
Do not add any content about specific desktop environment or window manager in this page. Please add all the content to the respective wiki pages. If wiki page does not exist for the specific window manage, please create and add the content.&lt;br /&gt;
&lt;br /&gt;
This page lists only the window managers and desktop environments for which packages are available in Alpine Linux. Do not add unsupported software here&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine Linux&#039;&#039;&#039; has no official desktop and setting up a graphical environment is not even part of [[Installation]]. All window managers and desktop environments that are available in Alpine Linux are listed in this page. Quick installation using [[Alpine_setup_scripts#setup-desktop|setup-desktop]] script is available for few [[Setup-desktop|desktops]]. For servers consider [[Alpine_Configuration_Framework_Design#Starting_ACF|Alpine Configuration Framework(ACF)]].&lt;br /&gt;
&lt;br /&gt;
== Desktop Environments ==&lt;br /&gt;
&lt;br /&gt;
* [[Xfce]]&lt;br /&gt;
* [[LXQt]]&lt;br /&gt;
* [[KDE|KDE Plasma]]&lt;br /&gt;
* [[GNOME]]&lt;br /&gt;
* [[MATE]]&lt;br /&gt;
&lt;br /&gt;
== Window Managers ==&lt;br /&gt;
&lt;br /&gt;
===  [https://en.wikipedia.org/wiki/Stacking_window_manager Stacking window managers] ===&lt;br /&gt;
(also known as &#039;&#039;&#039;floating window managers&#039;&#039;&#039;)&lt;br /&gt;
* X11:&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
** [[Fluxbox]]&lt;br /&gt;
&lt;br /&gt;
* Wayland:&lt;br /&gt;
** [[Weston]]&lt;br /&gt;
** [[LabWC]]&lt;br /&gt;
**  {{Pkg|wayfire|arch=}}&lt;br /&gt;
&lt;br /&gt;
=== [https://en.wikipedia.org/wiki/Tiling_window_manager Tiling window managers] ===&lt;br /&gt;
(also known as &#039;&#039;&#039;Dynamic window managers&#039;&#039;&#039;)&lt;br /&gt;
* X11:&lt;br /&gt;
** {{Pkg|bspwm|arch=}}&lt;br /&gt;
** {{Pkg|herbstluftwm|arch=}}&lt;br /&gt;
** [[twm]]&lt;br /&gt;
** [[dwm]]&lt;br /&gt;
** [[I3wm|i3]]&lt;br /&gt;
** [[AwesomeWM|Awesome]]&lt;br /&gt;
** {{Pkg|ratpoison|arch=}} &lt;br /&gt;
** {{Pkg|spectrwm |arch=}} &lt;br /&gt;
** {{Pkg|qtile |arch=}}  &lt;br /&gt;
&lt;br /&gt;
* Wayland:&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
** [[River]]&lt;br /&gt;
** {{Pkg|cagebreak|arch=}} &lt;br /&gt;
** {{Pkg|dwl|arch=}} &lt;br /&gt;
** [[Hyprland]]&lt;br /&gt;
&lt;br /&gt;
=== Other Window Managers ===&lt;br /&gt;
&lt;br /&gt;
* Wayland&lt;br /&gt;
** {{Pkg|cage |arch=}} (&#039;&#039;&#039;kiosk&#039;&#039;&#039; mode)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[:Category:Desktop Environments|Desktop Environments]]&lt;br /&gt;
* [[:Category:Window Managers|Window Managers]]&lt;br /&gt;
* [[Installation#Post-Installation|Post Installation]]&lt;br /&gt;
* [[Seat_manager#Input_and_video_groups|Input and video groups]]&lt;br /&gt;
* [[Fonts]]&lt;br /&gt;
* [[Wayland]]&lt;br /&gt;
* [[Xorg]]&lt;br /&gt;
* [[Display manager]]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Desktop_environment Desktop environment - Archwiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Desktop_environment Desktop environment - Gentoo Wiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Desktop Environments]]&lt;br /&gt;
[[Category:Window Managers]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25854</id>
		<title>Release Notes for Alpine 3.19.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25854"/>
		<updated>2023-12-05T12:26:30Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Raspberry pi */ Point removed package links at v3.18 instead of edge&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== iptables-nft ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/sbin/iptables{,-save,-restore}&amp;lt;/code&amp;gt; symlinks now point to xtables-nft-multi instead of xtables-legacy-multi. This means they use the nftables kernel backend instead of the legacy iptables one.&lt;br /&gt;
&lt;br /&gt;
Since the new iptables- binaries also don&#039;t use the iptables backend, to work with any existing rules and save them, you need to install {{pkg|iptables-legacy}} and use &amp;lt;code&amp;gt;iptables-legacy-save&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because mixing backends is not supported, you should reboot your system if you have to use the iptables commands after upgrading.&lt;br /&gt;
&lt;br /&gt;
=== netns ===&lt;br /&gt;
&lt;br /&gt;
The OpenRC package contains a patch to make it possible to start most services in netns namespaces. See also [[Netns|netns]].&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== HashiCorp packages ===&lt;br /&gt;
&lt;br /&gt;
Due to [https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license the relicensing of HashiCorp software] to [https://spdx.org/licenses/BUSL-1.1.html BUSL-1.1], a non-Open-Source license, the following software have been removed from Alpine:&lt;br /&gt;
&lt;br /&gt;
* Consul&lt;br /&gt;
* Nomad&lt;br /&gt;
* Packer&lt;br /&gt;
* Terraform&lt;br /&gt;
* Vault&lt;br /&gt;
&lt;br /&gt;
Our discussion on the topic can be found [https://gitlab.alpinelinux.org/alpine/aports/-/issues/15193 here].&lt;br /&gt;
&lt;br /&gt;
{{pkg|opentofu}}, a fork of Terraform, is available in our testing repository for users of our rolling release, edge.&lt;br /&gt;
&lt;br /&gt;
=== Java 21 ===&lt;br /&gt;
&lt;br /&gt;
The latest LTS java release, openjdk21,  is now available in the community repository.&lt;br /&gt;
&lt;br /&gt;
=== KDE ===&lt;br /&gt;
&lt;br /&gt;
KDE Applications have been upgraded from 23.04.x to 23.08.x. KDE Frameworks have been upgraded from 5.105.0 to 5.112.0.&lt;br /&gt;
Note that the KDE Frameworks packages have been renamed to add a 5 suffix in preparation for the upcoming KDE 6 release in the next Alpine release. Everything should automatically be upgraded properly but if problems occur make sure to check if the right renamed packages are installed.&lt;br /&gt;
&lt;br /&gt;
=== Yggdrasil v0.5 ===&lt;br /&gt;
&lt;br /&gt;
{{pkg|yggdrasil}} was upgraded to 0.5.x and the new routing scheme is incompatible with previous versions. &amp;quot;Nodes running this new version &#039;&#039;&#039;will not&#039;&#039;&#039; be able to peer with earlier versions of Yggdrasil&amp;quot; ([https://github.com/yggdrasil-network/yggdrasil-go/releases/tag/v0.5.0 v0.5.0 release notes], [https://yggdrasil-network.github.io/2023/10/22/upcoming-v05-release.html v0.5 blog post]).&lt;br /&gt;
&lt;br /&gt;
== Upgrades ==&lt;br /&gt;
&lt;br /&gt;
* GCC 13&lt;br /&gt;
* LLVM 17&lt;br /&gt;
* Kea 2.4&lt;br /&gt;
* Xen 4.18&lt;br /&gt;
* Git 2.43&lt;br /&gt;
* Perl 5.38&lt;br /&gt;
* PHP 8.3&lt;br /&gt;
* PostgreSQL 16&lt;br /&gt;
* SQLite 3.44&lt;br /&gt;
* Redis 7.2&lt;br /&gt;
* Node.js (lts) 20.10&lt;br /&gt;
* Node.js (current) 21.3&lt;br /&gt;
* QEMU 8.1&lt;br /&gt;
* Ceph 18.2&lt;br /&gt;
* GNOME 45&lt;br /&gt;
* LXQt 1.4&lt;br /&gt;
* wlroots 0.17&lt;br /&gt;
* Go 1.21&lt;br /&gt;
* Rust 1.72&lt;br /&gt;
* Crystal 1.10&lt;br /&gt;
* Racket 8.11&lt;br /&gt;
* ECL 23.9.9&lt;br /&gt;
* Erlang 26&lt;br /&gt;
* zlib 1.3&lt;br /&gt;
* libsodium 1.0.19&lt;br /&gt;
* ICU 74.1&lt;br /&gt;
* Protobuf 24.4&lt;br /&gt;
* fmt 10&lt;br /&gt;
* PipeWire 1.0.0&lt;br /&gt;
&lt;br /&gt;
== Raspberry pi ==&lt;br /&gt;
&lt;br /&gt;
The [https://pkgs.alpinelinux.org/packages?name=linux-rpi&amp;amp;branch=edge linux-rpi] has been simplified. There is now a single kernel flavor for each architecture. This means that the kernels [https://pkgs.alpinelinux.org/packages?name=linux-rpi2&amp;amp;branch=v3.18 linux-rpi2] and [https://pkgs.alpinelinux.org/packages?name=linux-rpi4&amp;amp;branch=v3.18 linux-rpi4] are replaced with [https://pkgs.alpinelinux.org/packages?name=linux-rpi&amp;amp;branch=edge linux-rpi]. The {{Path|config.txt}} is now generated by [https://pkgs.alpinelinux.org/packages?name=raspberrypi-bootloader&amp;amp;branch=edge raspberrypi-bootloader].&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25853</id>
		<title>Release Notes for Alpine 3.19.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.19.0&amp;diff=25853"/>
		<updated>2023-12-05T12:23:04Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Raspberry pi */  Fix links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Base System ==&lt;br /&gt;
&lt;br /&gt;
=== iptables-nft ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/sbin/iptables{,-save,-restore}&amp;lt;/code&amp;gt; symlinks now point to xtables-nft-multi instead of xtables-legacy-multi. This means they use the nftables kernel backend instead of the legacy iptables one.&lt;br /&gt;
&lt;br /&gt;
Since the new iptables- binaries also don&#039;t use the iptables backend, to work with any existing rules and save them, you need to install {{pkg|iptables-legacy}} and use &amp;lt;code&amp;gt;iptables-legacy-save&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because mixing backends is not supported, you should reboot your system if you have to use the iptables commands after upgrading.&lt;br /&gt;
&lt;br /&gt;
=== netns ===&lt;br /&gt;
&lt;br /&gt;
The OpenRC package contains a patch to make it possible to start most services in netns namespaces. See also [[Netns|netns]].&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
&lt;br /&gt;
=== HashiCorp packages ===&lt;br /&gt;
&lt;br /&gt;
Due to [https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license the relicensing of HashiCorp software] to [https://spdx.org/licenses/BUSL-1.1.html BUSL-1.1], a non-Open-Source license, the following software have been removed from Alpine:&lt;br /&gt;
&lt;br /&gt;
* Consul&lt;br /&gt;
* Nomad&lt;br /&gt;
* Packer&lt;br /&gt;
* Terraform&lt;br /&gt;
* Vault&lt;br /&gt;
&lt;br /&gt;
Our discussion on the topic can be found [https://gitlab.alpinelinux.org/alpine/aports/-/issues/15193 here].&lt;br /&gt;
&lt;br /&gt;
{{pkg|opentofu}}, a fork of Terraform, is available in our testing repository for users of our rolling release, edge.&lt;br /&gt;
&lt;br /&gt;
=== Java 21 ===&lt;br /&gt;
&lt;br /&gt;
The latest LTS java release, openjdk21,  is now available in the community repository.&lt;br /&gt;
&lt;br /&gt;
=== KDE ===&lt;br /&gt;
&lt;br /&gt;
KDE Applications have been upgraded from 23.04.x to 23.08.x. KDE Frameworks have been upgraded from 5.105.0 to 5.112.0.&lt;br /&gt;
Note that the KDE Frameworks packages have been renamed to add a 5 suffix in preparation for the upcoming KDE 6 release in the next Alpine release. Everything should automatically be upgraded properly but if problems occur make sure to check if the right renamed packages are installed.&lt;br /&gt;
&lt;br /&gt;
=== Yggdrasil v0.5 ===&lt;br /&gt;
&lt;br /&gt;
{{pkg|yggdrasil}} was upgraded to 0.5.x and the new routing scheme is incompatible with previous versions. &amp;quot;Nodes running this new version &#039;&#039;&#039;will not&#039;&#039;&#039; be able to peer with earlier versions of Yggdrasil&amp;quot; ([https://github.com/yggdrasil-network/yggdrasil-go/releases/tag/v0.5.0 v0.5.0 release notes], [https://yggdrasil-network.github.io/2023/10/22/upcoming-v05-release.html v0.5 blog post]).&lt;br /&gt;
&lt;br /&gt;
== Upgrades ==&lt;br /&gt;
&lt;br /&gt;
* GCC 13&lt;br /&gt;
* LLVM 17&lt;br /&gt;
* Kea 2.4&lt;br /&gt;
* Xen 4.18&lt;br /&gt;
* Git 2.43&lt;br /&gt;
* Perl 5.38&lt;br /&gt;
* PHP 8.3&lt;br /&gt;
* PostgreSQL 16&lt;br /&gt;
* SQLite 3.44&lt;br /&gt;
* Redis 7.2&lt;br /&gt;
* Node.js (lts) 20.10&lt;br /&gt;
* Node.js (current) 21.3&lt;br /&gt;
* QEMU 8.1&lt;br /&gt;
* Ceph 18.2&lt;br /&gt;
* GNOME 45&lt;br /&gt;
* LXQt 1.4&lt;br /&gt;
* wlroots 0.17&lt;br /&gt;
* Go 1.21&lt;br /&gt;
* Rust 1.72&lt;br /&gt;
* Crystal 1.10&lt;br /&gt;
* Racket 8.11&lt;br /&gt;
* ECL 23.9.9&lt;br /&gt;
* Erlang 26&lt;br /&gt;
* zlib 1.3&lt;br /&gt;
* libsodium 1.0.19&lt;br /&gt;
* ICU 74.1&lt;br /&gt;
* Protobuf 24.4&lt;br /&gt;
* fmt 10&lt;br /&gt;
* PipeWire 1.0.0&lt;br /&gt;
&lt;br /&gt;
== Raspberry pi ==&lt;br /&gt;
&lt;br /&gt;
The [https://pkgs.alpinelinux.org/packages?name=linux-rpi&amp;amp;branch=edge linux-rpi] has been simplified. There is now a single kernel flavor for each architecture. This means that the kernels [https://pkgs.alpinelinux.org/packages?name=linux-rpi2&amp;amp;branch=edge linux-rpi2] and [https://pkgs.alpinelinux.org/packages?name=linux-rpi4&amp;amp;branch=edge linux-rpi4] are replaced with [https://pkgs.alpinelinux.org/packages?name=linux-rpi&amp;amp;branch=edge linux-rpi]. The {{Path|config.txt}} is now generated by [https://pkgs.alpinelinux.org/packages?name=raspberrypi-bootloader&amp;amp;branch=edge raspberrypi-bootloader].&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_set_up_Alpine_as_a_wireless_router&amp;diff=22087</id>
		<title>How to set up Alpine as a wireless router</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_set_up_Alpine_as_a_wireless_router&amp;diff=22087"/>
		<updated>2022-07-12T22:32:46Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Pi Specific */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Pi Zero W Wireless Router ===&lt;br /&gt;
&lt;br /&gt;
This page describes building a Wireless Access Point with two wired ethernet ports for building a home router that connects to the internet with one wired port, and an internal LAN with the second wired port and the on-board WiFi.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The intent is to provide this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                                    |&amp;lt;--&amp;gt;eth1 &amp;lt;--&amp;gt;| &lt;br /&gt;
Internet &amp;lt;--&amp;gt; eth0 &amp;lt;--&amp;gt;FireWall&amp;lt;--&amp;gt;br0           Internal&amp;lt;--&amp;gt; ssh,bind,dhcp, with ssh reverse ssh connections.&lt;br /&gt;
                                    |&amp;lt;--&amp;gt;wlan0&amp;lt;--&amp;gt;|&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
I generally run Debian and  when forced by Red Hot Irons, Red Hat. This is my first foray into Alpine. So far I am very impressed. I mirrored the 3.12 armhf repos so I had things local when I needed them. Word to the wise, it comprises 13 GB of apk files.&amp;lt;br&amp;gt;&lt;br /&gt;
One *really* nice feature of Alpine is apk, the yum/apt replacement:&amp;lt;br&amp;gt;&lt;br /&gt;
* It is simple and to the point.&lt;br /&gt;
* The same tool provides *repo* level dependency reporting!&lt;br /&gt;
* Install of single packages without repo signing (I never did get the signing correct, but I can install).&lt;br /&gt;
&lt;br /&gt;
=== Prepare ===&lt;br /&gt;
* Obtain a microSD card (or HDD) you can wipe the data from. We will assume it is /dev/sdc.&lt;br /&gt;
* Make a 256M FAT16 partition (sudo mkfs.vfat -n ALPBOOT /dev/sdc1)&lt;br /&gt;
* The rest of the device can be ext2 (ext3/4 on HDD) (sudo mke2fs -m1 -L alext3 /dev/sdc2).&lt;br /&gt;
* Untar the alpine-rpi-3.12.3-armhf.tar.gz and copy all of the files to the fat16 partition which can be as large as 2G. &lt;br /&gt;
* Make sure you have all the packages from the package list below installed on the SD card. This will save you lots of time.&lt;br /&gt;
* Add this to usercfg.txt at the root of the FAT16 partition:&lt;br /&gt;
  enable_uart=1&lt;br /&gt;
  gpu_mem=16&lt;br /&gt;
  dtparam=audio=off&lt;br /&gt;
* This is the contents of cmdline.txt:&lt;br /&gt;
  modules=loop,squashfs,sd-mod,usb-storage console=tty1 console=ttyAMA0,115200&lt;br /&gt;
&lt;br /&gt;
=== First Boot ===&lt;br /&gt;
* Put the SD into the pi zero&lt;br /&gt;
* Connect the serial port&lt;br /&gt;
* Run minicom with the parameters set to 115200,n,8,1, no flow control.&lt;br /&gt;
* Power up the Pi.&lt;br /&gt;
&lt;br /&gt;
=== Copy Root ===&lt;br /&gt;
* mkdir /stage&lt;br /&gt;
* mount /dev/sda2 /stage&lt;br /&gt;
* for d in $(ls -1 /|grep -v &#039;media\|stage\|dev\|proc\|sys&#039;); do cp -a /$d /stage; done&lt;br /&gt;
* modules are loop mounted to /.modloop, and lib/modules is symlinked to that, so&lt;br /&gt;
* rm /stage/lib/modules&lt;br /&gt;
* cp -a /.modloop /stage/lib/modules&lt;br /&gt;
* Fix cmdline.txt&lt;br /&gt;
  mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
  echo &#039;root=/dev/mmcblk0p2&#039; &amp;gt;&amp;gt; /media/mmcblk0p1/cmdline.txt&lt;br /&gt;
* reboot&lt;br /&gt;
&lt;br /&gt;
=== Install ===&lt;br /&gt;
* verify you are now operating from the ext2 filesystem where you copied the rootfs.&lt;br /&gt;
* install openssh, openssh-server, openssh-client, openssh-server-common,&lt;br /&gt;
* install dnsmasq, ethtool, hostapd*, busybox extras, iptables*, iw,net-tools, tree, wireless-tools.&lt;br /&gt;
* edit all the configurations supplied here.&lt;br /&gt;
&lt;br /&gt;
===== ssh config =====&lt;br /&gt;
The allowed users are not normal names since I want the names to be a little obfuscated. Not that it really matters, since this is a key driven setup&amp;lt;br&amp;gt;&lt;br /&gt;
AddressFamily inet&amp;lt;br&amp;gt;&lt;br /&gt;
ListenAddress 0.0.0.0&amp;lt;br&amp;gt;&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&amp;lt;br&amp;gt;&lt;br /&gt;
LogLevel INFO&amp;lt;br&amp;gt;&lt;br /&gt;
LoginGraceTime 30&amp;lt;br&amp;gt;&lt;br /&gt;
PermitRootLogin no&amp;lt;br&amp;gt;&lt;br /&gt;
StrictModes yes&amp;lt;br&amp;gt;&lt;br /&gt;
AllowUsers Som123X Extern4524User&amp;lt;br&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&amp;lt;br&amp;gt;&lt;br /&gt;
AuthorizedKeysFile	/etc/ssh/authorized_keys&amp;lt;br&amp;gt;&lt;br /&gt;
HostbasedAuthentication yes&amp;lt;br&amp;gt;&lt;br /&gt;
IgnoreUserKnownHosts yes&amp;lt;br&amp;gt;&lt;br /&gt;
IgnoreRhosts yes&amp;lt;br&amp;gt;&lt;br /&gt;
PasswordAuthentication no&amp;lt;br&amp;gt;&lt;br /&gt;
ChallengeResponseAuthentication no&amp;lt;br&amp;gt;&lt;br /&gt;
AllowTcpForwarding yes&amp;lt;br&amp;gt;&lt;br /&gt;
GatewayPorts yes&amp;lt;br&amp;gt;&lt;br /&gt;
X11Forwarding no&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== dnsmasq.conf =====&lt;br /&gt;
/etc/dnsmasq.conf&amp;lt;br&amp;gt;&lt;br /&gt;
This has two subnets. One for normal dhcp, the other for pseudo static - dhcp provided by MAC. One example here.&amp;lt;br&amp;gt;&lt;br /&gt;
interface=br0&amp;lt;br&amp;gt;&lt;br /&gt;
except-interface=eth0&amp;lt;br&amp;gt;&lt;br /&gt;
dhcp-range=subnet0,192.168.0.10,192.168.0.100,255.255.255.0,24h&amp;lt;br&amp;gt;&lt;br /&gt;
dhcp-range=subnet1,192.168.0.4,192.168.0.6,255.255.255.0,24h&amp;lt;br&amp;gt;&lt;br /&gt;
bind-interfaces&amp;lt;br&amp;gt;&lt;br /&gt;
#log-queries&amp;lt;br&amp;gt;&lt;br /&gt;
#log-dhcp&amp;lt;br&amp;gt;&lt;br /&gt;
dhcp-host=70:85:66:c4:48:55,192.168.0.4,nas&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== /etc/hosts =====&lt;br /&gt;
dnsmasq provides DNS answers from the hosts file. Nice. &amp;lt;br&amp;gt;&lt;br /&gt;
127.0.0.1	localhost localhost.localdomain&amp;lt;br&amp;gt;&lt;br /&gt;
::1		localhost localhost.localdomain&amp;lt;br&amp;gt;&lt;br /&gt;
192.168.0.3     wireless&amp;lt;br&amp;gt;&lt;br /&gt;
192.168.0.4     nas&amp;lt;br&amp;gt;&lt;br /&gt;
192.168.0.5     mpd&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== hostapd.conf =====&lt;br /&gt;
/etc/hostapd/hostapd.conf&amp;lt;br&amp;gt;&lt;br /&gt;
interface=wlan0&amp;lt;br&amp;gt;&lt;br /&gt;
bridge=br0&amp;lt;br&amp;gt;&lt;br /&gt;
hw_mode=g&amp;lt;br&amp;gt;&lt;br /&gt;
channel=7&amp;lt;br&amp;gt;&lt;br /&gt;
wmm_enabled=0&amp;lt;br&amp;gt;&lt;br /&gt;
macaddr_acl=0&amp;lt;br&amp;gt;&lt;br /&gt;
auth_algs=1&amp;lt;br&amp;gt;&lt;br /&gt;
ignore_broadcast_ssid=0&amp;lt;br&amp;gt;&lt;br /&gt;
wpa=2&amp;lt;br&amp;gt;&lt;br /&gt;
wpa_key_mgmt=WPA-PSK&amp;lt;br&amp;gt;&lt;br /&gt;
wpa_pairwise=TKIP&amp;lt;br&amp;gt;&lt;br /&gt;
rsn_pairwise=CCMP&amp;lt;br&amp;gt;&lt;br /&gt;
ssid=Whatever&amp;lt;br&amp;gt;&lt;br /&gt;
wpa_passphrase=YouMakeItUp&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== interfaces =====&lt;br /&gt;
/etc/network/interfaces&amp;lt;br&amp;gt;&lt;br /&gt;
auto lo&amp;lt;br&amp;gt;&lt;br /&gt;
iface lo inet loopback&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
auto eth0&amp;lt;br&amp;gt;&lt;br /&gt;
iface eth0 inet dhcp&amp;lt;br&amp;gt;&lt;br /&gt;
        hostname ANYNAME&amp;lt;br&amp;gt;&lt;br /&gt;
        hwaddress ether FE:ED:BE:EF:33:DD&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
iface eth1 inet manual&amp;lt;br&amp;gt;&lt;br /&gt;
iface wlan0 inet manual&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
auto br0&amp;lt;br&amp;gt;&lt;br /&gt;
iface br0 inet static&amp;lt;br&amp;gt;&lt;br /&gt;
        pre-up ifconfig eth1 up&amp;lt;br&amp;gt;&lt;br /&gt;
        bridge-ports eth1 wlan0&amp;lt;br&amp;gt;&lt;br /&gt;
        bridge-stp off&amp;lt;br&amp;gt;&lt;br /&gt;
        address 192.168.0.3&amp;lt;br&amp;gt;&lt;br /&gt;
        broadcaset 192.168.1.255&amp;lt;br&amp;gt;&lt;br /&gt;
        netmask 255.255.255.0&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Permissive iptables =====&lt;br /&gt;
Do NOT use this connected to the internet! There is NO protection.&amp;lt;br&amp;gt;&lt;br /&gt;
This is my stopopen in my replacement iptables&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -P INPUT ACCEPT&amp;lt;br&amp;gt;&amp;lt;&lt;br /&gt;
iptables -F INPUT&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -P OUTPUT ACCEPT&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -F OUTPUT&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -P FORWARD ACCEPT&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -F FORWARD&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -F -t nat&amp;lt;br&amp;gt;&lt;br /&gt;
iptables -F&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
apk notes:&lt;br /&gt;
&lt;br /&gt;
* Create, index and check dependencies on a list of apk files: apk index -o APKINDEX.unsigned.tar.gz *.apk&lt;br /&gt;
* Install a package: apk add iw OR apk add /path/to/iw-5.4-r0.apk&lt;br /&gt;
* remove a package: apk del iw&lt;br /&gt;
* repository lists are in: /etc/apk/repositories&lt;br /&gt;
  * Local URL: /media/mmcblk0p1/apks&lt;br /&gt;
  * Remote URL: http://dl-cdn.alpinelinux.org/alpine/v3.12/main&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/File_Allocation_Table FAT16/32 limits]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://udhcp.busybox.net/README.udhcpc udhcpc]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://linux.die.net/man/8/ez-ipupdate ez-ipupdate]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Alpine_Linux:FAQ#Dynamic_DNS|Dynamic_DNS]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Bridge|Alpine Linux Bridge]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Connecting_to_a_wireless_access_point|Connect to wireless AP]]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://unix.stackexchange.com/questions/222264/how-do-i-limit-dnsmasq-listening-to-only-one-interface dnsmasq listen restrictions]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://wiki.archlinux.org/index.php/IPv6#Disable_IPv6 Disable IPV6]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://github.com/imp/dnsmasq/blob/master/dnsmasq.conf.example dnsmasq Docs]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://man.openbsd.org/hostapd.conf.5 HostApd Docs]&amp;lt;br&amp;gt;&lt;br /&gt;
[rsync://rsync.alpinelinux.org/alpine Alpine Repos]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://stevessmarthomeguide.com/home-network-dns-dnsmasq Set Static DNS names]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://unix.stackexchange.com/questions/504100/how-to-create-ssh-reverse-tunnel-with-iptables-forwarding Reverse SSH tunnel]&amp;lt;br&amp;gt;&lt;br /&gt;
===== Pi Specific =====&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/89803/access-point-as-wifi-router-repeater-optional-with-bridge/89804 Pi Wifi Repeater]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://raspberrypi.stackexchange.com/questions/81486/raspberry-pi-wifi-to-ethernet-bridge-for-a-server/81518 WiFi Bridge]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Raspberry_Pi|Alpine Install]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Classic_install_or_sys_mode_on_Raspberry_Pi|Classic Sys Install on Pi]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Not Related, but Interesting ====&lt;br /&gt;
[https://blog.thewalr.us/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi AP and Managed Mode]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.instructables.com/Using-a-Raspberry-PI-Zero-W-As-an-Access-Point-and AP and MQTT]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Package List ====&lt;br /&gt;
Put these in the apks/armhf directory on the 256M Fat partition:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iptables-1.8.4-r2.apk                       openssh-8.3_p1-r1.apk&lt;br /&gt;
iptables-openrc-1.8.4-r2.apk                openssh-client-8.3_p1-r1.apk&lt;br /&gt;
abuild-3.6.0-r1.apk                         iw-5.4-r0.apk                               openssh-keygen-8.3_p1-r1.apk&lt;br /&gt;
alpine-base-3.12.3-r0.apk                   kbd-bkeymaps-2.2.0-r2.apk                   openssh-server-8.3_p1-r1.apk&lt;br /&gt;
alpine-baselayout-3.2.0-r7.apk              libacl-2.2.53-r0.apk                        openssh-server-common-8.3_p1-r1.apk&lt;br /&gt;
alpine-conf-3.9.0-r1.apk                    libattr-2.4.48-r0.apk                       openssh-sftp-server-8.3_p1-r1.apk&lt;br /&gt;
alpine-keys-2.2-r0.apk                      libblkid-2.35.2-r0.apk                      openssl-1.1.1i-r0.apk&lt;br /&gt;
alpine-mirrors-3.5.10-r0.apk                libc-utils-0.7.2-r3.apk                     patch-2.7.6-r6.apk&lt;br /&gt;
apk-tools-2.10.5-r1.apk                     libcap-2.27-r0.apk                          pcsc-lite-libs-1.8.26-r0.apk&lt;br /&gt;
attr-2.4.48-r0.apk                          libcom_err-1.45.6-r0.apk                    pkgconf-1.7.2-r0.apk&lt;br /&gt;
bash-5.0.17-r0.apk                          libcrypto1.1-1.1.1i-r0.apk                  ppp-atm-2.4.8-r2.apk&lt;br /&gt;
bash-completion-2.10-r0.apk                 libcurl-7.69.1-r3.apk                       ppp-chat-2.4.8-r2.apk&lt;br /&gt;
bonding-2.6-r4.apk                          libedit-20191231.3.1-r0.apk                 ppp-daemon-2.4.8-r2.apk&lt;br /&gt;
bridge-1.5-r4.apk                           libev-4.33-r0.apk                           ppp-l2tp-2.4.8-r2.apk&lt;br /&gt;
bridge-utils-1.6-r0.apk                     libgcc-9.3.0-r2.apk                         ppp-minconn-2.4.8-r2.apk&lt;br /&gt;
busybox-1.31.1-r19.apk                      libmnl-1.0.4-r0.apk                         ppp-passprompt-2.4.8-r2.apk&lt;br /&gt;
busybox-extras-1.31.1-r19.apk               libnftnl-1.1.6-r0.apk                       ppp-passwordfd-2.4.8-r2.apk&lt;br /&gt;
busybox-initscripts-3.2-r2.apk              libnftnl-libs-1.1.6-r0.apk                  ppp-pppoe-2.4.8-r2.apk&lt;br /&gt;
busybox-suid-1.31.1-r19.apk                 libnl3-3.5.0-r0.apk                         ppp-radius-2.4.8-r2.apk&lt;br /&gt;
c-ares-1.16.1-r0.apk                        libpcap-1.9.1-r2.apk                        ppp-winbind-2.4.8-r2.apk&lt;br /&gt;
ca-certificates-20191127-r4.apk             libssl1.1-1.1.1i-r0.apk                     readline-8.0.4-r0.apk&lt;br /&gt;
ca-certificates-bundle-20191127-r4.apk      libstdc++-9.3.0-r2.apk                      scanelf-1.2.6-r0.apk&lt;br /&gt;
chrony-3.5.1-r0.apk                         libtls-standalone-2.9.1-r1.apk              signature.tar.gz&lt;br /&gt;
chrony-openrc-3.5.1-r0.apk                  libusb-1.0.23-r0.apk                        ssl_client-1.31.1-r19.apk&lt;br /&gt;
curl-7.69.1-r3.apk                          libuuid-2.35.2-r0.apk                       tar-1.32-r1.apk&lt;br /&gt;
dbus-libs-1.12.18-r0.apk                    lzip-1.21-r0.apk                            tcpdump-4.9.3-r2.apk&lt;br /&gt;
dnsmasq-2.81-r0.apk                         mii-tool-1.60_git20140218-r2.apk            tree-1.8.0-r0.apk&lt;br /&gt;
e2fsprogs-1.45.6-r0.apk                     musl-1.1.24-r10.apk                         tzdata-2020c-r1.apk&lt;br /&gt;
e2fsprogs-libs-1.45.6-r0.apk                musl-utils-1.1.24-r10.apk                   usb-modeswitch-2.6.0-r1.apk&lt;br /&gt;
ethtool-5.6-r0.apk                          ncurses-libs-6.2_p20200523-r0.apk           vlan-2.2-r0.apk&lt;br /&gt;
ez-ipupdate-3.0.10-r9.apk                   ncurses-terminfo-base-6.2_p20200523-r0.apk  wireless-tools-30_pre9-r1.apk&lt;br /&gt;
fakeroot-1.24-r0.apk                        net-tools-1.60_git20140218-r2.apk           wpa_supplicant-2.9-r5.apk&lt;br /&gt;
haveged-1.9.8-r1.apk                        network-extras-1.2-r0.apk                   wpa_supplicant-openrc-2.9-r5.apk&lt;br /&gt;
haveged-openrc-1.9.8-r1.apk                 nghttp2-1.41.0-r0.apk                       zlib-1.2.11-r3.apk&lt;br /&gt;
hostapd-2.9-r2.apk                          nghttp2-libs-1.41.0-r0.apk&lt;br /&gt;
hostapd-openrc-2.9-r2.apk                   openrc-0.42.1-r11.apk&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22086</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22086"/>
		<updated>2022-07-12T22:30:07Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Raspberry Pi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material needs to be re-organized .. as &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039; both need to be reordered as independent sections }}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
=== Postinstall ===&lt;br /&gt;
&lt;br /&gt;
==== Developers: compilers, IDEs and tools ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
** [[Alpine newbie developer: gitea|Alpine newbie developer: Git management web frontend gitea]]&lt;br /&gt;
** [[Alpine newbie developer: full stack web]]&lt;br /&gt;
&lt;br /&gt;
==== Servers: deploy in production ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
** [[Production DataBases : mysql|Production database: MySql]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
* Kubernetes&lt;br /&gt;
** [[K8s]] Building a K8s Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Raid Administration]]&lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up LVM on LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[Setting up NBD]]&lt;br /&gt;
* [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[Setting up ZFS with native encryption]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Partitioning and Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using SSH is the preferred way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[How to set up Alpine as a wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Seafile: setting up your own private cloud]]&lt;br /&gt;
&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Install|Post install]]&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Repositories#Enabling_the_community_repository|Enabling the community repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
&amp;lt;!-- Obsolete?&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java]]&lt;br /&gt;
* [[Rsnapshot|Setting up periodic backups with &amp;lt;samp&amp;gt;rsnapshot&amp;lt;/samp&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization==&lt;br /&gt;
&lt;br /&gt;
* [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
* [[Xen Dom0 on USB or SD]]&lt;br /&gt;
* [[Create Alpine Linux PV DomU]]&lt;br /&gt;
* [[Xen PCI Passthrough]]&lt;br /&gt;
* [[Xen LiveCD]]&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Install Alpine on VirtualBox]]&lt;br /&gt;
* [[Install Alpine on VMWare]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[Desktop environments and Window managers]] (overall information only)&lt;br /&gt;
** [[Xfce]]&lt;br /&gt;
** [[LXQt]]&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
** [[MATE]]&lt;br /&gt;
** [[Fluxbox (spanish)]]&lt;br /&gt;
** [[AwesomeWM]]&lt;br /&gt;
** [[dwm]]&lt;br /&gt;
** [[Gnome]]&lt;br /&gt;
** [[KDE]]&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
** [[River]]&lt;br /&gt;
* [[Alpine and UEFI|Alpine and UEFI Support Status and related topics]]&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Sound Setup]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi (Installation)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]]&lt;br /&gt;
* [[RPI Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker]]&lt;br /&gt;
&lt;br /&gt;
== PowerPC ==&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== IBM Z (IBM z Systems) ==&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server 3.x HowTo]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx_with_PHP#Nginx_with_PHP|Nginx with PHP]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Configure OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a nfs-server]]&lt;br /&gt;
* [[Setting up a samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_developer: gitea|Setting up Git management web frontend gitea]]&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[How To Setup Your Own IRC Network]] &#039;&#039;(Using {{Pkg|charybdis}} and {{Pkg|atheme-iris}})&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
* [[IPTV How To|Internet Protocol television (IPTV)]]&lt;br /&gt;
* [[UniFi_Controller]]&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* Setting up [[collectd]]&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[LTTng]] &#039;&#039;(Kernel and userspace tracing)&#039;&#039;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
* [[Kernel Modesetting]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [https://codeberg.org/AVG7/alpine-sway-x86_64 DIY Live-USB-Stick with Sway] &lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
* [[Building a cloud with Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small_Office_Services]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Newbies ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie]] (for overall information in funny sections)&lt;br /&gt;
&lt;br /&gt;
[[Category:System_Administration]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Zero_W_-_Installation&amp;diff=22085</id>
		<title>Raspberry Pi Zero W - Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Zero_W_-_Installation&amp;diff=22085"/>
		<updated>2022-07-12T22:29:28Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
{{Delete|This page may be consolidated into the main Raspberry Pi installation page and then deleted.}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes how I installed Alpine Linux 3.9.2 armhf on a Raspberry Pi Zero W.  I had problems with it initially as WiFi wouldn&#039;t connect when going through the setup-alpine script and when I was able to get it connect (after numerous failed manual attempts) it wouldn&#039;t reconnect on reboot.  The solution documented below adds and starts the rngd service prior to running setup-alpine which fixes the wifi connection problems and allows you to walk through the setup script successfully.  It also adds the rngd and wpa_supplicant services to start at boot and removes the network service from the rc-update list completely, which seems like the wrong thing to do and probably is - networking still gets started, probably as a dependency to something else, and it starts after rngd and wpa_supplicant, which is what I needed.  When the networking service was set to &amp;quot;boot&amp;quot; (which it was out of the box) it was starting before rngd and wpa_supplicant so wlan0 would never connect.&lt;br /&gt;
&lt;br /&gt;
I need to go back through this again but it should work as written.  Some steps may not be necessary for your use case and some steps may not be necessary at all, but don&#039;t seem to hurt.  I&#039;m still learning about Alpine Linux and hope to improve this process as I do more reading and experimentation.&lt;br /&gt;
&lt;br /&gt;
Update - 7 Dec 2019 - I went through installation again on a Pi Zero W with Alpine 3.10.3 for armhf.  First boot after writing the image to the SD card seems to work ok as far as WiFi functionality is concerned. Setup script completes and I was able to connect to WiFi and pull down packages etc. I decided to not install the rngd related packages at this point to see how a reboot looked, answer is not good. The dhcp request just times out.  Running setup-alpine again at this point also doesn&#039;t work. If you start over and rewrite the image to the SD card, the first boot will again work ok, it&#039;s only rebooting that breaks Wifi. I think it&#039;s best to follow the steps for installing the rngd related packages and configuring the service to start at boot. Note that you can install what you need on first boot using apk, you don&#039;t need to copy the packages to the SD card offline as written below.&lt;br /&gt;
&lt;br /&gt;
Update - 29 Dec 2019 - See also a method to perform a headless setup: [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
&lt;br /&gt;
= Write image to SD =&lt;br /&gt;
First, format an SD card with the FAT filesystem. That can be done with a graphical tool like GParted once the SD card is mounted on your operating system. The following assumes the SD card device is at /dev/sdb1.&lt;br /&gt;
&lt;br /&gt;
Mount the SD card:&lt;br /&gt;
{{Cmd|sudo mount /dev/sdb1 /mnt}}&lt;br /&gt;
&lt;br /&gt;
Then, copy the files:&lt;br /&gt;
{{Cmd|tar -xzvf alpine-rpi-3.9.2-armhf.tar.gz -C /mnt --no-same-owner}}&lt;br /&gt;
If you have no means to mount the SD card normally with an SD reader, it can be mounted via USB via the Raspberry Pi Zero W, using the usbbootgui tool to mount as eMMC/SD card reader. On Ubuntu, this can be installed as follows:&lt;br /&gt;
{{Cmd|sudo add-apt-repository ppa:rpi-distro/ppa}}&lt;br /&gt;
{{Cmd|sudo apt install usbbootgui}}&lt;br /&gt;
&lt;br /&gt;
A GUI should open as soon as you plug in your Pi; otherwise run&lt;br /&gt;
{{Cmd|usbbootgui}}&lt;br /&gt;
&lt;br /&gt;
= Edit cmdline.txt and add line for serial console (Optional)=&lt;br /&gt;
&lt;br /&gt;
This is for my use case and optional if you are using a local keyboard and monitor.  I do not connect a keyboard and monitor but rather do the setup via the Pi&#039;s serial GPIO pins.&lt;br /&gt;
&lt;br /&gt;
Create a file called cmdline.txt in the root of the SD card and place the following text in it:&lt;br /&gt;
{{Cmd|modules{{=}}loop,squashfs,sd-mod,usb-storage quiet dwc_otg.lpm_enable{{=}}0 console{{=}}tty1 console{{=}}ttyAMA0,115200}}&lt;br /&gt;
&lt;br /&gt;
= Create usercfg.txt and edit (Optional) =&lt;br /&gt;
&lt;br /&gt;
This is mostly optional I believe and applies to my use case where I will be running the Pi in a headless appliance type mode.  I reduce the memory allocated for the GPU, turn off audio (not sure I still need this on the Zero W), disable bluetooth (which I think puts the serial console back on the real uart, again, need to double check), add w1 for a temperature sensor, and set the enable_uart to 1 (may not be necessary, need to verify and add comments). This can be done by creating a file called usercfg.txt at the base of the SD card with the following contents:&lt;br /&gt;
{{Cmd|gpu_mem{{=}}16&lt;br /&gt;
dtparam{{=}}audio{{=}}off&lt;br /&gt;
dtoverlay{{=}}pi3-disable-bt&lt;br /&gt;
dtoverlay{{=}}w1-gpio&lt;br /&gt;
enable_uart{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
= Create cache folder and add rng-tools packages =&lt;br /&gt;
{{Cmd|mkdir /mnt/cache}}&lt;br /&gt;
I copied/pasted the following into the cache dir on the SD card.  I have another Alpine env to apk fetch packages from (chroot on Fedora)&lt;br /&gt;
{{Cmd|rng-tools-6.3.1-r1.652a1399.apk&lt;br /&gt;
rng-tools-openrc-6.3.1-r1.e9b063f8.apk}}&lt;br /&gt;
&lt;br /&gt;
= Boot Pi with prepared SD card, login as root and add packages =&lt;br /&gt;
&lt;br /&gt;
I&#039;m still new to Alpine, not sure if the setup-apkcache step is necessary or accomplishes anything here.&lt;br /&gt;
{{Cmd|localhost:~# setup-apkcache &lt;br /&gt;
Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/var/cache/apk]: /media/mmcblk0p1/cache/&lt;br /&gt;
&lt;br /&gt;
localhost:~# apk add --allow-untrusted /media/mmcblk0p1/cache/rng-tools-6.3.1-r1.652a1399.apk &lt;br /&gt;
(1/1) Installing rng-tools (6.3.1-r1)&lt;br /&gt;
Executing busybox-1.29.3-r10.trigger&lt;br /&gt;
OK: 8 MiB in 21 packages&lt;br /&gt;
&lt;br /&gt;
localhost:~# apk add --allow-untrusted /media/mmcblk0p1/cache/rng-tools-openrc-6.3.1-r1.e9b063f8.apk &lt;br /&gt;
(1/1) Installing rng-tools-openrc (6.3.1-r1)&lt;br /&gt;
OK: 8 MiB in 22 packages}}&lt;br /&gt;
&lt;br /&gt;
= Start rngd service =&lt;br /&gt;
{{Cmd|localhost:~# service rngd start&lt;br /&gt;
 * Caching service dependencies ...&lt;br /&gt;
 [ ok ]&lt;br /&gt;
 * Starting rngd ...&lt;br /&gt;
&lt;br /&gt;
Initalizing available sources&lt;br /&gt;
 [ ok ]}}&lt;br /&gt;
&lt;br /&gt;
= Run setup-alpine. Wifi connection should setup ok with rngd running. =&lt;br /&gt;
The setup process turns off the rngd service at some point, but that happens after wifi is connected.&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
= Configure services and reboot =&lt;br /&gt;
Removing networking from boot results in it not being present in any stage which seems like the wrong fix, but it runs after rngd and wpa_supplicant, which is what we want:&lt;br /&gt;
{{Cmd|pet-protect:~# rc-update add rngd boot&lt;br /&gt;
 * service rngd added to runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update add wpa_supplicant boot&lt;br /&gt;
 * service wpa_supplicant added to runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update del networking boot&lt;br /&gt;
 * service networking removed from runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update -u&lt;br /&gt;
 * Caching service dependencies ...&lt;br /&gt;
 [ ok ]&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# lbu commit -d&lt;br /&gt;
pet-protect:~# reboot}}&lt;br /&gt;
&lt;br /&gt;
[[category:Installation]]&lt;br /&gt;
[[category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Zero_W_-_Installation&amp;diff=22084</id>
		<title>Raspberry Pi Zero W - Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Zero_W_-_Installation&amp;diff=22084"/>
		<updated>2022-07-12T22:29:01Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
{{Delete|This page maybe soon consolidated into the main Raspberry Pi installation page and then deleted.}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes how I installed Alpine Linux 3.9.2 armhf on a Raspberry Pi Zero W.  I had problems with it initially as WiFi wouldn&#039;t connect when going through the setup-alpine script and when I was able to get it connect (after numerous failed manual attempts) it wouldn&#039;t reconnect on reboot.  The solution documented below adds and starts the rngd service prior to running setup-alpine which fixes the wifi connection problems and allows you to walk through the setup script successfully.  It also adds the rngd and wpa_supplicant services to start at boot and removes the network service from the rc-update list completely, which seems like the wrong thing to do and probably is - networking still gets started, probably as a dependency to something else, and it starts after rngd and wpa_supplicant, which is what I needed.  When the networking service was set to &amp;quot;boot&amp;quot; (which it was out of the box) it was starting before rngd and wpa_supplicant so wlan0 would never connect.&lt;br /&gt;
&lt;br /&gt;
I need to go back through this again but it should work as written.  Some steps may not be necessary for your use case and some steps may not be necessary at all, but don&#039;t seem to hurt.  I&#039;m still learning about Alpine Linux and hope to improve this process as I do more reading and experimentation.&lt;br /&gt;
&lt;br /&gt;
Update - 7 Dec 2019 - I went through installation again on a Pi Zero W with Alpine 3.10.3 for armhf.  First boot after writing the image to the SD card seems to work ok as far as WiFi functionality is concerned. Setup script completes and I was able to connect to WiFi and pull down packages etc. I decided to not install the rngd related packages at this point to see how a reboot looked, answer is not good. The dhcp request just times out.  Running setup-alpine again at this point also doesn&#039;t work. If you start over and rewrite the image to the SD card, the first boot will again work ok, it&#039;s only rebooting that breaks Wifi. I think it&#039;s best to follow the steps for installing the rngd related packages and configuring the service to start at boot. Note that you can install what you need on first boot using apk, you don&#039;t need to copy the packages to the SD card offline as written below.&lt;br /&gt;
&lt;br /&gt;
Update - 29 Dec 2019 - See also a method to perform a headless setup: [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
&lt;br /&gt;
= Write image to SD =&lt;br /&gt;
First, format an SD card with the FAT filesystem. That can be done with a graphical tool like GParted once the SD card is mounted on your operating system. The following assumes the SD card device is at /dev/sdb1.&lt;br /&gt;
&lt;br /&gt;
Mount the SD card:&lt;br /&gt;
{{Cmd|sudo mount /dev/sdb1 /mnt}}&lt;br /&gt;
&lt;br /&gt;
Then, copy the files:&lt;br /&gt;
{{Cmd|tar -xzvf alpine-rpi-3.9.2-armhf.tar.gz -C /mnt --no-same-owner}}&lt;br /&gt;
If you have no means to mount the SD card normally with an SD reader, it can be mounted via USB via the Raspberry Pi Zero W, using the usbbootgui tool to mount as eMMC/SD card reader. On Ubuntu, this can be installed as follows:&lt;br /&gt;
{{Cmd|sudo add-apt-repository ppa:rpi-distro/ppa}}&lt;br /&gt;
{{Cmd|sudo apt install usbbootgui}}&lt;br /&gt;
&lt;br /&gt;
A GUI should open as soon as you plug in your Pi; otherwise run&lt;br /&gt;
{{Cmd|usbbootgui}}&lt;br /&gt;
&lt;br /&gt;
= Edit cmdline.txt and add line for serial console (Optional)=&lt;br /&gt;
&lt;br /&gt;
This is for my use case and optional if you are using a local keyboard and monitor.  I do not connect a keyboard and monitor but rather do the setup via the Pi&#039;s serial GPIO pins.&lt;br /&gt;
&lt;br /&gt;
Create a file called cmdline.txt in the root of the SD card and place the following text in it:&lt;br /&gt;
{{Cmd|modules{{=}}loop,squashfs,sd-mod,usb-storage quiet dwc_otg.lpm_enable{{=}}0 console{{=}}tty1 console{{=}}ttyAMA0,115200}}&lt;br /&gt;
&lt;br /&gt;
= Create usercfg.txt and edit (Optional) =&lt;br /&gt;
&lt;br /&gt;
This is mostly optional I believe and applies to my use case where I will be running the Pi in a headless appliance type mode.  I reduce the memory allocated for the GPU, turn off audio (not sure I still need this on the Zero W), disable bluetooth (which I think puts the serial console back on the real uart, again, need to double check), add w1 for a temperature sensor, and set the enable_uart to 1 (may not be necessary, need to verify and add comments). This can be done by creating a file called usercfg.txt at the base of the SD card with the following contents:&lt;br /&gt;
{{Cmd|gpu_mem{{=}}16&lt;br /&gt;
dtparam{{=}}audio{{=}}off&lt;br /&gt;
dtoverlay{{=}}pi3-disable-bt&lt;br /&gt;
dtoverlay{{=}}w1-gpio&lt;br /&gt;
enable_uart{{=}}1}}&lt;br /&gt;
&lt;br /&gt;
= Create cache folder and add rng-tools packages =&lt;br /&gt;
{{Cmd|mkdir /mnt/cache}}&lt;br /&gt;
I copied/pasted the following into the cache dir on the SD card.  I have another Alpine env to apk fetch packages from (chroot on Fedora)&lt;br /&gt;
{{Cmd|rng-tools-6.3.1-r1.652a1399.apk&lt;br /&gt;
rng-tools-openrc-6.3.1-r1.e9b063f8.apk}}&lt;br /&gt;
&lt;br /&gt;
= Boot Pi with prepared SD card, login as root and add packages =&lt;br /&gt;
&lt;br /&gt;
I&#039;m still new to Alpine, not sure if the setup-apkcache step is necessary or accomplishes anything here.&lt;br /&gt;
{{Cmd|localhost:~# setup-apkcache &lt;br /&gt;
Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/var/cache/apk]: /media/mmcblk0p1/cache/&lt;br /&gt;
&lt;br /&gt;
localhost:~# apk add --allow-untrusted /media/mmcblk0p1/cache/rng-tools-6.3.1-r1.652a1399.apk &lt;br /&gt;
(1/1) Installing rng-tools (6.3.1-r1)&lt;br /&gt;
Executing busybox-1.29.3-r10.trigger&lt;br /&gt;
OK: 8 MiB in 21 packages&lt;br /&gt;
&lt;br /&gt;
localhost:~# apk add --allow-untrusted /media/mmcblk0p1/cache/rng-tools-openrc-6.3.1-r1.e9b063f8.apk &lt;br /&gt;
(1/1) Installing rng-tools-openrc (6.3.1-r1)&lt;br /&gt;
OK: 8 MiB in 22 packages}}&lt;br /&gt;
&lt;br /&gt;
= Start rngd service =&lt;br /&gt;
{{Cmd|localhost:~# service rngd start&lt;br /&gt;
 * Caching service dependencies ...&lt;br /&gt;
 [ ok ]&lt;br /&gt;
 * Starting rngd ...&lt;br /&gt;
&lt;br /&gt;
Initalizing available sources&lt;br /&gt;
 [ ok ]}}&lt;br /&gt;
&lt;br /&gt;
= Run setup-alpine. Wifi connection should setup ok with rngd running. =&lt;br /&gt;
The setup process turns off the rngd service at some point, but that happens after wifi is connected.&lt;br /&gt;
{{Cmd|setup-alpine}}&lt;br /&gt;
&lt;br /&gt;
= Configure services and reboot =&lt;br /&gt;
Removing networking from boot results in it not being present in any stage which seems like the wrong fix, but it runs after rngd and wpa_supplicant, which is what we want:&lt;br /&gt;
{{Cmd|pet-protect:~# rc-update add rngd boot&lt;br /&gt;
 * service rngd added to runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update add wpa_supplicant boot&lt;br /&gt;
 * service wpa_supplicant added to runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update del networking boot&lt;br /&gt;
 * service networking removed from runlevel boot&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# rc-update -u&lt;br /&gt;
 * Caching service dependencies ...&lt;br /&gt;
 [ ok ]&lt;br /&gt;
&lt;br /&gt;
pet-protect:~# lbu commit -d&lt;br /&gt;
pet-protect:~# reboot}}&lt;br /&gt;
&lt;br /&gt;
[[category:Installation]]&lt;br /&gt;
[[category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22083</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22083"/>
		<updated>2022-07-12T22:26:49Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Raspberry Pi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material needs to be re-organized .. as &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039; both need to be reordered as independent sections }}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
=== Postinstall ===&lt;br /&gt;
&lt;br /&gt;
==== Developers: compilers, IDEs and tools ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
** [[Alpine newbie developer: gitea|Alpine newbie developer: Git management web frontend gitea]]&lt;br /&gt;
** [[Alpine newbie developer: full stack web]]&lt;br /&gt;
&lt;br /&gt;
==== Servers: deploy in production ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
** [[Production DataBases : mysql|Production database: MySql]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
* Kubernetes&lt;br /&gt;
** [[K8s]] Building a K8s Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Raid Administration]]&lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up LVM on LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[Setting up NBD]]&lt;br /&gt;
* [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[Setting up ZFS with native encryption]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Partitioning and Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using SSH is the preferred way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[How to set up Alpine as a wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Seafile: setting up your own private cloud]]&lt;br /&gt;
&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Install|Post install]]&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Repositories#Enabling_the_community_repository|Enabling the community repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
&amp;lt;!-- Obsolete?&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java]]&lt;br /&gt;
* [[Rsnapshot|Setting up periodic backups with &amp;lt;samp&amp;gt;rsnapshot&amp;lt;/samp&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization==&lt;br /&gt;
&lt;br /&gt;
* [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
* [[Xen Dom0 on USB or SD]]&lt;br /&gt;
* [[Create Alpine Linux PV DomU]]&lt;br /&gt;
* [[Xen PCI Passthrough]]&lt;br /&gt;
* [[Xen LiveCD]]&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Install Alpine on VirtualBox]]&lt;br /&gt;
* [[Install Alpine on VMWare]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[Desktop environments and Window managers]] (overall information only)&lt;br /&gt;
** [[Xfce]]&lt;br /&gt;
** [[LXQt]]&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
** [[MATE]]&lt;br /&gt;
** [[Fluxbox (spanish)]]&lt;br /&gt;
** [[AwesomeWM]]&lt;br /&gt;
** [[dwm]]&lt;br /&gt;
** [[Gnome]]&lt;br /&gt;
** [[KDE]]&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
** [[River]]&lt;br /&gt;
* [[Alpine and UEFI|Alpine and UEFI Support Status and related topics]]&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Sound Setup]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi (Installation)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]]&lt;br /&gt;
* [[RPI Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi Zero W - Installation]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker]]&lt;br /&gt;
&lt;br /&gt;
== PowerPC ==&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== IBM Z (IBM z Systems) ==&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server 3.x HowTo]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx_with_PHP#Nginx_with_PHP|Nginx with PHP]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Configure OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a nfs-server]]&lt;br /&gt;
* [[Setting up a samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_developer: gitea|Setting up Git management web frontend gitea]]&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[How To Setup Your Own IRC Network]] &#039;&#039;(Using {{Pkg|charybdis}} and {{Pkg|atheme-iris}})&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
* [[IPTV How To|Internet Protocol television (IPTV)]]&lt;br /&gt;
* [[UniFi_Controller]]&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* Setting up [[collectd]]&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[LTTng]] &#039;&#039;(Kernel and userspace tracing)&#039;&#039;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
* [[Kernel Modesetting]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [https://codeberg.org/AVG7/alpine-sway-x86_64 DIY Live-USB-Stick with Sway] &lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
* [[Building a cloud with Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small_Office_Services]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Newbies ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie]] (for overall information in funny sections)&lt;br /&gt;
&lt;br /&gt;
[[Category:System_Administration]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=22081</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=22081"/>
		<updated>2022-07-12T22:26:05Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{warning | 11 Feb 2021 - There is currently a known bug upstream &amp;lt;br /&amp;gt;[https://github.com/raspberrypi/firmware/issues/1529 kernel/initramfs cannot be loaded from subdirectory with same name as volume label] }}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
This tutorial will help you install Alpine Linux on your Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. You should be safe using the &#039;&#039;&#039;armhf&#039;&#039;&#039; build on all versions of Raspberry Pi (including Pi Zero and Compute Modules); but it may perform less optimally on recent versions of Raspberry Pi. The &#039;&#039;&#039;armv7&#039;&#039;&#039; build is compatible with Raspberry Pi 2 Model B. The &#039;&#039;&#039;aarch64&#039;&#039;&#039; build should be compatible with Raspberry Pi 2 Model v1.2, Raspberry Pi 3 and Compute Module 3, and Raspberry Pi 4 model B.&lt;br /&gt;
# [[Create_a_Bootable_Device#Manually_copying_Alpine_files|Create a bootable FAT32 partition on your SD card.]] The partitioning and formatting part of the instructions on the linked page could be done using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks], just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
To setup a headless system, a bootstrapping configuration overlay file [https://github.com/macmpi/alpine-linux-headless-bootstrap  headless.apkovl.tar.gz] may be added to enable basic networking, so that following configuration steps can be performed under &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;. Pi Zero may be configured with simple USB ethernet-gadget networking with another computer sharing its internet connection.&lt;br /&gt;
&lt;br /&gt;
Optionally create a &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on the partition to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. However, note some settings can only be set directly in &#039;&#039;&#039;config.txt&#039;&#039;&#039;, which may be overwritten after updates. In particular, &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt; will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; ([https://github.com/raspberrypi/firmware/issues/1332 source]). Some interesting values include:&lt;br /&gt;
* To enable the UART console: &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* To enable audio: &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you plan to install on a Pi Compute Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recent versions include Broadcom firmware files. If you&#039;re using an older Alpine version, see [[#Wireless_support_with_older_Alpine_images|section below]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed in [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.&lt;br /&gt;
&lt;br /&gt;
For users who will be using their Raspberry Pi in scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server), this is likely preferable, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). Diskless installations still allow you to install packages, save local files, and tune the system to your needs. &lt;br /&gt;
&lt;br /&gt;
However, if you:&lt;br /&gt;
* Expect there will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Need logs to persist after reboot&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Want to install kernel modules (such as ZFS or Wireguard)&lt;br /&gt;
&lt;br /&gt;
Then you may be better served by a [[Classic install or sys mode on Raspberry Pi|sys-mode installation]]. &lt;br /&gt;
&lt;br /&gt;
Follow these steps to install Alpine Linux in Diskless Mode:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and power it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;&lt;br /&gt;
# Once the installation is complete, commit the changes by typing &amp;lt;code&amp;gt;lbu commit -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; to verify that the installation was indeed successful.&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, make sure your system is up-to-date:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the changes:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d}}&lt;br /&gt;
&lt;br /&gt;
Note: this does not upgrade the kernel. In order to upgrade the kernel, a full upgrade of the Alpine Linux version must be performed as described in [[Upgrading Alpine#Upgrading Alpine Linux on other removable media (such as CF/USB)|upgrading Alpine Linux for removable media]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  The Raspberry Pi does not have&lt;br /&gt;
a hardware clock, thus you need to disable the hwclock daemon and enable swclock:&lt;br /&gt;
&lt;br /&gt;
{{cmd|rc-update add swclock boot    # enable the software clock&lt;br /&gt;
rc-update del hwclock boot    # disable the hardware clock}}&lt;br /&gt;
&lt;br /&gt;
Since the Raspberry Pi does not have a clock, Alpine Linux needs to know what the time is by using a&lt;br /&gt;
[https://en.wikipedia.org/wiki/Network_Time_Protocol Network Time Protocol (NTP)] daemon.  Make sure you have a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, you can install an NTP client by running the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|setup-ntp}}&lt;br /&gt;
&lt;br /&gt;
The Busybox NTP client might be the most lightweight solution.  Save the changes and reboot, once the NTP software is&lt;br /&gt;
installed and running:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d&lt;br /&gt;
reboot}}&lt;br /&gt;
&lt;br /&gt;
After reboot, make sure the &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; command outputs the correct date and time.&lt;br /&gt;
&lt;br /&gt;
=== WiFi on boot ===&lt;br /&gt;
If you have already [[Connecting_to_a_wireless_access_point|configured WiFi]] during the setup, the connection will not return on reboot.&lt;br /&gt;
You will need to start up a service to automatically connect to the wireless access point.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;rc-update add wpa_supplicant boot&amp;lt;/code&amp;gt; to connect to the wireless access point during bootup.&lt;br /&gt;
# Run it manually with &amp;lt;code&amp;gt;/etc/init.d/wpa_supplicant start&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Enable OpenGL (Raspberry Pi 3/4) ===&lt;br /&gt;
Remount the boot partition writeable (i.e. &amp;lt;code&amp;gt;/media/mmcblk0p1&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to &amp;lt;code&amp;gt;/media/mmcblk0p1/config.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
&lt;br /&gt;
If you are experiencing graphical issues, you can also try:&lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-fkms-v3d&lt;br /&gt;
&lt;br /&gt;
And perhaps also raising the default &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
Note that raising the gpu memory is not likely to [https://www.raspberrypi.com/documentation/computers/config_txt.html#gpu_mem actually improve performance on the Pi4]&lt;br /&gt;
&lt;br /&gt;
Install the Mesa drivers:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;apk add mesa-dri-gallium&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
=== WiFi drivers ===&lt;br /&gt;
As of Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add linux-firmware-cypress}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
When you install Alpine in diskless mode, the entire system is loaded into memory at boot. If you want additional storage (for example, if you need more space than offered by your RAM) we need to create loop-back storage onto the SD card mounted with overlayfs.&lt;br /&gt;
&lt;br /&gt;
First, make the SD card writable again and change fstab to always do so:&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
sed -i &#039;s/vfat\ ro,/vfat\ rw,/&#039; /etc/fstab}}&lt;br /&gt;
&lt;br /&gt;
Create the loop-back file, this example is 1 GB:&lt;br /&gt;
&lt;br /&gt;
{{cmd|dd if&amp;amp;#61;/dev/zero of&amp;amp;#61;/media/mmcblk0p1/persist.img bs&amp;amp;#61;1024 count&amp;amp;#61;0 seek&amp;amp;#61;1048576}}&lt;br /&gt;
&lt;br /&gt;
Install the ext utilities:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs}}&lt;br /&gt;
&lt;br /&gt;
Format the loop-back file:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkfs.ext4 /media/mmcblk0p1/persist.img}}&lt;br /&gt;
&lt;br /&gt;
Mount the storage: &lt;br /&gt;
&lt;br /&gt;
{{cmd|echo &amp;quot;/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mkdir /media/persist &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Make the overlay folders, we are using the /usr directory here, but you can use /home or anything else. &lt;br /&gt;
{{Warning|Overlay workdir needs to be an empty directory on the same filesystem mount as the upper directory. So each overlay must use its own workdir.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work_usr &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work_usr 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work_usr 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember, with this setup if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise, while it boots it will try and install it to memory, not to the persistent storage.&lt;br /&gt;
&lt;br /&gt;
If you do want to install something small at boot, you can use `apk add` and `lbu commit -d`.&lt;br /&gt;
&lt;br /&gt;
If it is something a bit bigger, then you can use `apk add` but then not commit it. It will be persistent (in /user), but be sure to check everything you need is in that directory and not in folders you have not made persistent.&lt;br /&gt;
&lt;br /&gt;
=== Traditional disk-based (sys) installation ===&lt;br /&gt;
{{Merge|Classic install or sys mode on Raspberry Pi|There&#039;s an existing page for sys-installations on RasPi.}}&lt;br /&gt;
&lt;br /&gt;
It is also possible to switch to a fully disk-based installation. This is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.&lt;br /&gt;
&lt;br /&gt;
Split your SD card into two partitions: the FAT32 boot partition described above (in this example it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p1&amp;lt;/code&amp;gt;) , and a second partition to hold the root filesystem (here it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p2&amp;lt;/code&amp;gt;). Boot and configure your diskless system as above, then create a root filesystem:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs&lt;br /&gt;
mkfs.ext4 /dev/mmcblk0p2}}&lt;br /&gt;
&lt;br /&gt;
Now do a disk install via a mountpoint. The &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; script will give some errors about syslinux/extlinux, but you can ignore them.&lt;br /&gt;
The Raspberry Pi doesn&#039;t need them to boot.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mkdir /stage&lt;br /&gt;
mount /dev/mmcblk0p2 /stage&lt;br /&gt;
setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage&lt;br /&gt;
# (ignore errors about syslinux/extlinux)&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Add a line to &amp;lt;code&amp;gt;/stage/etc/fstab&amp;lt;/code&amp;gt; to mount the Pi&#039;s boot partition again:&lt;br /&gt;
&lt;br /&gt;
{{cmd|/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now add a &amp;lt;code&amp;gt;root=/dev/mmcblk0p2&amp;lt;/code&amp;gt; parameter to the Pi&#039;s boot command line, either &amp;lt;code&amp;gt;cmdline-rpi2.txt&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cmdline-rpi.txt&amp;lt;/code&amp;gt; depending on model:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
sed -i &#039;$ s/$/ root=\/dev\/mmcblk0p2/&#039; /media/mmcblk0p1/cmdline-rpi2.txt&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You might also consider &amp;lt;code&amp;gt;overlaytmpfs=yes&amp;lt;/code&amp;gt; here, which will cause the underlying SD card root filesystem to be mounted read-only, with an overlayed tmpfs for modifications which will be discarded at shutdown.&lt;br /&gt;
&lt;br /&gt;
N.B. &amp;lt;b&amp;gt;the contents of /boot will be ignored when the Pi boots&amp;lt;/b&amp;gt;. It will use the kernel, initramfs, and modloop images from the FAT32 boot partition. To update the kernel, initfs or modules, you will need to manually (generate and) copy these to the boot partition or you could use bind mount, in which case,&lt;br /&gt;
copying the files to boot partition manually, is not needed.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 &amp;gt;&amp;gt; /etc/fstab&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 3 ===&lt;br /&gt;
See [[Classic install or sys mode on Raspberry Pi]] and https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 4 ===&lt;br /&gt;
As of 3.14, setup-alpine should ask you if you want to create a sys mode partition on your Raspberry Pi 4.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatively&#039;&#039;&#039;, installing haveged, the random numbers generator, would speed up the process: &lt;br /&gt;
&lt;br /&gt;
  apk update &lt;br /&gt;
  apk add haveged&lt;br /&gt;
  rc-update add haveged boot&lt;br /&gt;
  lbu commit -d&lt;br /&gt;
  service haveged start&lt;br /&gt;
&lt;br /&gt;
(Tested on a raspberry pi zero W in headless mode, no USB connected, Alpine 3.10.3)&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
Note some models of the Raspberry Pi such as the 3A+ only have 512M of RAM, which on fresh Alpine deployment will only leave around 200M for tmpfs root. It&#039;s important to keep this limitation in mind when using these boards.&lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22080</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22080"/>
		<updated>2022-07-12T22:23:49Z</updated>

		<summary type="html">&lt;p&gt;Sodface: Delete content. Consolidated into existing install wiki pages and files now hosted on github.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Delete|See the latest version on [https://github.com/macmpi/alpine-linux-headless-bootstrap github] .}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22079</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=22079"/>
		<updated>2022-07-12T22:17:54Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material needs to be re-organized .. as &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039; both need to be reordered as independent sections }}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
=== Postinstall ===&lt;br /&gt;
&lt;br /&gt;
==== Developers: compilers, IDEs and tools ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
** [[Alpine newbie developer: gitea|Alpine newbie developer: Git management web frontend gitea]]&lt;br /&gt;
** [[Alpine newbie developer: full stack web]]&lt;br /&gt;
&lt;br /&gt;
==== Servers: deploy in production ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
** [[Production DataBases : mysql|Production database: MySql]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
* Kubernetes&lt;br /&gt;
** [[K8s]] Building a K8s Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Raid Administration]]&lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up LVM on LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[Setting up NBD]]&lt;br /&gt;
* [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[Setting up ZFS with native encryption]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Partitioning and Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using SSH is the preferred way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[How to set up Alpine as a wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Seafile: setting up your own private cloud]]&lt;br /&gt;
&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installation#Post-Install|Post install]]&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Repositories#Enabling_the_community_repository|Enabling the community repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
&amp;lt;!-- Obsolete?&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java]]&lt;br /&gt;
* [[Rsnapshot|Setting up periodic backups with &amp;lt;samp&amp;gt;rsnapshot&amp;lt;/samp&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization==&lt;br /&gt;
&lt;br /&gt;
* [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
* [[Xen Dom0 on USB or SD]]&lt;br /&gt;
* [[Create Alpine Linux PV DomU]]&lt;br /&gt;
* [[Xen PCI Passthrough]]&lt;br /&gt;
* [[Xen LiveCD]]&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Install Alpine on VirtualBox]]&lt;br /&gt;
* [[Install Alpine on VMWare]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[Desktop environments and Window managers]] (overall information only)&lt;br /&gt;
** [[Xfce]]&lt;br /&gt;
** [[LXQt]]&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
** [[MATE]]&lt;br /&gt;
** [[Fluxbox (spanish)]]&lt;br /&gt;
** [[AwesomeWM]]&lt;br /&gt;
** [[dwm]]&lt;br /&gt;
** [[Gnome]]&lt;br /&gt;
** [[KDE]]&lt;br /&gt;
** [[Sway]]&lt;br /&gt;
** [[River]]&lt;br /&gt;
* [[Alpine and UEFI|Alpine and UEFI Support Status and related topics]]&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Sound Setup]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi (Installation)]]&lt;br /&gt;
* [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]]&lt;br /&gt;
* [[RPI Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi Zero W - Installation]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker]]&lt;br /&gt;
&lt;br /&gt;
== PowerPC ==&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== IBM Z (IBM z Systems) ==&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server 3.x HowTo]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx_with_PHP#Nginx_with_PHP|Nginx with PHP]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Configure OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a nfs-server]]&lt;br /&gt;
* [[Setting up a samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_developer: gitea|Setting up Git management web frontend gitea]]&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[How To Setup Your Own IRC Network]] &#039;&#039;(Using {{Pkg|charybdis}} and {{Pkg|atheme-iris}})&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
* [[IPTV How To|Internet Protocol television (IPTV)]]&lt;br /&gt;
* [[UniFi_Controller]]&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* Setting up [[collectd]]&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[LTTng]] &#039;&#039;(Kernel and userspace tracing)&#039;&#039;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
* [[Kernel Modesetting]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [https://codeberg.org/AVG7/alpine-sway-x86_64 DIY Live-USB-Stick with Sway] &lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
* [[Building a cloud with Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small_Office_Services]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Newbies ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie]] (for overall information in funny sections)&lt;br /&gt;
&lt;br /&gt;
[[Category:System_Administration]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22065</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22065"/>
		<updated>2022-07-09T11:10:34Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
{{Delete|Although most of the below is still valid, there&#039;s an effort in progress to consolidate and expand this functionality. See the latest script updates on [https://github.com/macmpi/alpine-linux-headless-bootstrap github] .}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running. Tested on a Raspberry Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n rpi4&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
sleep 3; date&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
modloop_media=$(find_modloop_media)&lt;br /&gt;
DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Configure network&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ ${ssid} ]&lt;br /&gt;
then&lt;br /&gt;
	for dev in /sys/class/net/*&lt;br /&gt;
	do&lt;br /&gt;
		if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
		then&lt;br /&gt;
			iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
		fi&lt;br /&gt;
	done&lt;br /&gt;
	apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
	ap_scan=1&lt;br /&gt;
	autoscan=periodic:10&lt;br /&gt;
	disable_scan_offload=1&lt;br /&gt;
	network={&lt;br /&gt;
        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service wpa_supplicant start&lt;br /&gt;
else&lt;br /&gt;
	iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto ${iface}&lt;br /&gt;
iface ${iface} inet dhcp&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service networking start&lt;br /&gt;
	&lt;br /&gt;
# Enable sshd&lt;br /&gt;
setup-sshd -c openssh&lt;br /&gt;
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
rc-service sshd restart&lt;br /&gt;
mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
# Clean up&lt;br /&gt;
rc-update del local&lt;br /&gt;
rm /etc/local.d/headless.start&lt;br /&gt;
	&lt;br /&gt;
# Login root&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
rm -f /root/.profile&lt;br /&gt;
if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
then&lt;br /&gt;
	tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
	cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
openvt -s -c 7 -- /bin/login -f root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22064</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=22064"/>
		<updated>2022-07-09T11:09:27Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
{{Delete|Although most of the below is still valid, there&#039;s an effort in progress to consolidate and expand this functionality. See the latest script updates on [github.](https://github.com/macmpi/alpine-linux-headless-bootstrap) .}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running. Tested on a Raspberry Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n rpi4&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
sleep 3; date&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
modloop_media=$(find_modloop_media)&lt;br /&gt;
DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Configure network&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ ${ssid} ]&lt;br /&gt;
then&lt;br /&gt;
	for dev in /sys/class/net/*&lt;br /&gt;
	do&lt;br /&gt;
		if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
		then&lt;br /&gt;
			iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
		fi&lt;br /&gt;
	done&lt;br /&gt;
	apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
	ap_scan=1&lt;br /&gt;
	autoscan=periodic:10&lt;br /&gt;
	disable_scan_offload=1&lt;br /&gt;
	network={&lt;br /&gt;
        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service wpa_supplicant start&lt;br /&gt;
else&lt;br /&gt;
	iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto ${iface}&lt;br /&gt;
iface ${iface} inet dhcp&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service networking start&lt;br /&gt;
	&lt;br /&gt;
# Enable sshd&lt;br /&gt;
setup-sshd -c openssh&lt;br /&gt;
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
rc-service sshd restart&lt;br /&gt;
mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
# Clean up&lt;br /&gt;
rc-update del local&lt;br /&gt;
rm /etc/local.d/headless.start&lt;br /&gt;
	&lt;br /&gt;
# Login root&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
rm -f /root/.profile&lt;br /&gt;
if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
then&lt;br /&gt;
	tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
	cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
openvt -s -c 7 -- /bin/login -f root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21830</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21830"/>
		<updated>2022-05-05T01:51:48Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */  Get rid of the pointless functions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running. Tested on a Raspberry Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n rpi4&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
sleep 3; date&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
modloop_media=$(find_modloop_media)&lt;br /&gt;
DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Configure network&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ ${ssid} ]&lt;br /&gt;
then&lt;br /&gt;
	for dev in /sys/class/net/*&lt;br /&gt;
	do&lt;br /&gt;
		if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
		then&lt;br /&gt;
			iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
		fi&lt;br /&gt;
	done&lt;br /&gt;
	apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
	ap_scan=1&lt;br /&gt;
	autoscan=periodic:10&lt;br /&gt;
	disable_scan_offload=1&lt;br /&gt;
	network={&lt;br /&gt;
        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service wpa_supplicant start&lt;br /&gt;
else&lt;br /&gt;
	iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto ${iface}&lt;br /&gt;
iface ${iface} inet dhcp&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service networking start&lt;br /&gt;
	&lt;br /&gt;
# Enable sshd&lt;br /&gt;
setup-sshd -c openssh&lt;br /&gt;
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
rc-service sshd restart&lt;br /&gt;
mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
# Clean up&lt;br /&gt;
rc-update del local&lt;br /&gt;
rm /etc/local.d/headless.start&lt;br /&gt;
	&lt;br /&gt;
# Login root&lt;br /&gt;
cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
rm -f /root/.profile&lt;br /&gt;
if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
then&lt;br /&gt;
	tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
	cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
openvt -s -c 7 -- /bin/login -f root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Comparison_with_other_distros&amp;diff=21808</id>
		<title>Comparison with other distros</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Comparison_with_other_distros&amp;diff=21808"/>
		<updated>2022-05-02T02:01:37Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Runlevel management */  -k is no longer a valid option&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Even if Alpine is designed to run from RAM, it has some similarities in package management with other distributions. This page outlines those similarities and differences, to help new users use Alpine and understand the differences between Alpine and other distributions.&lt;br /&gt;
&lt;br /&gt;
{{Note|The page was originally copied from: [https://web.archive.org/web/20070911124125/http://gentoo-wiki.com/TIP_Converting_from_or_to_Debian http://gentoo-wiki.com/TIP_Converting_from_or_to_Debian]}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Package management =&lt;br /&gt;
Where Gentoo has portage and emerge; Debian has, among others, apt; Alpine uses apk-tools. This section compares how apk-tools is used, in comparison to apt and emerge.&lt;br /&gt;
&lt;br /&gt;
Note that Gentoo is source-based, just like ports in FreeBSD are, while Debian uses pre-compiled binaries. Alpine is compiled using Gentoo&#039;s portage, but Alpine itself uses its own apk-tools binary package which is more similar to FreeBSD&#039;s binary packages.&lt;br /&gt;
&lt;br /&gt;
== Updating package database ==&lt;br /&gt;
Gentoo will update the build-from-source scripts and the updating of the database takes much more time than updating the database for Debian or Alpine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk update&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt update&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emaint sync -a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Showing available updates ==&lt;br /&gt;
Show which packages have an update available:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk version -v&lt;br /&gt;
or:&lt;br /&gt;
 apk version -v -l &#039;&amp;lt;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge --deep --update --pretend @world&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt upgrade --simulate&lt;br /&gt;
&lt;br /&gt;
== Updating a particular package ==&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk add -u package1 package2&lt;br /&gt;
or&lt;br /&gt;
 apk upgrade package1 package2&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt install package1 package2&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge --update package1 package2&lt;br /&gt;
&lt;br /&gt;
== Installing packages ==&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk add package1 package2&lt;br /&gt;
&lt;br /&gt;
For source compile, see the [[Aports tree]] and the [[abuild]] tool.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge package1 package2&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt-get install package1 package2&lt;br /&gt;
Debian source compile:&lt;br /&gt;
 apt-get build-dep package1&lt;br /&gt;
 apt-get source package1&lt;br /&gt;
(optional: customize the build by modifying the debian/rules makefile)&lt;br /&gt;
(or set environmental variables like DEB_BUILD_OPTIONS)&lt;br /&gt;
(note that this will make your bug reports invalid to the maintainer)&lt;br /&gt;
 dpkg-buildpackage -rfakeroot -uc -b&lt;br /&gt;
 dpkg -i generatedpackagename&lt;br /&gt;
Simplified source compile:&lt;br /&gt;
 apt-get build-dep package1&lt;br /&gt;
 apt-get -b source package1&lt;br /&gt;
(the packages are automatically generated using the -b switch above)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; This process can be used to backport packages from testing and unstable by simply adding their respective source repositories to sources.list, which is similar to adding ~x86 to package.keywords in Gentoo. This is explored further in the &amp;quot;Architectures and repositories&amp;quot; section below.&lt;br /&gt;
&lt;br /&gt;
== Reinstalling particular packages ==&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk del package1 package2 &amp;amp;&amp;amp; apk add package1 package2&lt;br /&gt;
or:&lt;br /&gt;
 apk fix package1 package2&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge --oneshot package1 package2&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt-get install --reinstall package1 package2&lt;br /&gt;
&lt;br /&gt;
Note: You &#039;&#039;rarely&#039;&#039; need to reinstall a package on Debian&lt;br /&gt;
&lt;br /&gt;
== Searching the package database ==&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Alpine will only search package names.&lt;br /&gt;
 apk search searchword&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To search the package names and descriptions:&lt;br /&gt;
 emerge --searchdesc searchword&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; On Gentoo, it&#039;s actually much better to install and use either the esearch package or the eix package to do a search. You use them like this:&lt;br /&gt;
 eix searchword&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 esearch searchword&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 apt-cache search searchword&lt;br /&gt;
Both emerge and apt-cache search support regular expressions.&lt;br /&gt;
&lt;br /&gt;
To get the long package information on Debian (searching only in package names):&lt;br /&gt;
 apt-cache search --full --names-only searchword&lt;br /&gt;
&lt;br /&gt;
== Removing packages ==&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 apk del package1 package2&lt;br /&gt;
apk del will remove configuration files when the --purge flag is used. Make sure you have backups of your configuration files. (Using rcs might be an idea)&lt;br /&gt;
&lt;br /&gt;
You will mostly like to take a quick look at the dependencies before you remove packages recursively.&lt;br /&gt;
&lt;br /&gt;
To see dependencies for a package, use:&lt;br /&gt;
 apk info -R package1 package2&lt;br /&gt;
&lt;br /&gt;
To see if package is required by other packages (is a dependency for another packages), use:&lt;br /&gt;
 apk info -r package1 package2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge --unmerge package1 package2 (Note: this is unsafe as it does not check dependencies)&lt;br /&gt;
 emerge --depclean package1 package2 (This will check dependencies)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt-get remove package1 package2&lt;br /&gt;
or to remove along with all configuration files&lt;br /&gt;
 apt-get remove --purge package1 package2&lt;br /&gt;
&lt;br /&gt;
== Only downloading packages ==&lt;br /&gt;
This can be useful e.g. if you&#039;re on a dial-up connection and want to download everything first and install later.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
 apk fetch package1 package2&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 emerge --fetchonly package1 package2&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt-get install --download-only package1 package2&lt;br /&gt;
&lt;br /&gt;
== Cleaning up downloaded packages ==&lt;br /&gt;
Compressed packages that were downloaded for installation can easily consume gigabytes of storage space.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Alpine will clean up packages automatically.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 rm -rf /var/cache/distfiles/*&lt;br /&gt;
To only remove outdated packages you will need to install the gentoolkit package and use eclean:&lt;br /&gt;
 eclean distfiles&lt;br /&gt;
Cleaning temporary files from emerging packages:&lt;br /&gt;
 rm -rf /var/tmp/portage/*&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 apt-get clean&lt;br /&gt;
Only remove outdated packages:&lt;br /&gt;
 apt-get autoclean&lt;br /&gt;
&lt;br /&gt;
==Reverse dependencies==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
apk-tools will take care of reverse dependencies.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Reverse dependencies are a major drawback of Gentoo&#039;s current portage implementation: It does not take care of them at all at the moment.&lt;br /&gt;
If you use the unsafe --unmerge argument, this means that you can uninstall packages needed by others without being warned about it. E.g. you can remove the X server package without portage warning you that KDE (which you have installed as well) depends on it. This way you can actually break your entire system (e.g. by removing glibc).&lt;br /&gt;
&lt;br /&gt;
 revdep-rebuild&lt;br /&gt;
can fix broken dependencies broken by&lt;br /&gt;
emerge --depclean&lt;br /&gt;
&lt;br /&gt;
Recent versions of portage include library tracking and preservation with the preserved-libs feature.  Portage will notify you to run {{Cmd| emerge @preserved-rebuild}} to help rebuild binaries that might otherwise become broken.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Reverse dependencies are taken care of by dpkg.&lt;br /&gt;
&lt;br /&gt;
= Runlevel &amp;amp; Initscripts =&lt;br /&gt;
Runlevels work pretty conventionally on Debian (see details: [http://archive.fo/ZdZIz systemd]{{dead link}}). On Alpine and Gentoo, they are a bit different.&lt;br /&gt;
&lt;br /&gt;
== Directories and files ==&lt;br /&gt;
In &#039;&#039;&#039;Debian&#039;&#039;&#039;, runlevels are named conventionally (0-6 and S). They are represented by directories in /etc/ called rc*.d (when the default sysv-rc boot loader package is installed; file-rc can be installed instead, and then the relevant file is runlevel.conf).&lt;br /&gt;
&lt;br /&gt;
* /etc/rc0.d&lt;br /&gt;
* /etc/rc1.d&lt;br /&gt;
* /etc/rcS.d&lt;br /&gt;
* /etc/rc2.d&lt;br /&gt;
* /etc/rc3.d&lt;br /&gt;
* /etc/rc4.d&lt;br /&gt;
* /etc/rc5.d&lt;br /&gt;
* /etc/rc6.d&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;Gentoo&#039;&#039;&#039;, runlevels have the same names, but these are mapped to more self explanatory ones (in /etc/inittab): &amp;quot;boot&amp;quot;, &amp;quot;default&amp;quot;, &amp;quot;nonetwork&amp;quot;, with the option to add more. The directories that represent them are in &lt;br /&gt;
/etc/runlevels/:&lt;br /&gt;
* /etc/runlevels/boot&lt;br /&gt;
* /etc/runlevels/default&lt;br /&gt;
* /etc/runlevels/nonetwork&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;Gentoo&#039;&#039;&#039;, if a service is not explicitly started in a runlevel, it is stopped when switching to that runlevel! There is no explicit stopping of runlevels as in Debian (/etc/rc?.d/K??service).&lt;br /&gt;
&lt;br /&gt;
In &#039;&#039;&#039;both Debian and Gentoo&#039;&#039;&#039;, which things are started (and stopped) in which runlevels is controlled by links in the runlevel directories to scripts in /etc/init.d/, e.g.:&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
 $ ls -l /etc/runlevels/boot/hostname&lt;br /&gt;
 lrwxrwxrwx  1 root root 20 Mar 25  2004 /etc/runlevels/boot/hostname -&amp;gt; /etc/init.d/hostname&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
 $ ls -l rcS.d/S40hostname.sh&lt;br /&gt;
 lrwxrwxrwx  1 root root 21 2004-11-07 00:19 rcS.d/S40hostname.sh -&amp;gt; ../init.d/hostname.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In Alpine, runlevels work like they do in Gentoo:&lt;br /&gt;
&lt;br /&gt;
* /etc/runlevels/boot&lt;br /&gt;
* /etc/runlevels/default&lt;br /&gt;
* /etc/runlevels/sysinit&lt;br /&gt;
* /etc/runlevels/nonetwork&lt;br /&gt;
* /etc/runlevels/shutdown&lt;br /&gt;
&lt;br /&gt;
== Runlevel management ==&lt;br /&gt;
To manage which things to start in which runlevels, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To see current status of services in runlevels, do:&lt;br /&gt;
 rc-status&lt;br /&gt;
To add sshd to default runlevel, do:&lt;br /&gt;
 rc-update add sshd default&lt;br /&gt;
To remove sshd from all runlevels do:&lt;br /&gt;
 rc-update del sshd&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 rc-update&lt;br /&gt;
To add the cupsd to the default runlevel, do:&lt;br /&gt;
 rc-update add cupsd default&lt;br /&gt;
To remove alsasound from the boot runlevel, do:&lt;br /&gt;
 rc-update del alsasound boot&lt;br /&gt;
Also see this wiki page about [http://gentoo-wiki.com/Rc-update gentoo runlevel management with rc-update]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 update-rc.d&lt;br /&gt;
Configure cupsd to be started in runlevels 2, 3, 4, 5, and stopped in 0, 1, 6, with sequence code 20:&lt;br /&gt;
 update-rc.d cupsd start 20 2 3 4 5 . stop 20 0 1 6 . &lt;br /&gt;
or simply:&lt;br /&gt;
 update-rc.d cupsd defaults &lt;br /&gt;
Remove cupsd from all runlevels:&lt;br /&gt;
 update-rc.d -f cupsd remove&lt;br /&gt;
&lt;br /&gt;
= Config Files =&lt;br /&gt;
&lt;br /&gt;
== /etc/portage/make.conf and use flags ==&lt;br /&gt;
While in Gentoo there&#039;s a large number of configuration files which control the behaviour of the package management system, there are comparatively fewer in Debian, as there is no need to dictate how to compile software which is downloaded and tweak/alter it. In Gentoo, the file /etc/portage/make.conf is used for much configuration; this includes &#039;&#039;USE&#039;&#039; flags, which influence which elements of packages are compiled, and which libraries to build support for - common USE flags (USE or -USE to specifically negate support) include &#039;gtk gnome&#039; for Gnome users (and a corresponding -qt -kde -arts) and &#039;qt kde arts&#039; for KDE users. A Gentoo user&#039;s complete set of use flags may look something like this:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;USE=&amp;quot;-kde -arts -qt xv truetype bluetooth crypt slang readline gpm berkdb mmx gdbm tcpd pam libwww ssl nls ethereal perl python esd gif imlib sdl oggvorbis mpeg gnome gtk X motif opengl avi png tiff nptl pcmcia nptl ldap eds&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Architectures and repositories ==&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Also in /etc/portage/make.conf is the &#039;&#039;&#039;ACCEPT_KEYWORDS&#039;&#039;&#039; setting, with (for an X86-based processor) two settings, &#039;&#039;&#039;x86&#039;&#039;&#039; for stabler packages, and &#039;&#039;&#039;~x86&#039;&#039;&#039; for bleeding edge packages. It is however not recommended to make this change in /etc/portage/make.conf. Rather configure this per-package in /etc/portage/package.accept_keywords. It&#039;s enough to put a line into that file naming the package (for example &#039;app-foo/bar&#039;). That file might look like this:&lt;br /&gt;
&lt;br /&gt;
 app-crypt/gpg-agent&lt;br /&gt;
 app-text/docbook-xsl-stylesheets&lt;br /&gt;
 =app-text/docbook-xml-dtd-4.3-r1&lt;br /&gt;
&lt;br /&gt;
The last line says, that &#039;&#039;only&#039;&#039; version 4.3-r1 should be unmasked. Older and newer versions will still be ignored.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note for non-x86 users:&#039;&#039;&#039;&lt;br /&gt;
The keywords &#039;&#039;&#039;x86&#039;&#039;&#039; and &#039;&#039;&#039;~x86&#039;&#039;&#039; can of course be replaced by &#039;&#039;&#039;sparc&#039;&#039;&#039; and &#039;&#039;&#039;~sparc&#039;&#039;&#039; for example.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Setting this in Debian is slightly more complicated, and is accomplished by setting different &#039;repositories&#039; in &#039;&#039;/etc/apt/sources.list&#039;&#039; - along with which &#039;tree&#039; to use for packages; in Debian, these are &#039;&#039;&#039;stable&#039;&#039;&#039;, &#039;&#039;&#039;testing&#039;&#039;&#039;, and &#039;&#039;&#039;unstable&#039;&#039;&#039;. An &#039;&#039;/etc/apt/sources.list&#039;&#039; file for a debian testing user may look something like this:&lt;br /&gt;
&lt;br /&gt;
 deb http://mirrors.kernel.org/debian testing main non-free contrib&lt;br /&gt;
 deb ftp://ftp.nerim.net/debian-marillat testing main&lt;br /&gt;
 deb http://security.debian.org testing/updates main contrib non-free&lt;br /&gt;
&lt;br /&gt;
Alternatively, &#039;&#039;/etc/apt/sources.list&#039;&#039; can contain any number of repositories for any trees, and a default tree (this can be overridden using the -t switch on the command line) in &#039;&#039;/etc/apt/apt.conf&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
   APT::Default-Release &amp;quot;testing&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Per-package settings go in &#039;&#039;/etc/apt/preferences&#039;&#039;, somewhat like Gentoo&#039;s &#039;&#039;/etc/portage/package.keywords&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Network ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alpine&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Alpine uses /etc/network/interfaces, just like Debian. The main reason is because this is the way busybox does it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
 auto eth0&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
  address 192.168.0.1&lt;br /&gt;
  netmask 255.255.255.0&lt;br /&gt;
  broadcast 192.168.0.255&lt;br /&gt;
  &lt;br /&gt;
 auto eth0:0&lt;br /&gt;
 iface eth0:0 inet static&lt;br /&gt;
  address 192.168.1.1&lt;br /&gt;
  netmask 255.255.255.0&lt;br /&gt;
  broadcast 192.168.1.255&lt;br /&gt;
 # etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gentoo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/etc/conf.d/net&#039;&#039;:&lt;br /&gt;
 config_eth0=&amp;quot;192.168.1.100 netmask 255.255.255.0&lt;br /&gt;
              192.168.2.100 netmask 255.255.255.0&amp;quot;&lt;br /&gt;
 routes_eth0=&amp;quot;default via 192.168.1.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that this has changed recently. For more information please refer to http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debian&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
 auto eth0&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
  address 192.168.0.1&lt;br /&gt;
  netmask 255.255.255.0&lt;br /&gt;
  broadcast 192.168.0.255&lt;br /&gt;
  &lt;br /&gt;
 auto eth0:0&lt;br /&gt;
 iface eth0:0 inet static&lt;br /&gt;
  address 192.168.1.1&lt;br /&gt;
  netmask 255.255.255.0&lt;br /&gt;
  broadcast 192.168.1.255&lt;br /&gt;
 # etc.&lt;br /&gt;
&lt;br /&gt;
= Comparison chart/Rosetta Stone =&lt;br /&gt;
&lt;br /&gt;
This chart shows how some standard things are done in Alpine compared to other distributions.&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;5&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Action &lt;br /&gt;
! Alpine ([https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management apk])&lt;br /&gt;
! Arch Linux ([https://wiki.archlinux.org/index.php/Pacman pacman])&lt;br /&gt;
! Gentoo ([https://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&amp;amp;chap=1 emerge])&lt;br /&gt;
! Debian/Ubuntu ([https://wiki.debian.org/AptCLI apt])&lt;br /&gt;
! Fedora/RHEL/SL/CentOS ([http://yum.baseurl.org/wiki/YumCommands yum])&lt;br /&gt;
! VoidLinux ([https://docs.voidlinux.org/xbps/index.html?highlight=xb#xbps-package-manager XBPS])&lt;br /&gt;
|-&lt;br /&gt;
| Update package database&lt;br /&gt;
| {{Cmd| apk update}}&lt;br /&gt;
| {{Cmd| pacman -Sy}}&lt;br /&gt;
| {{Cmd| emerge --sync}}&lt;br /&gt;
| {{Cmd| apt update}}&lt;br /&gt;
| {{Cmd| yum update}}&lt;br /&gt;
| {{Cmd| xbps-install -S}}&lt;br /&gt;
|-&lt;br /&gt;
| Showing available updates&lt;br /&gt;
| {{Cmd| apk version -l &#039;&amp;lt;&#039;}}&lt;br /&gt;
| {{Cmd| pacman -Qu}}&lt;br /&gt;
| {{Cmd| emerge --deep --update --pretend @world}}&lt;br /&gt;
| {{Cmd| apt upgrade --simulate}}&lt;br /&gt;
| {{Cmd| yum list updates}}&lt;br /&gt;
| {{Cmd| xbps-install -n -u}}&lt;br /&gt;
|-&lt;br /&gt;
| Installing packages&lt;br /&gt;
| {{Cmd| apk add [package name]}}&lt;br /&gt;
| {{Cmd| pacman -S [package name]}}&lt;br /&gt;
| {{Cmd| emerge [package name]}}&lt;br /&gt;
| {{Cmd| apt install [package name]}}&lt;br /&gt;
| {{Cmd| yum install [package name]}}&lt;br /&gt;
| {{Cmd| xbps-install [package name]}}&lt;br /&gt;
|-&lt;br /&gt;
| Update all installed packages&lt;br /&gt;
| {{Cmd| apk upgrade -U -a}}&lt;br /&gt;
| {{Cmd| pacman -Su}}&lt;br /&gt;
| {{Cmd| emerge --update --deep @world}}&lt;br /&gt;
| {{Cmd| apt upgrade}}&lt;br /&gt;
| {{Cmd| yum update}}&lt;br /&gt;
| {{Cmd| xbps-install -u}}&lt;br /&gt;
|- &lt;br /&gt;
| Searching package database&lt;br /&gt;
| {{Cmd| apk search -v &#039;[string]*&#039;}}&lt;br /&gt;
| {{Cmd| pacman -Ss [string]}}&lt;br /&gt;
| {{Cmd| emerge --search [string]}}&lt;br /&gt;
| {{Cmd| apt search [string]}}&lt;br /&gt;
| {{Cmd| yum search [string]}}&lt;br /&gt;
| {{Cmd| xbps-query -Rs [string]}}&lt;br /&gt;
|-&lt;br /&gt;
| Removing packages&lt;br /&gt;
| {{Cmd| apk del [package name]}}&lt;br /&gt;
| {{Cmd| pacman -R [package name]}}&lt;br /&gt;
| {{Cmd| emerge --depclean [package name]}}&lt;br /&gt;
| {{Cmd| apt remove [package name]}}&lt;br /&gt;
| {{Cmd| yum remove [package name]}}&lt;br /&gt;
| {{Cmd| xbps-remove [package name]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21804</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21804"/>
		<updated>2022-04-30T18:05:37Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running. Tested on a Raspberry Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n rpi4&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
sleep 3; date&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
modloop_media=$(find_modloop_media)&lt;br /&gt;
DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
		cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
		source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21803</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21803"/>
		<updated>2022-04-30T18:03:59Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n rpi4&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
sleep 3; date&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
modloop_media=$(find_modloop_media)&lt;br /&gt;
DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
		cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
		source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21802</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21802"/>
		<updated>2022-04-30T17:53:39Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		tmpfile=&amp;quot;\$(mktemp)&amp;quot;&lt;br /&gt;
		cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
		source &amp;quot;\${tmpfile}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21801</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21801"/>
		<updated>2022-04-30T17:32:23Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		tmpfile=&amp;quot;$(mktemp)&amp;quot;&lt;br /&gt;
		cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;${tmpfile}&amp;quot;&lt;br /&gt;
		source &amp;quot;${tmpfile}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21800</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21800"/>
		<updated>2022-04-30T17:10:11Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		local tmpfile=&amp;quot;$(mktemp)&amp;quot;&lt;br /&gt;
		cp &amp;quot;${ovlpath}/unattended.sh&amp;quot; &amp;quot;${tmpfile}&amp;quot;&lt;br /&gt;
		source &amp;quot;${tmpfile}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21798</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21798"/>
		<updated>2022-04-30T12:03:14Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21797</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21797"/>
		<updated>2022-04-30T12:02:56Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21796</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21796"/>
		<updated>2022-04-30T12:00:14Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice has been removed from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21795</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21795"/>
		<updated>2022-04-30T11:59:36Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice from the top of this page has been removed but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21794</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21794"/>
		<updated>2022-04-30T11:59:10Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|The draft notice from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21793</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21793"/>
		<updated>2022-04-30T01:14:04Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|I&#039;ve removed the draft notice from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=21792</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=21792"/>
		<updated>2022-04-30T01:11:53Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Complete Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material needs to be re-organized .. as &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039; both need to be reordered as independent sections }}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
=== Postinstall ===&lt;br /&gt;
&lt;br /&gt;
* [[Post installation|Post installation notes]]&lt;br /&gt;
&lt;br /&gt;
==== Postinstall: desktops and applications ====&lt;br /&gt;
&lt;br /&gt;
* [[Desktop environments and Window managers]] (overall information only)&lt;br /&gt;
** [[Xfce]]&lt;br /&gt;
** [[LXQt]]&lt;br /&gt;
** [[Openbox]]&lt;br /&gt;
** [[MATE]]&lt;br /&gt;
* [[Alpine and UEFI|Alpine and UEFI Support Status and related topics]]&lt;br /&gt;
&lt;br /&gt;
==== Developers: compilers, IDEs and tools ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
** [[Alpine newbie developer: gitea|Alpine newbie developer: Git management web frontend gitea]]&lt;br /&gt;
** [[Alpine newbie developer: full stack web]]&lt;br /&gt;
&lt;br /&gt;
==== Servers: deploy in production ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
** [[Production DataBases : mysql|Production database: MySql]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
* Kubernetes&lt;br /&gt;
** [[K8s]] Building a K8s Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Raid Administration]]&lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up LVM on LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[Setting up NBD]]&lt;br /&gt;
* [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[Setting up ZFS with native encryption]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Partitioning and Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using SSH is the preferred way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[How to set up Alpine as a wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Seafile: setting up your own private cloud]]&lt;br /&gt;
&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Enable Community Repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
&amp;lt;!-- Obsolete?&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java]]&lt;br /&gt;
* [[Rsnapshot|Setting up periodic backups with &amp;lt;samp&amp;gt;rsnapshot&amp;lt;/samp&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization==&lt;br /&gt;
&lt;br /&gt;
* [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
* [[Xen Dom0 on USB or SD]]&lt;br /&gt;
* [[Create Alpine Linux PV DomU]]&lt;br /&gt;
* [[Xen PCI Passthrough]]&lt;br /&gt;
* [[Xen LiveCD]]&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Install Alpine on VirtualBox]]&lt;br /&gt;
* [[Install Alpine on VMWare]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[AwesomeWM]]&lt;br /&gt;
* [[dwm]]&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Gnome]]&lt;br /&gt;
* [[KDE]]&lt;br /&gt;
* [[MATE]]&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[River]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Sway]]&lt;br /&gt;
* [[Xfce]]&lt;br /&gt;
* [[Sound Setup]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi (Installation)]]&lt;br /&gt;
* [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]]&lt;br /&gt;
* [[RPI Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi Zero W - Installation]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker]]&lt;br /&gt;
&lt;br /&gt;
== PowerPC ==&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== IBM Z (IBM z Systems) ==&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server 3.x HowTo]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx_with_PHP#Nginx_with_PHP|Nginx with PHP]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a nfs-server]]&lt;br /&gt;
* [[Setting up a samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_developer: gitea|Setting up Git management web frontend gitea]]&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[How To Setup Your Own IRC Network]] &#039;&#039;(Using {{Pkg|charybdis}} and {{Pkg|atheme-iris}})&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
* [[IPTV How To|Internet Protocol television (IPTV)]]&lt;br /&gt;
* [[UniFi_Controller]]&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* Setting up [[collectd]]&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[LTTng]] &#039;&#039;(Kernel and userspace tracing)&#039;&#039;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
* [[Kernel Modesetting]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[Unattended Boot and Install]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [https://codeberg.org/AVG7/alpine-sway-x86_64 DIY Live-USB-Stick with Sway] &lt;br /&gt;
* [[Alpine on the Aopen Chromebase or Chromebox Mini with Mainline Kernel]]&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
* [[Building a cloud with Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small_Office_Services]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Newbies ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie]] (for overall information in funny sections)&lt;br /&gt;
&lt;br /&gt;
[[Category:System_Administration]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21791</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21791"/>
		<updated>2022-04-30T01:10:26Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|I&#039;ve removed the draft notice from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21790</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21790"/>
		<updated>2022-04-30T01:06:25Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|I&#039;ve removed the draft notice from the top of this page but additional testing is needed. Use at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21789</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21789"/>
		<updated>2022-04-30T01:06:02Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
{{Note|I&#039;ve removed the draft notice from the top of this page but additional testing is needed.}}&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21788</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21788"/>
		<updated>2022-04-30T01:01:56Z</updated>

		<summary type="html">&lt;p&gt;Sodface: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21787</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21787"/>
		<updated>2022-04-30T01:00:53Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21786</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21786"/>
		<updated>2022-04-30T01:00:35Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The headless.start file has the following contents:&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21785</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21785"/>
		<updated>2022-04-30T01:00:01Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Cat|headless.start|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
__clean_up()&lt;br /&gt;
{&lt;br /&gt;
	rc-update del local&lt;br /&gt;
	rm /etc/local.d/headless.start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__config_net()&lt;br /&gt;
{&lt;br /&gt;
	if [ ${ssid} ]&lt;br /&gt;
	then&lt;br /&gt;
		for dev in /sys/class/net/*&lt;br /&gt;
		do&lt;br /&gt;
			if [ -e &amp;quot;${dev}&amp;quot;/wireless -o -e &amp;quot;${dev}&amp;quot;/phy80211 ]&lt;br /&gt;
			then&lt;br /&gt;
				iface=&amp;quot;${dev##*/}&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		done&lt;br /&gt;
		apk add wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
		cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
		ap_scan=1&lt;br /&gt;
		autoscan=periodic:10&lt;br /&gt;
		disable_scan_offload=1&lt;br /&gt;
		network={&lt;br /&gt;
	        	ssid=&amp;quot;${ssid}&amp;quot;&lt;br /&gt;
	        	psk=&amp;quot;${psk}&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
		EOF&lt;br /&gt;
&lt;br /&gt;
		rc-service wpa_supplicant start&lt;br /&gt;
	else&lt;br /&gt;
		iface=&amp;quot;eth0&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /etc/network/interfaces&lt;br /&gt;
	auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto ${iface}&lt;br /&gt;
	iface ${iface} inet dhcp&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	rc-service networking start&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__enable_ssh()&lt;br /&gt;
{&lt;br /&gt;
	setup-sshd -c openssh&lt;br /&gt;
	cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig&lt;br /&gt;
	echo &amp;quot;PermitEmptyPasswords yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	echo &amp;quot;PermitRootLogin yes&amp;quot; &amp;gt;&amp;gt; /etc/ssh/sshd_config&lt;br /&gt;
	rc-service sshd restart&lt;br /&gt;
	mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
__login_root()&lt;br /&gt;
{&lt;br /&gt;
	cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/.profile &lt;br /&gt;
	rm -f /root/.profile&lt;br /&gt;
	if [ -e ${ovlpath}/unattended.sh ] &amp;amp;&amp;amp; [ \$(tty) = /dev/tty7 ]&lt;br /&gt;
	then&lt;br /&gt;
		source ${ovlpath}/unattended.sh&lt;br /&gt;
	fi&lt;br /&gt;
	EOF&lt;br /&gt;
&lt;br /&gt;
	openvt -s -c 7 -- /bin/login -f root&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ovlpath=$(find /media -name *.apkovl.tar.gz -exec dirname {} \;)&lt;br /&gt;
read ssid psk &amp;lt; &amp;quot;${ovlpath}/wifi.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
__config_net&lt;br /&gt;
__enable_ssh&lt;br /&gt;
__clean_up&lt;br /&gt;
__login_root&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21784</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21784"/>
		<updated>2022-04-30T00:55:47Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Overlay File Reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
The [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file has the following structure:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|└── etc&lt;br /&gt;
    ├── .default_boot_services&lt;br /&gt;
    ├── local.d&lt;br /&gt;
    │   └── headless.start&lt;br /&gt;
    └── runlevels&lt;br /&gt;
        └── default&lt;br /&gt;
            └── local -&amp;gt; /etc/init.d/local&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21783</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21783"/>
		<updated>2022-04-30T00:53:57Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above scripts need to be improved, tested, and tailored for your own use. Edits welcome!&lt;br /&gt;
&lt;br /&gt;
= Overlay File Reference =&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21782</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21782"/>
		<updated>2022-04-30T00:51:17Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third is like the second except without the separate answer file and using cat to set the INTERFACEOPTS variable based on the interface currently in use.&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;set -a&lt;br /&gt;
&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
#INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
#iface lo inet loopback&lt;br /&gt;
#&lt;br /&gt;
#auto eth0&lt;br /&gt;
#iface eth0 inet dhcp&lt;br /&gt;
#&amp;quot;&lt;br /&gt;
INTERFACESOPTS=$(cat /etc/network/interfaces)&lt;br /&gt;
empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21781</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21781"/>
		<updated>2022-04-30T00:47:18Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script. It skips the sshd and network interface setup scripts as they are already configured and running.&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine. Note that sshd and network interface setup are included this time, even though they are both already up. It seems to work but not without complaint. More experimentation is required.&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21780</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21780"/>
		<updated>2022-04-30T00:43:58Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine.&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21779</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21779"/>
		<updated>2022-04-30T00:43:33Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The next one creates an answer file and runs setup-alpine.&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt;-EOF &amp;gt; /root/answerfile&lt;br /&gt;
	KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
	HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
	TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
	PROXYOPTS=&amp;quot;none&amp;quot;&lt;br /&gt;
	NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
	APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
	SSHDOPTS=&amp;quot;-c openssh&amp;quot;&lt;br /&gt;
	DISKOPTS=&amp;quot;-m sys /dev/vda&amp;quot;&lt;br /&gt;
	INTERFACESOPTS=&amp;quot;auto lo&lt;br /&gt;
	iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
	auto eth0&lt;br /&gt;
	iface eth0 inet dhcp&lt;br /&gt;
	&amp;quot;&lt;br /&gt;
	empty_root_password=&amp;quot;true&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
yes | setup-alpine -f /root/answerfile&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21778</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21778"/>
		<updated>2022-04-30T00:40:54Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21777</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21777"/>
		<updated>2022-04-30T00:40:15Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21776</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21776"/>
		<updated>2022-04-30T00:38:21Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21775</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21775"/>
		<updated>2022-04-30T00:37:43Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Example Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|unattended.sh|&lt;br /&gt;
KEYMAPOPTS=&amp;quot;us us&amp;quot;&lt;br /&gt;
HOSTNAMEOPTS=&amp;quot;-n alpine-test&amp;quot;&lt;br /&gt;
TIMEZONEOPTS=&amp;quot;-z UTC&amp;quot;&lt;br /&gt;
NTPOPTS=&amp;quot;-c busybox&amp;quot;&lt;br /&gt;
APKREPOSOPTS=&amp;quot;-r&amp;quot;&lt;br /&gt;
DISKOPTS=&amp;quot;-m sys /dev/mmcblk0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
source /lib/libalpine.sh&lt;br /&gt;
setup-keymap ${KEYMAPOPTS}&lt;br /&gt;
setup-hostname ${HOSTNAMEOPTS}&lt;br /&gt;
setup-timezone ${TIMEZONEOPTS}&lt;br /&gt;
rc-update add networking boot&lt;br /&gt;
rc-update add urandom boot&lt;br /&gt;
for svc in acpid cron crond; do&lt;br /&gt;
        if rc-service --exists $svc; then&lt;br /&gt;
                rc-update add $svc &lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
rc-service hostname restart&lt;br /&gt;
_dn=$(sed -n \&lt;br /&gt;
-e &#039;/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}&#039; \&lt;br /&gt;
-e &#039;${g;p;}&#039; /etc/resolv.conf 2&amp;gt;/dev/null)&lt;br /&gt;
_hn=$(hostname)&lt;br /&gt;
_hn=${_hn%%.*}&lt;br /&gt;
sed -i -e &amp;quot;s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/&amp;quot; /etc/hosts&lt;br /&gt;
setup-ntp ${NTPOPTS}&lt;br /&gt;
setup-apkrepos ${APKREPOSOPTS}&lt;br /&gt;
yes | setup-disk -q ${DISKOPTS}&lt;br /&gt;
poweroff&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21774</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21774"/>
		<updated>2022-04-30T00:35:18Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Wifi Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example Scripts =&lt;br /&gt;
If a shell script named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; is found in the root of the same media that contains the headless.apkovl.tar.gz file, it will be executed (sourced) by the root user after the auto login occurs on tty7. This can be used to script the installation of Alpine to local disk for example. Note too, that since network is available, the &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; script can also just fetch and execute another script from the local network or internet, if available.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve experimented with different installation scripts. The first is derived from the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-alpine.in setup-alpine] script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/network/interfaces|&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
	hostname wyse3030-3&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
	pre-up ifconfig $IFACE up&lt;br /&gt;
	pre-down ifconfig $IFACE down&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21773</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21773"/>
		<updated>2022-04-30T00:24:21Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Wifi Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and Password on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/network/interfaces|&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
	hostname wyse3030-3&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
	pre-up ifconfig $IFACE up&lt;br /&gt;
	pre-down ifconfig $IFACE down&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21772</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21772"/>
		<updated>2022-04-30T00:23:58Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Wifi Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and PSK on the first line of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/network/interfaces|&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
	hostname wyse3030-3&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
	pre-up ifconfig $IFACE up&lt;br /&gt;
	pre-down ifconfig $IFACE down&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21771</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=21771"/>
		<updated>2022-04-30T00:23:40Z</updated>

		<summary type="html">&lt;p&gt;Sodface: /* Wifi Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
This wiki describes a modified version of the original method I posted for [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation Headless installation on a Raspberry Pi.] While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it&#039;s applicability will be clearer.&lt;br /&gt;
&lt;br /&gt;
Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.&lt;br /&gt;
&lt;br /&gt;
The following functionality is provided:&lt;br /&gt;
* Automatic DHCP configuration of a network interface, either wired or wireless&lt;br /&gt;
* Automatic configuration of sshd with password-less root login enabled&lt;br /&gt;
* Automatic login of the root user on tty7&lt;br /&gt;
* Automatic script execution (optional)&lt;br /&gt;
&lt;br /&gt;
This is accomplished by using an overlay file that Alpine extracts at boot. [http://www.sodface.com/repo/headless.apkovl.tar.gz Download a pre-built overlay file here.]&lt;br /&gt;
&lt;br /&gt;
= Basic Use =&lt;br /&gt;
For Alpine supported Raspberry Pi models:&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation tarball] and extract it to an SD card formatted with a single FAT partition.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to the root of the SD card.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of the SD card. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the SD card. See below for an example.&lt;br /&gt;
# Boot the Pi with the SD card.&lt;br /&gt;
&lt;br /&gt;
For other architectures (tested on various x86_64 hardware and a Qemu VM)&lt;br /&gt;
# Download the applicable [https://alpinelinux.org/downloads/ Alpine installation file] and write it to usb stick or other media as needed.&lt;br /&gt;
# Copy the [http://www.sodface.com/repo/headless.apkovl.tar.gz headless.apkovl.tar.gz] file to a second usb stick or other media separate from the installation media.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; in the root of second media. See below for file format.&lt;br /&gt;
# Optionally, create a file named &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; in the root of the second media. See below for an example.&lt;br /&gt;
# Boot the device with both the installation and the secondary media connected.&lt;br /&gt;
&lt;br /&gt;
For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; file can be omitted if wired ethernet is used. The &#039;&#039;&#039;unattended.sh&#039;&#039;&#039; file can be omitted.&lt;br /&gt;
&lt;br /&gt;
= Wifi Support =&lt;br /&gt;
Create a text file named &#039;&#039;&#039;wifi.txt&#039;&#039;&#039; with the SSID and PSK on the first line of the file:  &lt;br /&gt;
&amp;lt;code&amp;gt;SSID Password&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/network/interfaces|&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
	hostname wyse3030-3&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
	pre-up ifconfig $IFACE up&lt;br /&gt;
	pre-down ifconfig $IFACE down&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).&lt;br /&gt;
&lt;br /&gt;
Enable and create a local start-up script to add route entries at boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd| # rc-update add local default&lt;br /&gt;
 # touch /etc/local.d/RouteAdd.start&lt;br /&gt;
 # chmod +x /etc/local.d/RouteAdd.start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Sodface</name></author>
	</entry>
</feed>