installdkim
Install OpenDKIM and configure it for GoAdmio, create the DKIM key of a domain, and print the DNS TXT value for it
- Command:
/go/installdkim - Category: Email
- Required option: None to install; a domain to create a key
- Output: Installer output, or the DKIM TXT value
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
DKIM signs outgoing mail so that other servers can confirm it really came from your domain. /go/installdkim sets up the server side of DKIM with OpenDKIM. It can:
- install OpenDKIM and write its configuration
- create a DKIM key for one domain, or for all domains that have none, and register it with OpenDKIM
- print the TXT value that you must publish in the domain's DNS
It does not publish DNS records. Use dkim for that, and checkdkim to confirm the result. New accounts get their key automatically when they are created with create.
Quick start
# 1. Install and configure OpenDKIM (once per server)
/go/installdkim
# 2. Create the key of a domain
/go/installdkim example.com
# 3. Print the TXT value to publish in DNS
/go/installdkim example.com dns
Syntax
/go/installdkim
/go/installdkim <domain>
/go/installdkim <domain> dns
/go/installdkim all
If you run it without root, it re-runs itself with sudo.
Options
| Form | What it does |
|---|---|
/go/installdkim |
Installs OpenDKIM and its tools, and writes the configuration. |
/go/installdkim <domain> |
Creates the DKIM key for the domain and adds it to the OpenDKIM tables. |
/go/installdkim <domain> dns |
Prints the TXT value for the domain's DNS record. It reads an existing key. |
/go/installdkim all |
Runs dkim for every hosted domain that does not have a key yet. |
The DKIM selector is always dkim, so the DNS record name is dkim._domainkey.<domain>.
Output
| Form | Output |
|---|---|
| Install | Installing DKIM... followed by the output of the package manager. |
| Create a key | Usually nothing. Blank lines can appear when the domain is already in a table. |
dns |
One line, the TXT value: v=DKIM1; k=rsa; p=<public key> |
all |
The output of dkim for each domain. |
Each run also adds a line to /var/log/go/installdkim.log. The all form always ends with status 1.
Examples
# Install OpenDKIM
/go/installdkim
# Create a key for a domain
/go/installdkim example.com
# Print the TXT value for the domain's DNS
/go/installdkim example.com dns
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
# Create keys for every domain that has none
/go/installdkim all
# Restart OpenDKIM so it reads the new tables
systemctl restart opendkim
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Mail is not signed | OpenDKIM is not running, or Postfix is not connected to it. The command does not start the service. | Restart OpenDKIM, and make sure Postfix uses the OpenDKIM service on inet:localhost:8891. See installmail. |
checkdkim shows None or Invalid |
The DNS record is not published, or holds an old key. | Publish the current value with dkim. |
| A new domain is not signed | OpenDKIM has not read the updated tables. | Restart OpenDKIM. |
The dns form prints an empty value |
The key file /etc/opendkim/<domain>/dkim.txt does not exist. |
Create the key first with /go/installdkim <domain>. |
| The printed value is too short | The public key is long and opendkim-genkey stored it in several quoted parts. The dns form prints only the first part. |
Build the value from the whole dkim.txt file by hand. |
An odd line *@ dkim._domainkey. in SigningTable |
See Known issues. | Delete the line, and restart OpenDKIM. |
opendkim-genkey: command not found |
The OpenDKIM tools are not installed. This also happens on an unsupported operating system. | Install opendkim-tools. |
Details
Files
| File | Purpose |
|---|---|
/etc/opendkim.conf |
OpenDKIM configuration. Overwritten by the install form. |
/etc/opendkim/TrustedHosts |
Hosts that OpenDKIM treats as internal. |
/etc/opendkim/KeyTable |
Maps each key name to its private key file. |
/etc/opendkim/SigningTable |
Maps each sender domain to its key. |
/etc/opendkim/<domain>/dkim.private |
The private key of the domain. |
/etc/opendkim/<domain>/dkim.txt |
The public key in DNS format. |
Install form
-
Installs
opendkimandopendkim-toolswithdnfon AlmaLinux, Rocky, CentOS, Red Hat, and Fedora, or withapton Debian and Ubuntu. -
Writes
/etc/opendkim.confwith these main settings:Setting Value SelectordkimModesv(sign and verify)Canonicalizationrelaxed/simpleSignatureAlgorithmrsa-sha256Socketinet:8891@localhostUserIDopendkim:opendkimOversignHeadersFromKeyTable,SigningTable,InternalHosts,ExternalIgnoreListThe files in /etc/opendkim/ -
On Debian and Ubuntu, also sets the daemon socket in
/etc/default/opendkimtoinet:8891@localhost, and the trust anchor file. -
Writes
/etc/opendkim/TrustedHostswith127.0.0.1,::1, and the server host name. -
Adds the fixed domains described under Known issues.
-
Creates the
opendkimsystem user.
It does not start OpenDKIM, and it does not change the Postfix configuration.
Create a key
For /go/installdkim <domain>, the command:
- Creates
/etc/opendkim/<domain>/and generates the key pair there withopendkim-genkeyand the selectordkim. - Makes the
opendkimuser the owner of the folder. - Adds the domain to
TrustedHosts,KeyTable, andSigningTable, if it is not there yet.
Known issues
- Fixed domains. The install form adds
blaclhost.comtoTrustedHosts, and a key and signing entry forw75.nettoKeyTableandSigningTable. These appear to be specific domains left in the script. The key file forw75.netdoes not exist unless that domain is hosted here. Edit the script before you use it on another server. - The install form is not safe to run twice. It overwrites
/etc/opendkim.confandTrustedHosts, which removes the domains added later toTrustedHostsand any changes you made to the configuration. It also appends thew75.netlines toKeyTableandSigningTableagain. - The install form continues into key creation. After the install, the command runs the create-a-key step with an empty domain name. From reading the script, this can add the invalid line
*@ dkim._domainkey.toSigningTableand can create key files directly in/etc/opendkim/. Check these files after an install. - Matching is by the start of the text. A domain is considered present in
TrustedHostswhen a line starts with its name, soexample.comalso matchesexample.com.au. - Long keys. The
dnsform prints only the first quoted part ofdkim.txt.
See also
| Command | Description |
|---|---|
dkim |
Add a DKIM TXT record in Cloudflare (auto-generated or custom value) |
checkdkim |
Check if a DKIM record is valid in GoAdmio |
installmail |
Install and configure webmail services (Postfix and Dovecot) |
installspf |
Install and configure the Postfix SPF policy daemon |
installdmarc |
Install and configure OpenDMARC |
create |
Create a GoAdmio account from the command line |