How to Install / Remove packages on Alpine Linux

How to Install / Remove packages on Alpine Linux. Alpine Linux commands to add and delete packages

 

You can use apk (Alpine Linux package manager) command to install, remove and upgrade packages on the server.

Use ‘apk add [package_name]’ command to install package on Alpine Linux Server.

‘apk delete [package_name]’ command will delete the package from the server.

 
1. Log into Alpine Linux server as ‘root’ user

2. Run the command ‘apk add [package]’ to install package on the server

Example : apk add supervisor

 
You can add “--interactive” option with ‘apk add’ command to ask for confirmation before installing the package.

Example :

apk add [package_name] --interactive
The following NEW packages will be installed:
After this operation, 47 MiB of additional disk space will be used.
Do you want to continue [Y/n]?

Installation will proceed only after getting confirmation from your end.

 
Use “--no-cache” option if you do not want to use local cache path.

# apk add [package_name] --no-cache

 
If you want to print less information while installing a package then use ‘--quiet’ option with apk add.

Example:

# apk add [package_name] --quiet

 

Steps to delete / Remove a package from Alpine linux Server

 

1. Log into server as ‘root’ user

2. Execute the command ‘apk del [package_name]’ to delete the package

Example :

# apk del supervisor

 
To print less information while deleting use the ‘--quiet’ option.

Example :

# apk del supervisor --quiet

 
If you use “--interactive” option, apk add will ask for confirmation before deleting the package.

Example :

# apk del [package_name] --interactive
The following packages will be REMOVED:
After this operation, 47 MiB of disk space will be freed.
Do you want to continue [Y/n]?