Skip to content

Build mytoken From Source

Building mytoken from source is more complicated than installing it from a packaged release. In the following we describe the necessary steps.

Install golang

Please refer to the golang documentation on how to install go on your system. Be aware that your distribution might provide a golang package for easier installation. However, when installing from your distribution's package assert that the provided version is recent enough.


Mytoken requires at least golang 1.19

Build and install binaries

The mytoken server comes as a single binary. However, there is also a mytoken-setup and mytoken-migratedb binary that help with important setups.

To build and install all binaries run the following commands:

GO111MODULE=on go get
GO111MODULE=on go get
GO111MODULE=on go get

The binaries will be installed into $GOPATH/bin/.


If you want to make changes to the code or build without installing the binaries, you have to get the source code, e.g. with

git clone
To build all three binaries run the following in the git root directory:
GO111MODULE=on go build
GO111MODULE=on go build
GO111MODULE=on go build
This will place the binaries in your current working directory.

Create the relevant directories

The following directories are needed by mytoken and normally created by the distribution's package. You now have to create these manually.

Create the directory for the configuration file:

mkdir /etc/mytoken

Create a directory where the log files are stored:

mkdir /var/log/mytoken

Copy the example configuration

Copy the example configuration file to the created configuration directory:

cp config/example-config.yaml /etc/mytoken/

Create a service file

Create a file called /etc/systemd/system/mytoken.service with the following content:

Description=mytoken auditd.service

ExecReload=/bin/kill -HUP $MAINPID


ExecStart should point to your mytoken-server binary.

Setup and Configuration

For the remaining configuration please refer to the Deployment Guide starting at section 'Configuration'.

Last update: December 6, 2022 13:48:21
Back to top