I created a script for the initial setup of Omeka Classic on Amazon Lightsail.

This is the “Omeka Classic version” of the following article.

I hope this serves as a helpful reference when using Omeka Classic with Amazon Lightsail.

# Variables
OMEKA_PATH=/home/bitnami/htdocs/omeka

## Do not include hyphens
DBNAME=omeka
VERSION=3.0.3

#############

set -e

mkdir -p $OMEKA_PATH

# Download Omeka
wget https://github.com/omeka/Omeka/releases/download/v$VERSION/omeka-$VERSION.zip
unzip -q omeka-$VERSION.zip

mv omeka-$VERSION/* $OMEKA_PATH

# Move .htaccess
mv omeka-$VERSION/.htaccess $OMEKA_PATH

# Remove unnecessary folders
rm -rf omeka-$VERSION
rm omeka-$VERSION.zip

# Remove existing index.html (if it exists)
if [ -e $OMEKA_PATH/index.html ]; then
  rm $OMEKA_PATH/index.html
fi

# Create database

cat <<EOF > sql.cnf
[client]
user = root
password = $(cat /home/bitnami/bitnami_application_password)
host = localhost
EOF

mysql --defaults-extra-file=sql.cnf -e "create database $DBNAME";

# Omeka S configuration

cat <<EOF > $OMEKA_PATH/db.ini
[database]
host     = localhost
username = root
password = $(cat bitnami_application_password)
dbname   = $DBNAME
prefix   = "omeka_"
charset  = "utf8"
EOF

sudo chown -R daemon:daemon $OMEKA_PATH/files
sudo apt install imagemagick -y