Difference between revisions of "Alpine newbie apk packages"

From Alpine Linux
Jump to: navigation, search
m (Users creation and defaults)
m (Users management and system access)
Line 127: Line 127:
<pre><nowiki>apk add libuser</nowiki></pre>
<pre><nowiki>apk add libuser</nowiki></pre>
If you do not have files <pre>/etc/login.defs</pre> and <pre>/etc/default/useradd</pre> we will need to create them
If you do not have files <code>/etc/login.defs</code> and <code>/etc/default/useradd</code> we will need to create them

Revision as of 13:30, 15 November 2019

Packages provide the basic components of an operating system, along with shared libraries, applications, services, and documentation.

This document will guide most new users to only basic needs about. If wants more in deep information see the ALpine package management behavior section in this document page.

New users: post setup closes to others systems

After install Alpine, you will need post install preparation of your system, due new/common users will need some extra suggestions to proper usage, due all the Alpine system are busybox based:

Note: Due you just install we will assumed you already have network available by wired connection, if you have speciall need respect newtworking please read Alpine advanced - networking to property setup your internet connection
machine name

First setup your machine name, that are already used in the network if you will connect to any net:

hostname MyMachine
echo "MyMachine" > /etc/hostname
sed -i -r 's#*# MyMachine#g' /etc/hosts

network setup


New users: common needed package to install

Packages and programs on alpine are described on Alpine_newbie: Packages overall info

enable repository packages

Repositories are need due are where will be retrieve those packages of programs as described on Alpine_newbie: Packages overall info, run:

cat > /etc/apk/repositories << EOF
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community

apk update

install basic tools

As explain in Alpine Linux:Overview, the system always will be minimalist, so if you expected a behavior like others linux those will be provided a minimal similitude to, runs:

apk add attr dialog dialog-doc bash bash-doc bash-completion grep grep-doc

apk add util-linux util-linux-doc pciutils usbutils binutils findutils readline

apk add man man-pages lsof lsof-doc less less-doc nano nano-doc curl curl-doc

export PAGER=less

manpages in alpine

You noted in previous section, that some packages has a "xxx-doc" related.. as explained beforein Alpine Linux:Overview, the system always will be minimalist, and if you wants a manpage of any program on a package of software, always must install the "program" and also "program-doc" related part package.

Take in consideration that in some earlier version of alpine not all package have a doc package yet available.

coreutils libc and utmps in alpine

Some programs like wall(1) depends on a libc feature named "utmp", that cannot be implemented in the libc in a secure way. For this reason, musl (the libc that Alpine uses) does not implement utmp; instead, it provides stubs that do nothing.

That is why programs that use utmp - such as wall, who or w - output nothing but still exit successfully. This is expected, a feature, and cannot be quick-fixed.

Some has pretty solution, by example a utmps login monitoring are only in "edge" repositories, so let's do that for some functionality aware, lest activate edge repository, install temporally software and later deactivating:

cat > /etc/apk/repositories << EOF
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community

apk update

apk add utmps

cat > /etc/apk/repositories << EOF
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://mirror.math.princeton.edu/pub/alpinelinux/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community

apk update

apk add  coreutils coreutils-doc

Note: take in consideration that there's a more little thin alternative to coreutils named ubase (with a doc also packaged) that provides better functionality rather than build-in busybox but less than coreutils offers
Users creation and defaults

When Alpine Linux is first installed by default it comes with the user root with no password set so the first step after boot into alpine fresh install are set a password to the user root, which its why is suggested to run setup-alpine to change root password. More info in the Setting users wiki page

Only root can manage users. Creating an account allows it to have it's own $HOME directory and allows you to limit access to the configuration of the operating system for security reasons.

# adduser general
Changing password for general
New password: 
Retype password: 
passwd: password for general changed by root
Tip: "general" are the name of the user, that name MUST be only lowercase letters and no spaces with no symbols
Users management and system access

But this user will not have enough privileges for a desktop made purposes, Alpine comes with high security so administrator (the root account owner) must perform the management of that user. Take care, for a server made there's no similar procedure!

Management of users can be made with the default busybox, but there's some packages that makes the life easy of the admins:

apk add libuser

If you do not have files /etc/login.defs and /etc/default/useradd we will need to create them

    touch /etc/login.defs
    touch /etc/default/useradd

Now we can changes some defaults and added to proper groups to access devices or perform connections so, those are the recommended groups where the user must have in:

  • disk:x:6:root,adm Only if need usage vith virtual machines and access to other partitions over new disks for
  • lp:x:7:lp IF will need to use printing services and printers management
  • floppy:x:11:root Backguard compatible group, use only if need access to external special devices
  • audio:x:18: Need for audio listening and management of sound volumes as normal user
  • cdrom:x:19: For access to disck writers and mounting DVD, BR or CD rom disk as normal user
  • dialout:x:20:root Need for dial private connections and use of modems as normal users
  • tape:x:26:root Need have into this if plan to use special devices for backup.. rarelly in no servers
  • video:x:27:root For usage of cameras, mor thant one GPU special features, as normal user
  • netdev:x:28: For network connections management as normal user
  • kvm:x:34:kvm Only if as normal user will manage graphically virtual machines.. rarelly on no servers
  • games:x:35: Need if you want to play games also specially need if will share score between users
  • cdrw:x:80: To write RW-DVD, RW-BR or RW-CD disk on a disk writing device
  • apache:x:81: Need if you will perfom development as normal user and want to publish locally on web server
  • usb:x:85: Need to access to special usb devices, deprecated group
  • users:x:100:games If you plan to used common files for all users, mandatory as desktop usage

To added a existing fresh created user into those grups (necesary for a desktop made purpose setup) run for each group name same command with same user as example:

for i in disk lp floppy audio cdrom dialout video netdev games users; do addgroup general $i; done
Tip: "general" are the previously crated user in previous section; must be the existing user login name session that wants to include in those groups

Now we can change default shell:

  • If you want to change the current user's shell, log in as that user and then inside their terminal session execute::
  • If you want to change a different user's shell, run as administration or as root:
    lchsh general

Where "general" was the name of a created user login in previous sections.

fonts and fonts configuration

Default internal fb fonts (tty console) or xorg fonts (desktops) are enough for defaulters, but if you can't see your language, you need to install the font that has glyphs (little picture) created for it; font-misc-misc are installed with X server so fonts for most languages (Japanese, Korean, Latin, Cyrillic) are already covered except for Arabic, Persian, Thai, Tamil, etc from inspecting the Wikipedia Page left column on languages for article translation. For complete info about fonts in alpine see Fonts configurations and settings in Alpine this section will resume and configure most usefully needs for users:

Those selection will cover most used languages and best fit for many setups:

apk add terminus-font ttf-inconsolata ttf-dejavu font-bitstream-* font-noto font-noto-* ttf-font-awesome font-noto-extra

Those selection will added special support for cirilyc like russian and serbian or similar setups:

apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic

Those selection will cover special language for Asiatic like Japanese or similar setups:

apk add terminus-font font-noto font-noto-thai font-noto-tibetan font-ipa font-sony-misc font-daewoo-misc font-jis-misc

Following will added some Chinese partial support fonts setups:

apk add font-isas-misc

Those selection will cover in most manner Arabic, Thai, Ethiopic, Hebrew, Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana languajes support for desktops setups:

apk add terminus-font font-bitstream-* font-noto font-noto-extra font-arabic-misc 

apk add font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic

apk add font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian

apk add font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai

The system font directory is located at /usr/share/fonts; user font location is at ~/.font due security. Configurations are reign by X server, using the ~/.Xresources file as main first reading of.

Configuration are made per user into ~/.fonts.confbut are XLM made and hard to configure.. more cheap and easy are into the ~/.Xresources file.

The following will setup for all users a minimal resource usage for fonts.. no antialiasing.. no hint... :

cat > /home/*/.Xresources << EOF
Xft.antialias: 0
Xft.rgba:      rgb
Xft.autohint:  0
Xft.hinting:   1
Xft.hintstyle: hintslight

configure system base
continue to desktop
Previous required What's next to read
Alpine newbie install manual Alpine newbie desktops

Alpine package management behavior

This section are not for new users, please go next to Alpine newbie desktops or Alpine Newbies: Xorg and Openbox if you only want to setup your system.

The programs, the software installed to Alpine comes from two places, a repository with the following structure: http://<host>/alpine/<version>/<brach> (an URl that can be invoked with apk listed in the /etc/apk/repositories file) and original upstream sources (those compiled as Unix-like traditional way).

As new user you can read the Alpine newbie apk packages page.. but please read the rest of this section to introduce to:

Alpine Software Packages

Alpine software repositories have main packages and contributions made:

  • About the main packages: Main packages are the Alpine package software that have direct support and updates from the Alpine core and main team, also have official special documentation. Are always available for all releases and will have almost substitutions if some are not continued from upstream. Commonly those packages are selected due their responsibility and stability respect upstream availability.
  • About the contribution ones: User package contribution repositories are those made by users in team with the official developers and well near integrated to the Alpine packages. Those have supported by those user contributions and could end if the user also ends respect with Alpine work, by example could not have substitution in next release due lack of support by upstream author.
Alpine APK user resources

Alpine new users have two resources for the packaging management, the https://pkgs.alpinelinux.org/packages page for search friendly way, and the Alpine newbie apk packages page that describes how to use the apk-tool easy.

Alpine APK quick infrastructure

Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension .apk, and are often called "a-packs".

The apk command are located at /sbin/apk, admin and manages the getting of the packages of software, it uses /etc/apk/ place for the configurations files, and stores all downloaded "a-packs" files in /etc/apk/cache from the repositories before unpacks and put the package files compiled into the installed system.

Table of busybox sustitutions
Table of comparison with other Linux for packages
OS File Format Tools
Alpine .apk apk
Debian .deb apt,aptitude
Geento .tbz2 emerge
FreeBSD .txz pkg

Tutorial series

Previous required What's next to read
Alpine newbie install manual Alpine newbie desktops

See Also