How to enable and start services on Alpine Linux

How do I add or delete service at boot time on an Alpine Linux? How do I enable service such as Nginx/Apache at boot time on an Alpine Linux? How do I start/stop/restart services on an Alpine Linux?

Alpine Linux comes with OpenRC init system. This tutorial shows how to use the various command on OpenRC to manage services.

View status of all services

Type the following command:
# rc-status

Runlevel: default
 crond                                  [  started  ]
 networking                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual

The default run level is called default, and it started crond and networking service for us.

View service list

Type the following command:
# rc-status --list
Sample outputs:


You can change run level using the rc command:
# rc {runlevel}
# rc boot
# rc default
# rc shutdown

  1. boot – Generally the only services you should add to the boot runlevel are those which deal with the mounting of filesystems, set the initial state of attached peripherals and logging. Hotplugged services are added to the boot runlevel by the system. All services in the boot and sysinit runlevels are automatically included in all other runlevels except for those listed here.
  2. single – Stops all services except for those in the sysinit runlevel.
  3. reboot – Changes to the shutdown runlevel and then reboots the host.
  4. shutdown – Changes to the shutdown runlevel and then halts the host.
  5. default – Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)

To see manually started services, run:
# rc-status --manual

To see crashed services, run:
# rc-status --crashed

How to list all available services

Type the following command:
# rc-service --list
# rc-service --list | grep -i nginx

If apache2/nginx not installed, try the apk command to install it:
# apk add apache2

How to add/enable service at boot time

The syntax is:
rc-update add {service-name} {run-level-name}
To add apache2 service at boot time, run:
# rc-update add apache2
# rc-update add apache2 default
Sample outputs:

 * service apache2 added to runlevel default

How to start/stop/restart services on Alpine Linux

The syntax is as as follows:

How to start service

The syntax is:
# rc-service {service-name} start
# /etc/init.d/{service-name} start

How to stop service

The syntax is:
# rc-service {service-name} stop
# /etc/init.d/{service-name} stop

How to restart service

The syntax is:
# rc-service {service-name} restart
# /etc/init.d/{service-name} restart
Thus to stop, start, and restart an Apache2 service:
# rc-service apache2 stop
# rc-service apache2 start
### [ edit config file ] ###
# vi /etc/apache2/httpd.conf
### [ restart apache 2 after editing the file ] ###
# rc-service apache2 restart

Sample outputs:

For more info see Alpine Linux project.

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @