How to get regular stuff working: Difference between revisions

From Alpine Linux
(added link to Musl. moved glibc musl differences to Musl page)
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Man pages ==
Alpine Linux is built around [[Musl]] libc and [[BusyBox]]. This makes it small and very resource efficient. The utilities in BusyBox generally have fewer options and hence missing some functionality when used to [[Daily driver guide|daily drive]]. This page explains how to get the regular utilities working as found in other Linux distributions.


The man command and basic manual pages can be installed with:
== Core utilities ==
{{Main|GNU core utilities}}


    '''apk add mandoc man-pages'''
Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with original {{pkg|coreutils}} package:


The appropos command may be installed with:
{{Cmd|# apk add {{pkg|coreutils}}}}
    '''apk add mandoc-apropos '''


The '''man-pages''' package only provides the system's ''core'' manual pages. Other packages come with their separate '''*-doc''' sub-packages that ship their documentation (which may include man pages). This is the ''Alpine Way'' to allow for the small default footprint. For example:
== Util-linux  ==
A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as <code>mount</code>, <code>cfdisk</code>, <code>more</code>, <code>lsblk</code> and <code>kill</code> are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. To have the complete {{pkg|util-linux}} package:
{{Cmd|# apk add {{pkg|util-linux}}}}


    $ '''apk add curl'''
== Search utilities  ==
    $ '''man curl'''
Standard search tools <code>grep</code> and <code>find</code> can be installed by installing the packages {{pkg|grep}} and {{pkg|findutils}} as follows:
    man: No entry for curl in the manual.
{{Cmd|# apk add {{pkg|grep}} {{pkg|findutils}} }}
    $ '''apropos curl | wc -l'''
    0    <span style="color: green;">''After adding curl, there are no man pages''</span>
    $ '''apk add curl-doc'''
    (1/1) Installing curl-doc (7.52.1-r2)
    Executing mandoc-apropos-1.13.3-r6.trigger
    OK: 60 MiB in 31 packages
    $ '''apropos curl | wc -l'''
    366 <span style="color: green;">''Now, with curl-doc installed, there's a boatload of pages!''</span>


== Bash shell ==
{{Main|Change default shell}}
The default shell used by Alpine Linux is the busybox variant of the [[BusyBox#Ash_shell|ash shell]]. To install {{pkg|bash}}:
{{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}


If you would like all the documentation packages of your installed packages to be pulled in automatically, you may install the <code>docs</code> meta package.
== Hardware Management ==
Install {{pkg|pciutils}} and {{pkg|usbutils}} for configuring PCI and USB hardware respectively. You can always remove these packages once the hardware is configured.  


== Operational hints ==
{{Cmd|# apk add {{pkg|pciutils}} {{pkg|usbutils}}}}


==== Shell @ commandline ====
The packages {{pkg|hwdata-pci}} and {{pkg|hwdata-usb}} are dependencies for the above utilities and they are installed automatically.


Alpine comes with busybox by default.  Busybox is an endpoint for numerous symlinks for various utilities. Though busybox is not that bad, the commands are impaired in functionality.
== Disk Management ==


* Funny characters at the console
Managing (removable) disks is much easier with udisks.
Edit the file at {{Path|/etc/rc.conf}} and change line 92 to:
  unicode="YES"


* Bash
{{Cmd|# apk add {{pkg|udisks2}}}}
It is easy enough to have bash installed, but this does not mean the symlinks to busybox are gone.


Install bash with:  
To see the mounted disks:
  apk add bash bash-doc bash-completion


* Shell utilities (things like grep, [[awk]], ls are all busybox symlinks)
{{Cmd|# udisksctl status}}
  apk add util-linux pciutils usbutils coreutils binutils findutils grep


* /etc/{shadow,group} manipulation requires
== Network Management ==
  apk add shadow
For network, you may want to install {{pkg|iproute2}}.


==== Disk Management ====
{{Cmd|# apk add {{pkg|iproute2}}}}


Disk management is so much easier with udisks or udisks2
== Subpackages and missing functionality  ==
In Alpine Linux, binary packages are thinned out and split into subpackages to give you more control over what you install, which in turn keeps your environment as small and efficient as possible. When a package is installed in Alpine Linux, no assumption is made on what subpackage the user wants, so one may get the false impression of missing functionality.


Installation   
For eg: the {{pkg|networkmanager}} package for [https://networkmanager.dev/ NetworkManager], a popular network configuration tool is split into 20+ subpackages. If the user installs {{pkg|networkmanager}} package, usual commands like <Code>nmcli</Code>, <Code>nmtui</Code> will not be available. Similarly installing {{pkg| network-manager-applet}} will not allow you to manage Wifi networks. In Alpine Linux, the user is expected to identify and add the required subpackages e.g. {{pkg|networkmanager-cli}}, {{pkg|networkmanager-tui}} & {{pkg|networkmanager-wifi}} to get above functionalities. In other Linux distributions, above features plus unwanted features like bluetooth, adsl, wwan, vpn, l2tp, ppp etc are installed along with their dependencies.


  apk add udisks2 udisks2-doc
Use [https://pkgs.alpinelinux.org/packages package database] or  {{Codeline|<Code>apk search <pkgname></Code>}} to find  subpackages related to a package.


See the mounted disks
== Development environment ==


  udisksctl status
Compiling in Alpine Linux may be more challenging because it uses [https://musl.libc.org/ musl-libc] instead of glibc. The {{pkg|build-base}} meta package provides regular compiler stuff such as {{pkg|binutils}}, {{pkg|gcc}}, {{pkg|g++}}, {{pkg|make}} etc..


== Compiling : a few notes and a reminder  ==
{{Cmd|# apk add {{pkg|build-base}}}}


Compiling in Alpine may be more challenging because it uses [http://www.musl-libc.org/ musl-libc] instead of glibc. Please review [http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc 'The functional differences with glibc' ] if you think of porting packages or just for the sake of knowing, of course.
The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine Linux. It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.


Alpine offers the regular compiler stuff like gcc and cmake ... possible others
{{Cmd|# apk add {{pkg|alpine-sdk}}}}


==== (unvalidated) apk packages to install so one can start building software ====
To install CMake:
  apk add build-base gcc abuild binutils binutils-doc gcc-doc


==== a complete install for cmake looks like ====
{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}


  apk add cmake cmake-doc extra-cmake-modules extra-cmake-modules-doc
{{pkg|ccache}} and a lot other tools are also available in Alpine Linux.
 
==== ccache is also available ====
 
  apk add ccache ccache-doc


[[Category:Installation]]
[[Category:Installation]]
[[category: System Administration]]

Latest revision as of 14:07, 8 November 2024

Alpine Linux is built around Musl libc and BusyBox. This makes it small and very resource efficient. The utilities in BusyBox generally have fewer options and hence missing some functionality when used to daily drive. This page explains how to get the regular utilities working as found in other Linux distributions.

Core utilities

Most of the basic file, shell and text manipulation utilities commonly grouped under Core Utilities are provided by BusyBox. To replace it with original coreutils package:

# apk add coreutils

Util-linux

A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as mount, cfdisk, more, lsblk and kill are maintained under Util-linux. To have the complete util-linux package:

# apk add util-linux

Search utilities

Standard search tools grep and find can be installed by installing the packages grep and findutils as follows:

# apk add grep findutils

Bash shell

The default shell used by Alpine Linux is the busybox variant of the ash shell. To install bash:

# apk add bash bash-completion

Hardware Management

Install pciutils and usbutils for configuring PCI and USB hardware respectively. You can always remove these packages once the hardware is configured.

# apk add pciutils usbutils

The packages hwdata-pci and hwdata-usb are dependencies for the above utilities and they are installed automatically.

Disk Management

Managing (removable) disks is much easier with udisks.

# apk add udisks2

To see the mounted disks:

# udisksctl status

Network Management

For network, you may want to install iproute2.

# apk add iproute2

Subpackages and missing functionality

In Alpine Linux, binary packages are thinned out and split into subpackages to give you more control over what you install, which in turn keeps your environment as small and efficient as possible. When a package is installed in Alpine Linux, no assumption is made on what subpackage the user wants, so one may get the false impression of missing functionality.

For eg: the networkmanager package for NetworkManager, a popular network configuration tool is split into 20+ subpackages. If the user installs networkmanager package, usual commands like nmcli, nmtui will not be available. Similarly installing network-manager-applet will not allow you to manage Wifi networks. In Alpine Linux, the user is expected to identify and add the required subpackages e.g. networkmanager-cli, networkmanager-tui & networkmanager-wifi to get above functionalities. In other Linux distributions, above features plus unwanted features like bluetooth, adsl, wwan, vpn, l2tp, ppp etc are installed along with their dependencies.

Use package database or apk search <pkgname> to find subpackages related to a package.

Development environment

Compiling in Alpine Linux may be more challenging because it uses musl-libc instead of glibc. The build-base meta package provides regular compiler stuff such as binutils, gcc, g++, make etc..

# apk add build-base

The alpine-sdk meta package is provided to build packages for Alpine Linux. It includes abuild, build-base, and git.

# apk add alpine-sdk

To install CMake:

# apk add cmake extra-cmake-modules

ccache and a lot other tools are also available in Alpine Linux.