rss logo

My commands and useful tips for Alpine Linux

Alpine Linux Logo

In this article, I'll be sharing a few tips on using Alpine Linux, a GNU/Linux distribution renowned for its small size, simplicity, and security. Unlike most other distributions, it doesn't use systemd which is quite rare these days. I've started using it for several different applications and services, and I must say I've been rather taken with its qualities. I'll be using this page as a reminder, in the hope that it will be useful to others.

Useful Commands

  • Update Alpine Linux:
root@host:~# apk add --upgrade apk-tools && apk upgrade --available
  • Install package:
root@host:~# apk add vim


  • Install python3:
root@host:~# apk add python3
  • Add pip:

Create and activate a virtual environment:

host:~$ python -m venv .web3 host:~$ source .web3/bin/activate

Install pip in the virtual environment and check the version:

(.web3) host:~$ python -m ensurepip (.web3) host:~$ python -m pip --version


Using Cron in Alpine Linux is quite special, especially if you're used to using Debian. Let's see how it works. For this example, let's say wa want to configure crond to run a python script (/root/ in this case) every 5 minutes.

  • Create a /etc/periodic/5min folder:
root@host:~# mkdir /etc/periodic/5min
  • Add an entry in the /etc/crontabs/root file for the /etc/periodic/5min folder:
*/5 * * * * run-parts /etc/periodic/5min
  • Create a /etc/periodic/5min/pscript (do not use the .sh extension) shell script:
#!/bin/sh /root/
  • Make the file executable :
root@host:~# chmod +x /etc/periodic/5min/pscript
  • Run a test:
root@host:~# run-parts --test /etc/periodic/5min/
  • Take into account modifications:
root@host:~# rc-service crond start && rc-update add crond

Installing VMware Tools

If you're installing Alpine Linux in a virtual machine in a VMware ESXi environment, it's recommended to install VMware Tools for optimum performance and functionality.

  • Edit /etc/apk/repositories and uncomment the community line:
  • Install the open-vmtools packages:
root@host:~# apk add open-vm-tools open-vm-tools-guestinfo open-vm-tools-deploypkg
  • Start the open-vmtools service:
root@host:~# rc-service open-vm-tools start
  • Enable open-vmtools at boot:
root@host:~# rc-update add open-vm-tools boot

How to upgrade Alpine Linux

Let's assume we want to upgrade Alpine Linux version from 3.19 to 3.20.

  • First, update the current Alpine Linux version:
root@host:~# apk add --upgrade apk-tools && apk upgrade --available
  • Edit the /etc/apk/repositories file and replace 3.19 number with 3.20:
  • Run the upgrade:
root@host:~# apk update && apk upgrade --available
  • Restart system:
root@host:~# reboot
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address