How to Install Alpine Linux from ISO: A Step-by-Step Tutorial

Alpine Linux is a lightweight, security-oriented Linux distribution. This tutorial will guide you through the process of installing Alpine Linux from an ISO image. Follow these steps to set up a minimal yet functional Alpine Linux system.

Prerequisites:

  • A computer or virtual machine.
  • An ISO image of Alpine Linux, which you can download from the official Alpine Linux website.
  • A USB flash drive (for physical installation) or a virtual machine setup tool (like VirtualBox or VMware).

Step 1: Prepare the Installation Medium

For Physical Installation:

  1. Download the Alpine Linux ISO image.
  2. Use a tool like Rufus (Windows) or Etcher (Linux/macOS) to create a bootable USB flash drive.
  3. Insert the USB flash drive into your computer.

For Virtual Machine Installation:

  1. Download the Alpine Linux ISO image.
  2. Create a new virtual machine in your virtualization software (e.g., VirtualBox, VMware).
  3. Attach the downloaded ISO image to the virtual machine’s optical drive.

Step 2: Boot from the Installation Medium

For Physical Installation:

  1. Restart your computer and enter the BIOS/UEFI settings (usually by pressing a key like F2, F12, DEL, or ESC during boot).
  2. Set the USB flash drive as the first boot device.
  3. Save the changes and reboot.

For Virtual Machine Installation:

  1. Start the virtual machine.
  2. It should automatically boot from the attached ISO image.

Step 3: Initial Boot and Login

  1. Once Alpine Linux boots up, you’ll be greeted with a login prompt.
  2. Log in as the root user (no password is required initially).

Step 4: Set Up Networking

Ensure that your network interface is up and you have internet access. You can use the ifconfig or ip command to check the network status.

# If using DHCP, run:
setup-interfaces

Follow the prompts to configure your network interface.

Step 5: Install Alpine Linux

  1. Run the setup script to start the installation process:
  2. setup-alpine
  3. Follow the on-screen prompts to configure your system:
    • Keyboard Layout: Choose your preferred keyboard layout.
    • Hostname: Set a hostname for your machine.
    • Network Configuration: Confirm or configure your network settings.
    • Time Zone: Select your time zone.
    • Proxy: If you use a proxy, enter the details; otherwise, leave it blank.
    • Mirror: Select the nearest or preferred package mirror.
    • SSH Server: Choose if you want to enable the OpenSSH server (useful for remote management).
    • Root Password: Set a password for the root user.
    • Disk Setup: Choose the disk where you want to install Alpine Linux. The setup script will offer options to use the entire disk or to manually partition it.

Step 6: Finalize the Installation

  1. When prompted to initialize the system, choose the disk where Alpine Linux will be installed.
  2. The installer will format the disk and install the base system.

Step 7: Reboot the System

  1. After the installation is complete, the system will prompt you to reboot.
  2. Remove the installation medium (USB flash drive or detach the ISO from the virtual machine).
  3. Reboot the system:
  4. reboot

Step 8: Post-Installation Configuration

  1. Log in as the root user with the password you set during installation.
  2. Update the package index:
  3. apk update
  4. Upgrade the installed packages to the latest version:
  5. apk upgrade

Additional Configurations (Optional)

  • Add a new user:
    adduser yourusername
  • Add the new user to the wheel group to allow sudo access:
    addgroup yourusername wheel
  • Install sudo:
    apk add sudo
  • Edit the sudoers file to give wheel group sudo access:
    visudo

    Uncomment the line:

    %wheel ALL=(ALL) ALL

Conclusion

You have successfully installed Alpine Linux. From here, you can customize and configure your system as needed, install additional software packages, and set up services. Alpine Linux’s lightweight and security-focused nature makes it an excellent choice for a variety of uses, from servers to embedded systems. Enjoy your new Alpine Linux setup!