alpine-wiki

alpine + Webmin

Webmin is a complete tool focused on a gui for lazy and stupid users, it helps to manage easyle user, services and inclusivelly remote machines!

The problem with webmin is that does not support officially the Alpine Linux, so basically the workaround is to trick the system into thinking it’s Geento! There is a open issue for https://github.com/webmin/webmin/issues/2353 support it!

This material is copyright, check LICENSE at the end of the document! and you can also watch the mckaygerhard’s video also at https://t.me/alpine_linux/1402

This document will not explain anything; you must to obey, as must be cos just works and works very well, please if you dont know check How to use this guide section before starts:

Install alpine linux

Warning: if you already have alpine running just foward to 0 - Environment part!

Those commands are for any distro, it will create a disk and runs a virtual machine to install Alpine Linux 3.20 as base system OS for webmin setup.

You can use alpine 3.13, to 3.21, or edge… any alpine will work since 3.13 to install webmin system. In this part we use 3.20 but any other version still work!

mkdir -p /home/general/VM/alpine320 && cd /home/general/VM/alpine320

qemu-img create -f raw computerint1alpine-vitualdisk1-file.raw 6G

wget -c -t8 --no-check-certificate http://dl-cdn.alpinelinux.org/alpine/v3.20/releases/x86_64/alpine-extended-3.20.0-x86_64.iso

/usr/bin/qemu-system-x86_64  -m 2048 -name "computerint1alpine320" \
 -cpu host -machine q35 \
 -device rtl8139,netdev=nd1 -netdev user,id=nd1,restrict=off,hostfwd=tcp::3222-:22,hostfwd=tcp::9080-:80,hostfwd=tcp::9443-:443 \
 -device virtio-keyboard -device virtio-mouse -device virtio-tablet -device virtio-vga,max_outputs=1 \
 -drive file=computerint1alpine-vitualdisk1-file.raw,format=raw \
 -cdrom alpine-extended-3.20.0-x86_64.iso -boot d

the setup-alpine command procedure

Then reboot and if you are using a virtual machine change the line -boot d to ` -boot c`

1 - Setup environment

Do not miss or bypass any package or command, or webmin will silend fails, this first part will setup main and community repositories, later install dependencies for the installation and also core running webmin software, and at last will setup console font, please if you dont know check How to use this guide section, otherwise runs all of the following commands as root user:

cat > /etc/apk/repositories << EOF
http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community
EOF

apk update

apk add openssl perl perl-net-ssleay perl-io-socket-ssl perl-io-tty \
 perl-datetime perl-datetime-timezone perl-datetime-locale attr diffutils \
 at dcron man-pages nano binutils coreutils readline shared-mime-info \
 grep gawk sed attr dialog lsof less groff procps wget curl terminus-font \
 file findutils gawk tree pciutils usbutils lshw tzdata tzdata-utils \
 zip unzip p7zip xz tar cabextract cpio binutils lha gzip lz4 \
 ethtool musl-locales musl-locales-lang  arch-install-scripts util-linux \
 docs iproute2-minimal psmisc net-tools lsof curl wget apkbuild-cpan

rc-update add consolefont boot

Warning: execute all the commands before, if you dont know how to, check How to use this guide

2 - Download and setup webmin

Webmin does not have a way to automate the installation, but at the end of the document we have a full automation way.

This download, extracted the files, invoke setup and answer the questions; please if you dont know how check How to use this guide section, otherwise runs all of the following commands as root user: this part will install minimal WEBMIN, in the 4 - Full automated way section section there are ionstructions for FULL WEBMIN install with all the need tools, this section si the mosft faster, and you can watch the video https://t.me/alpine_linux/1402

apk add aria2

cd /tmp

aria2c https://github.com/webmin/webmin/releases/download/2.202/webmin-2.202-minimal.tar.gz

gunzip webmin-2.202-minimal.tar.gz

tar xf webmin-2.202-minimal.tar

mkdir -p /usr/share/webapps

webmin-2.202/setup.sh /usr/share/webapps/webmin

After runs last command, a question will raise, follow those directions:

After answered all the previous questions listed as indicated, then can open a browser and go to http://<webserveripaddres>:10000 where the <webserveripaddres> is the ip address of your computer, that you can check it using the command ip add | grep inet (use the second lines)

4 - Configuration for modules

The installation only provides core functionality of webmin, but for full power like ipv6 support, filesystem or raid detection, user management, module addition, or not have problems before installing the most basic modules we still need to install some additional packages, this avoid problems when you try to install extra modules of the webmin system, so please if you dont know check How to use this guide section, otherwise runs all of the following commands as root user:

apk add doas bash shadow shadow-uidmap musl-locales musl-locales-lang \
 e2fsprogs btrfs-progs exfat-utils f2fs-tools dosfstools xfsprogs jfsutils zfs \
 acpi patch coreutils mdadm e2fsprogs-extra attr smartmontools doas-sudo-shim \
 iproute2 netpbm poppler-utils libjpeg-turbo-utils perl-socket6 libqrencode-tools

cat > /etc/doas.d/apkgeneral.conf << EOF
permit nopass general as root cmd apk
permit nopass general as root cmd service
EOF

useradd -m -U -c "" -s /bin/bash -G wheel,input,disk,floppy,cdrom,dialout,audio,video,lp,netdev,games,users,ping,wheel general

for u in $(ls /home); do for g in disk lp floppy audio cdrom dialout video lp netdev games users ping wheel; do addgroup $u $g; done;done

echo "general:general" | chpasswd

sed -i -r 's|#PermitRootLogin.*|PermitRootLogin no|g' /etc/ssh/sshd_config

echo AllowUsers general >> /etc/ssh/sshd_config

service sshd restart

Now everithing will be using the “general” user, so RUNS “su -l general” or LOGIN WITH general USER (same password so obvious), this user will have the power to install packages and also restart services as super user. Also will be from now the only user to get access using ssh to the machine.

Problems and fails

Following packages does not have any alternative in Alpine repositories

4 - Full automated way

This is a ful automated install using expect tk script, please if you dont know how to runs the bach of the commands here check How to use this guide cos each empty line means “wait the outpot of the command just pre executed”. This part will install the FULL WEBMIN rerlease with all need tools for future modules:

cat > /etc/apk/repositories << EOF
http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community
EOF

apk update

apk add doas bash shadow shadow-uidmap musl-locales musl-locales-lang \
 openssl perl perl-net-ssleay perl-io-socket-ssl perl-io-tty binutils \
 perl-datetime perl-datetime-timezone perl-datetime-locale attr diffutils \
 at dcron man-pages nano binutils coreutils readline shared-mime-info \
 grep gawk sed attr dialog lsof less groff wget curl terminus-font \
 file findutils gawk tree pciutils usbutils lshw tzdata tzdata-utils \
 zip unzip p7zip xz tar cabextract cpio lha gzip lz4 libqrencode-tools \
 ethtool musl-locales musl-locales-lang arch-install-scripts util-linux \
 docs iproute2-minimal psmisc net-tools lsof curl wget apkbuild-cpan \
 e2fsprogs btrfs-progs exfat-utils f2fs-tools dosfstools xfsprogs jfsutils zfs \
 acpi patch coreutils mdadm e2fsprogs-extra attr smartmontools doas-sudo-shim \
 iproute2 netpbm poppler-utils libjpeg-turbo-utils aria2 expect perl-socket6

cd /tmp && aria2c https://github.com/webmin/webmin/releases/download/2.202/webmin-2.202.tar.gz && tar xzf webmin-2.202.tar.gz

cat > /tmp/webmin.exp << EOF
#!/usr/bin/expect
set timeout -1
spawn "/tmp/webmin-2.202/setup.sh /usr/share/webapps/webmin"
expect "Config file directory " {send "\r"}
expect "Log file directory " {send "\r"}
expect "Full path to perl (default /usr/bin/perl):" {send "\r"}
expect "Operating system:" {send "87\r"}
expect "Version:" {send "3.20\r"}
expect "Web server port (default 10000):" {send "\r"}
expect "Login name (default admin):" {send "admin\r"}
expect "Login password:" {send "admin\r"}
expect "Password again:" {send "admin\r"}
expect "Use SSL (y/n):" {send  "n\r"}
expect "Start Webmin at boot time (y/n):" {send  "n\r"}
EOF
expect /tmp/webmin.exp && rm /tmp/webmin.exp
service webmin restart

cat > /etc/doas.d/apkgeneral.conf << EOF
permit nopass general as root cmd apk
EOF
useradd -m -U -c "" -s /bin/bash -G wheel,input,disk,floppy,cdrom,dialout,audio,video,lp,netdev,games,users,ping,wheel general
echo "general:general" | chpasswd

sed -i -r 's|#PermitRootLogin.*|PermitRootLogin no|g' /etc/ssh/sshd_config
echo AllowUsers general >> /etc/ssh/sshd_config
service sshd restart

How to use this guide

This guide structure all the commands in blocks, each block its separated by a line spaced, so you must type each line as is.. and hit enter, so you noted that then you typed each separated clocks of commands, copy/type only blocks separated by an empty line, all new(next) lines are made by just enter. the terminal will detect if must execute or not.

This guide is for install process, many parts will need you understand minimal knowledge of linux.

This guide assumed you have a serial port allowed in the targeted computer, also its important you shuold understand the way of the configuration in this guide.

Warning Some Linux or/and Mac terminals have security cut/paste locks, so if you paste, the first line will be preceded by garbage, check always the first char of your paste.

see also

LICENSE

CC BY-NC-SA: the project allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creators involved. If you remix, adapt, or build upon the material, you must license the modified material under identical terms, includes the following elements:

For more information check the [alpine/copyright.md](../../alpine/copyright.md)