Tuan-Anh Tran
A complete tutorial on how to write your first Arch Linux package
February 14, 2025

Writing your first Arch Linux package

Posted on February 14, 2025  •  2 minutes  • 317 words

This is just notes I wrote for myself or anyone looking to get started with packaging for Arch Linux.

Create an account with ArchLinux

Once you finished that, verify it with ssh command

$ ssh -T [email protected]

You should see sth like this

Hi USERNAME! You've successfully authenticated, but AUR does not provide shell access.

Write your first package

The example package I have for ramalama is here

There are 3 files in there:

The main one is PKGBUILD. It contains all the information about your package, such as name, version, dependencies, and build instructions.

# Maintainer: Tuan Anh Tran <[email protected]>
_pkgbase=ramalama
pkgname=$_pkgbase-git
pkgver=0.6.0.r0.b8e779
pkgrel=0
pkgdesc="The goal of RamaLama is to make working with AI boring."
arch=('any')
url="https://github.com/containers/ramalama"
license=('MIT')
depends=('python-argcomplete')
makedepends=('python-setuptools' 'git')
source=("git+$url.git")
sha256sums=('SKIP')

build() {
  cd "$_pkgbase"
  python setup.py build
}

package() {
  cd "$_pkgbase"
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}

The .SRCINFO file is generated flie and contains metadata about the package, such as the source URLs, checksums, and dependencies. You can generate it by running

$ makepkg --printsrcinfo > .SRCINFO

The .gitignore is self-explained. It contains a list of files that should be ignored by Git when committing changes to the repository. I keep it minimal by ignoring everything except the 3 files above.

*
!PKGBUILD
!.SRCINFO
!.gitignore

Publish the package

Check if the name is available on the Arch Linux AUR.

If the name is available, you can proceed to publish your package by simply pushing the changes to the AUR repository. ArchLinux AUR only accept master branch so make sure you’re using master branch.

$ git remote add origin https://aur.archlinux.org/<your_package_name>.git
$ git push origin master

And that should be it! You will see your package on the AUR website & under your AUR dashboard.

aur dashboard

Follow me

Here's where I hang out in social media