Skip to content

Core

The core:* commands download, install, update and inspect Omeka S itself. Together with config:create-db-ini they take a server from an empty directory to a working Omeka S installation.

Download Omeka S

core:download fetches an Omeka S release from GitHub, verifies it, and unpacks it into the destination directory. Without a version it downloads the latest release.

omeka-s-cli core:download /var/www/omeka-s

The destination must be empty, unless you pass --force. Add --create-destination to create a directory that does not exist yet. To pin a release, give its version number:

omeka-s-cli core:download ~/omeka-s-4.1.1 4.1.1 --create-destination

Install the core from a release ZIP

Use a release ZIP you already have (a path, a URL or a gh:/gl: file, see Refer to files) instead of downloading one:

omeka-s-cli core:download "$SCRATCH_DIR/omeka-s" --source "$CORE_ZIP" --create-destination

Configure the database connection

Omeka S reads its database credentials from config/database.ini. config:create-db-ini writes that file for the installation in the current directory:

cd /var/www/omeka-s
omeka-s-cli config:create-db-ini --host db --dbname omeka --username omeka --password "$DB_PASSWORD"

The database must exist and the user must be allowed to create tables in it. Pass the password from an environment variable or a secret store, so it does not end up in your shell history.

Install Omeka S

core:install runs the Omeka S installer: it creates the database tables, the administrator account, and the basic settings.

omeka-s-cli core:install \
    --title "Digital Collections" \
    --admin-name "Site Admin" \
    --admin-email admin@example.org \
    --admin-password "$ADMIN_PASSWORD" \
    --time-zone Europe/Brussels \
    --locale en_US

Set the administrator password

Without --admin-email and --admin-password, the administrator is admin@example.com with the password admin. Always set both on a server that others can reach.

Check the status

core:status reports not_installed, needs_migration or installed. core:version prints the version of the code on disk (add --installed for the version recorded in the database).

omeka-s-cli core:status
omeka-s-cli core:version
installed
4.2.1

For scripts, the --is-installed, --needs-migration and --is-ready flags print nothing and answer through the exit code (0 for yes, 1 for no). That makes an installation step safe to re-run:

if ! omeka-s-cli core:status --is-installed; then
    omeka-s-cli core:install --admin-email admin@example.org --admin-password "$ADMIN_PASSWORD"
fi

--json gives the full status as an object:

omeka-s-cli core:status --json | jq -r '.needsMigration'

Update Omeka S

core:update replaces the Omeka S code with a newer release (the latest, unless you name a version). It replaces application/, vendor/ and the files in the root directory, and leaves config/, files/, logs/, modules/ and themes/ alone. A new release can change the database schema; core:migrate applies those changes, like the Update database button in the admin interface.

The new files are first copied to a private staging directory, next to the Omeka S directory when it can and inside it otherwise. It has a random name that cannot be guessed, only you can read it, and its .htaccess denies web access and directory listings. Keep directory listings off for the folder that holds it (they usually are), so its name does not show up there. To stage the files outside every web root, pass --stage-dir with a directory on the same filesystem as Omeka S. Then the files are swapped in one entry at a time. If that fails, the previous files are put back, so a failed update leaves the old core in place. A file you cannot write to yourself, such as a .htaccess owned by another user, does not stop the update, as long as you can write to the Omeka S directory. A core folder you cannot write to, such as application/ owned by the web server, does: the update then rolls back.

If the staging directory has to stay (it then holds the only copy of the previous files) or cannot be removed, core:update says where it is, also under --quiet; the exit code stays 0 when the update itself worked. A staging directory left by an earlier, interrupted run is reported at the start of the next core:update. Check its old/ files, then remove it.

A customised .htaccess is replaced by the release's; the previous one is saved next to it as .htaccess.bak-<date-time>, so you can merge your changes back. Add --backup to keep the replaced files under ~/.omeka-s-cli/backups/core/<version>/<date-time>/ instead of deleting them.

omeka-s-cli core:update
omeka-s-cli core:migrate

Back up first

Take a database dump and a copy of the Omeka S directory before updating a production instance.

Work outside the Omeka S directory

Every command that operates on an installation finds it by looking at the current directory and its parents. From anywhere else, point to it with --base-path:

cd /tmp
omeka-s-cli core:version --base-path /var/www/omeka-s

Reference

All commands also accept the global options.

core:download

Download Omeka S core

omeka-s-cli core:download [options] <destination-path> [version-number]
Argument Description Default
<destination-path> Destination path
[version-number] Core version number (latest if not specified)
Option Description Default
-c, --create-destination Create destination directory
-f, --force Download even if the destination is not empty (and not an Omeka S installation)
--source <value> Install from this Omeka S release ZIP (a path or URL) instead of downloading version-number

config:create-db-ini

Create Omeka S database.ini configuration file

omeka-s-cli config:create-db-ini [options]
Option Description Default
-H, --host <value> Database host (default: localhost) 'localhost'
-P, --port <value> Database port 3306
-d, --dbname <value> Database name
-u, --username <value> Database username
-p, --password <value> Database password

core:install

Install Omeka S

omeka-s-cli core:install [options]
Option Description Default
-t, --title <value> Title for this Omeka S installation 'Omeka S'
-tz, --time-zone <value> Time zone (e.g., America/New_York) 'UTC'
-l, --locale <value> Locale (e.g., en_US) 'en_US'
-n, --admin-name <value> Name for the administrator user 'Admin'
-e, --admin-email <value> E-mail for the administrator user 'admin@example.com'
-p, --admin-password <value> Password for the administrator user 'admin'

core:status

Get Omeka S core status

omeka-s-cli core:status [options]
Option Description Default
-j, --json Output json
--is-installed Check if Omeka S is installed (exit code 0 if yes, 1 if no)
--needs-migration Check if Omeka S needs migration (exit code 0 if yes, 1 if no)
--is-ready Check if Omeka S is ready (installed and no migrations needed, exit code 0 if yes, 1 if no)

core:version

Get the downloaded Omeka S version

omeka-s-cli core:version [options]
Option Description Default
-i, --installed Get the installed Omeka S version.
-j, --json Output json

core:update

Update Omeka S core

omeka-s-cli core:update [options] [version-number]
Argument Description Default
[version-number] Core version number
Option Description Default
-f, --force Force download
-s, --skip-version-check Skip installed version check
--backup Keep the replaced core files in ~/.omeka-s-cli/backups/core/// (deleted otherwise)
--stage-dir <value> Directory to stage the new core files in, outside every web root and on the same filesystem as Omeka S (default: next to the Omeka S directory, or inside it)

core:migrate

Upgrade Omeka S database if needed

omeka-s-cli core:migrate