# Alpine CLI Usage

This page describes basic Alpine `apk` commands to use with Alpine repositories in Nexus Repository.

Before running these commands, configure your Alpine client to use your Nexus Alpine repository. See [Configure Alpine with Nexus](https://help.sonatype.com/en/configure-alpine-with-nexus.html "Configure Alpine with Nexus") for more information.

## Install Packages

Use an Alpine proxy or group repository when you want Alpine clients to install packages through Nexus Repository.

Update the package index:

```
apk update
```

Install a package:

```
apk add <package-name>
```

Where `<package-name>` is the name of the Alpine package you want to install.

For example:

```
apk add curl
```

## Publish Packages To A Hosted Repository

Use an Alpine hosted repository when you want to store internal `.apk` packages in Nexus Repository.

Use the following syntax to publish an Alpine package:

```
curl -X PUT -u <username>:<password> --upload-file <package-file>.apk "https://<nexus-host>/repository/<repository-name>/<alpine-version>/<channel>/<architecture>/<package-file>.apk"
```

Where,

- `<username>` \- Your Nexus username or user token namecode
- `<password>` \- Your Nexus password or user token passcode
- `<package-file>.apk` \- Alpine package file you want to publish
- `<nexus-host>` \- Host name and port for your Nexus Repository instance
- `<repository-name>` \- Name of the Alpine hosted repository
- `<alpine-version>` \- Alpine version path, for example `v3.19` or `edge`
- `<channel>` \- Alpine repository channel, for example `main` or `community`
- `<architecture>` \- Target package architecture, for example `x86_64` or `aarch64`

For example:

```
curl -X PUT -u admin:admin123 --upload-file my-package-1.0.0-r0.apk "https://example.nexus.com/repository/alpine-hosted/v3.19/main/x86_64/my-package-1.0.0-r0.apk"
```

## Remove Packages From A Hosted Repository

Use the following syntax to remove a package from an Alpine hosted repository:

```
curl -X DELETE -u <username>:<password> "https://<nexus-host>/repository/<repository-name>/<alpine-version>/<channel>/<architecture>/<package-file>.apk"
```

Where,

- `<username>` \- Your Nexus username or user token namecode
- `<password>` \- Your Nexus password or user token passcode
- `<nexus-host>` \- Host name and port for your Nexus Repository instance
- `<repository-name>` \- Name of the Alpine hosted repository
- `<alpine-version>` \- Alpine version path, for example `v3.19` or `edge`
- `<channel>` \- Alpine repository channel, for example `main` or `community`
- `<architecture>` \- Target package architecture, for example `x86_64` or `aarch64`
- `<package-file>.apk` \- Alpine package file you want to remove

For example:

```
curl -X DELETE -u admin:admin123 "https://example.nexus.com/repository/alpine-hosted/v3.19/main/x86_64/my-package-1.0.0-r0.apk"
```

## Learn More About APK Commands

For more Alpine Package Keeper commands, see the [Alpine Package Keeper documentation](https://wiki.alpinelinux.org/wiki/Alpine_Package_Keeper?__goaway_challenge=cookie&__goaway_id=9b091a7f59e9078aac0eea99749a081d#Overview).
