How to get regular stuff working: Difference between revisions

From Alpine Linux
m (Update mdocml-apropos to mandoc-apropos)
m (Restored introduction sentence)
 
(26 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Man pages ==
To minimize footprint, Alpine Linux comes with [[BusyBox]] by default. [[BusyBox]] is set up as an endpoint for numerous symlinks that substitute various utilities. The utilities in [[BusyBox]] generally have fewer options and hence missing some functionality. This page explains how to get the regular utilities working as found in other Linux distributions. Installing the relevant packages, replaces [[BusyBox]] symlinks. 


Not all man-pages are in Alpine, but this will get you most of the way there:
== Core utilities ==
{{Main|GNU core utilities}}


    '''apk add mandoc man-pages mandoc-apropos less less-doc'''
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:
    '''export PAGER=less'''


The above only provides ''core'' man pages. Other packages typically don't include their own man pages (nor other documentation). Rather, they provide an associated package that carries such stuff. For example:
{{Cmd|# apk add {{pkg|coreutils}}}}


    $ '''apk add curl'''
== Util-linux  ==
    $ '''man curl'''
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:
    man: No entry for curl in the manual.
{{Cmd|# apk add {{pkg|util-linux}}}}
    $ '''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>


'''NOTE:''' Not all packages separate out their documentation, but it is the ''Alpine Way'' (e.g. small footprint). Some packages don't provide any installable documentation at all, neither within themselves nor an associated doc packages. Further, appending "-doc" is merely a convention. In fact, the core man documentations are in man-pages (as in the ''apk add ...'' command, above). To find the right documentation package, try something like:
== Search utilities  ==
Standard search tools <code>grep</code> and <code>find</code> can be installed by installing the packages {{pkg|grep}} and {{pkg|findutils}} as follows:
{{Cmd|# apk add {{pkg|grep}} {{pkg|findutils}} }}


    $ '''apk search gcc | grep ^gcc'''
== Bash shell ==
    gcc-objc-5.3.0-r0
{{Main|Change default shell}}
    gcc-gnat-5.3.0-r0
The default shell used by Alpine Linux is the busybox variant of the [[BusyBox#Ash_shell|ash shell]]. To install {{pkg|bash}}:
    gcc-5.3.0-r0
{{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}
    gcc-java-5.3.0-r0
    gcc-doc-5.3.0-r0    <span style="color: green;">''Here it is!''</span>


'''FINALLY:''' If you're wondering why I've added ''less'' (and ''less-doc''), it's because ''man'' doesn't work correctly with ''more'' (the default pager). Don't fret too much about bloating up Alpine, though - adding man pages has a bigger footprint than less (''"less is more than man"???'')
== 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.  


If you would like documentation packages to be pulled in automatically you can add the  <code>docs</code> meta package.
{{Cmd|# apk add {{pkg|pciutils}} {{pkg|usbutils}}}}


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


==== Shell @ commandline ====
== Disk Management ==


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.
Managing (removable) disks is much easier with udisks.


* Funny characters at the console
{{Cmd|# apk add {{pkg|udisks2}}}}
Edit the file at {{Path|/etc/rc.conf}} and change line 92 to:
  unicode="YES"


* Bash
To see the mounted disks:
It is easy enough to have bash installed, but this does not mean the symlinks to busybox are gone.


Install bash with: 
{{Cmd|# udisksctl status}}
  apk add bash bash-doc bash-completion


* Shell utilities (things like grep, [[awk]], ls are all busybox symlinks)
== Network Management ==
  apk add util-linux pciutils usbutils coreutils binutils findutils grep
For network, you may want to install {{pkg|iproute2}}.


* /etc/{shadow,group} manipulation requires
{{Cmd|# apk add {{pkg|iproute2}}}}
  apk add shadow


==== Disk Management ====  
== Development environment ==


Disk management is so much easier with udisks or udisks2
Compiling in Alpine may be more challenging because it uses [https://musl.libc.org/ musl-libc] instead of glibc.  Alpine offers the regular compiler stuff such as {{pkg|gcc}}.


Installation   
{{Cmd|# apk add {{pkg|gcc}}}}


  apk add udisks2 udisks2-doc
The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine. It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.


See the mounted disks
{{Cmd|# apk add {{pkg|alpine-sdk}}}}


  udisksctl status
To install CMake:


== Compiling : a few notes and a reminder  ==
{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}


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.
{{pkg|ccache}} and a lot other tools are also available in Alpine.
 
Alpine offers the regular compiler stuff like gcc and cmake ... possible others
 
==== (unvalidated) apk packages to install so one can start building software ====
  apk add build-base gcc abuild binutils binutils-doc gcc-doc
 
==== a complete install for cmake looks like ====
 
  apk add cmake cmake-doc extra-cmake-modules extra-cmake-modules-doc
 
==== ccache is also available ====
 
  apk add ccache ccache-doc


[https://wiki.musl-libc.org/functional-differences-from-glibc.html Functional differences between musl and glibc]
[[Category:Installation]]
[[Category:Installation]]

Latest revision as of 10:50, 25 October 2024

To minimize footprint, Alpine Linux comes with BusyBox by default. BusyBox is set up as an endpoint for numerous symlinks that substitute various utilities. The utilities in BusyBox generally have fewer options and hence missing some functionality. This page explains how to get the regular utilities working as found in other Linux distributions. Installing the relevant packages, replaces BusyBox symlinks.

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

Development environment

Compiling in Alpine may be more challenging because it uses musl-libc instead of glibc. Alpine offers the regular compiler stuff such as gcc.

# apk add gcc

The alpine-sdk meta package is provided to build packages for Alpine. 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.

Functional differences between musl and glibc