Installation tutorial for Access to Memory (AtoM) on nixOS Latest

Access to Memory (AtoM) is an open-source, web-based application used for describing, managing, and providing online access to archives and other cultural heritage materials. In this tutorial, we'll be discussing how to install AtoM on nixOS Latest.

Prerequisites

  • A nixOS Latest machine
  • A user with sudo privileges
  • Basic knowledge of the command line interface

Step 1: Update system

Start by updating your nixOS system to the latest version using the following command:

sudo nixos-rebuild switch

This will ensure that the system is up-to-date with the latest security patches and bug fixes.

Step 2: Install Apache, PHP, and MySQL

AtoM requires Apache, PHP, and MySQL to function. Install them by running the following command:

sudo nix-env -iA nixos.apacheHttpd nixos.php nixos.mysql

Step 3: Configure Apache, PHP, and MySQL

After the installation is complete, we need to configure Apache, PHP, and MySQL to work together.

Configure Apache

To configure Apache, we must edit /etc/nixos/configuration.nix and add the following lines:

services.httpd.enable = true;
services.httpd.adminAddr = "[email protected]";

This enables the Apache service and sets the admin email address.

Save the file and run sudo nixos-rebuild switch to apply the changes.

Configure PHP

To configure PHP, we must edit /etc/php.ini and set the following values:

date.timezone = Asia/Jakarta
post_max_size = 120M
upload_max_filesize = 100M
max_execution_time = 600
mysqli.default_socket=/run/current-system/sw/var/run/mysqld/mysqld.sock

This configures the timezone, file upload limits, execution time, and MySQL socket.

Save the file and restart Apache by running sudo systemctl restart httpd

Configure MySQL

To configure MySQL, we must edit /etc/nixos/configuration.nix and add the following lines:

services.mysql.enable = true;
services.mysql.package = pkgs.mysql;
services.mysql.defaultDatabase = "atom";

This enables the MySQL service, sets the MySQL package, and sets the default database name.

Save the file and run sudo nixos-rebuild switch to apply the changes.

Step 4: Install AtoM

Now that we have Apache, PHP, and MySQL set up, we can proceed to install AtoM.

Create a new directory to store the AtoM files and navigate to it:

mkdir /var/www/atom && cd /var/www/atom

Next, download the latest version of AtoM from the official website:

sudo wget https://github.com/artefactual/atom/releases/download/2.7.1/atom-2.7.1.tar.gz

Extract the downloaded file:

sudo tar -xzf atom-2.7.1.tar.gz

Change the ownership of the AtoM directory:

sudo chown -R http:http /var/www/atom

Step 5: Set up AtoM

To set up AtoM, we need to create a new MySQL user and database.

Log in to MySQL as the root user:

sudo mysql -u root -p

Create a new database and user:

CREATE DATABASE atom;
CREATE USER 'atom_user'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON atom.* TO 'atom_user'@'localhost';
FLUSH PRIVILEGES;

Exit MySQL by running exit.

Now, we need to configure AtoM to use the new database. Copy the sample configuration file:

sudo cp /var/www/atom/atom-2.7.1/config/atom.conf.example /var/www/atom/atom-2.7.1/config/atom.conf

Edit the configuration file and replace the values with the credentials for the MySQL user that we just created:

sudo nano /var/www/atom/atom-2.7.1/config/atom.conf

# Replace the following values
...
database.name = "atom"
database.username = "atom_user"
database.password = "mypassword"
...

Save and exit the file.

Step 6: Set up AtoM virtual host

To access AtoM from a web browser, we need to set up a virtual host.

Create a new virtual host file:

sudo nano /etc/nixos/vhosts.nix

Add the following lines to the file:

{
  vhosts = {
    "atom.example.com" = {
      root = "/var/www/atom/atom-2.7.1"
      index = "index.php"
      serverAliases = ["atom.example.com"]
      serverAdmin = "[email protected]"
      php = {
        enable = true
        fpm = true
      }
    };
  };
}

Replace atom.example.com with your preferred domain name, and [email protected] with a valid email address.

Save and exit the file.

Update the system configuration by running sudo nixos-rebuild switch

Step 7: Enable AtoM

Finally, we need to enable the AtoM service:

sudo systemctl enable httpd php-fpm mysqld

And restart the services:

sudo systemctl restart httpd php-fpm mysqld

That's it! AtoM should now be accessible from a web browser at the URL http://atom.example.com.

Conclusion

In this tutorial, we discussed how to install and set up Access to Memory (AtoM) on nixOS Latest. With AtoM, you can manage your archives and other cultural heritage materials easily and efficiently.