alpine.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 03 Jan 2021 23:37:00 +0200
changeset 2492 bd3d45148652
parent 2455 654f7a5ea92d
permissions -rw-r--r--
Fixed example.

.. -*- coding: utf-8; -*-

=====================
 Alpine Linux distro
=====================
.. contents::
   :local:

Init system
===========

Manage run levels::

  rc-update add $SERVICE $LEVEL
  rc-update del $SERVICE $LEVEL

Run levels meaning:

Starting/stopping services::

  rc-service $SERVICE status
  rc-service $SERVICE start
  rc-service $SERVICE stop
  rc-service $SERVICE restart

Equivalent to shutdown -r now from traditional GNU/Linux systems::

  reboot

Equivalent to shutdown -h now from traditional GNU/Linux systems::

  halt

To turn off the machine::

  poweroff

https://wiki.alpinelinux.org/wiki/Alpine_Linux_Init_System
  Alpine Linux Init System

Package manager
===============

Update local package database::

  $ sudo apk update

Upgrade packages to latest version::

  $ sudo apk upgrade

Upgrade only specific package::

  $ sudo apk add -u busybox

Install package::

  $ sudo apk add bash

Install local package::

  $ sudo apk add --allow-untrusted /path/to/file.apk

To install package from specific Alpine release tag extra repository URL in
``/etc/apk/repositories``::

  @edge http://nldl-cdn.alpinelinux.org/alpine/edge/main

and pin dependencies to tag::

  $ sudo apk add bash@edge

To avoid registering repository in ``/etc/apk/repositories`` pass repository URL and fixate package
version::

  $ sudo apk add postgresql==9.6.10-r0 --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.6/main

To select Alpine release, package and package version use https://pkgs.alpinelinux.org/packages

Do not grab package index with ``--no-cache`` option to reduce installation size::

  $ apk add --no-cache bash

Remove package::

  $ sudo apk del openssh

Search for packages::

  $ apk search 'emacs*'
  $ apk search -v 'emacs*'

List of installed packages::

  $ apk info

Package owning file (full path is required!)::

  $ apk info -W `which apk`
  $ apk info --who-owns `which apk`

Show package content::

  $ apk info -L  $PKG
  $ apk info --contents  $PKG

Developing Apline
=================

::

  $ apk add -U build-base
  $ apk add -U alpine-sdk