[If you came here to find out how to install the Atom editor from atom.io on CentOS 8, sorry - this is a different AtoM. Not saying you shouldn't install that Atom, in fact I used it to help prepare this guide, but it's a stroll in the park compared to what we're up to here.]

After successfully installing AtoM 2.4.x and 2.5.x on Ubuntu 19.10, I thought I'd go the extra mile and have a go on my favourite distro, the ever-reliable CentOS. With CentOS 8 out for a while now, this seemed the obvious choice with 6.x soon out of support and lots of 7.x users eyeing a path to 8.x.

There are a few guides already for installing on CentOS 6 and CentOS 7.

This guide assumes that you already installed CentOS 8 somewhere, in my case on a Virtualbox VM. If you need help with that, just search "Install CentOS 8"

AtoM is a free, open source application for managing archives and is built using PHP and symfony. The official installation guide recommends Ubuntu, Nginx and MySQL but in the interests of inclusivity, this is the proof-of-concept that it can be installed using CentOS, Apache and MariaDB.

A few gotchas to highlight - both PHP and Elasticsearch are required and there are strict version requirements. PHP 7.2 is the only version supported "officially" and similarly, Elasticsearch 5.x, or ES 1.x for AtoM 2.4.x.

So here we go.

# How to build a server for AtoM 2.5 on CentOS 8.x with PHP 7.2, Elasticsearch 5.6, Apache 2.4.x, MariaDB 10.x and PHP handler = PHP-FPM.
# Mostly applies to AtoM 2.4.x too, although AtoM 2.4 is not compatible with Elasticsearch > 1.x or with openJDK 11
# Tested on VirtualBox 6.1, kernel 4.x

# If you get stuck, a good resource is the AtoM forum https://groups.google.com/forum/#!forum/ica-atom-users

# Not sure if this is a new RHEL/CentOS 8 thing, but the installing user has to have sudo access.

# If you're tight on RAM or CPU power, atop is useful to see how your VM is performing under duress.

> sudo dnf install atop



# Use the epel and remi repositories
> sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
> sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
# only remi-safe is enabled by default
> sudo dnf config-manager --set-enabled remi

> sudo dnf install php72 php-fpm php-cli php-json php-ldap php-mysqlnd php-opcache php-mbstring php-xml php-zip php-apcu

# install apache
> sudo dnf install httpd
> sudo systemctl enable httpd


# installing PHP first, then apache *should* install /etc/httpd/conf.d/php.conf, but if not, try this :

/software/13-sample-apache-2-4-x-php-conf-for-centos-rhel


# you can tweak php-fpm to allocate a little more memory

> sudo nano /etc/php-fpm.d/www.conf
php_admin_value[memory_limit] = 512M
# For belt and braces, you can set this in php.ini too which will probably be in /etc/php.ini

# install maria-db server
> sudo dnf install mariadb-server
> sudo systemctl enable mariadb
> sudo systemctl start mariadb
> sudo mysql_secure_installation

# Install Java OpenJDK
# OpenJDK 11 not compatible with ES 1.x in case you are using this to install AtoM 2.4.x
> sudo dnf install java

# Install Elastic Search
# use the RPMs, the repos are problematic
# https://www.elastic.co/downloads/past-releases/elasticsearch-5-6-16
# pick 5.6.16 RPM and install

# before you start, if you don't have a lot of RAM, you can tweak the ES JVM options :

> sudo nano /etc/elasticsearch/jvm.options

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms512M
-Xmx512M
# You can adjust these upward depending on how much RAM you have allocated to your VM

> sudo systemctl enable elasticsearch
> sudo systemctl start elasticsearch
> sudo systemctl status elasticsearch

# Gearman job server
> sudo dnf install gearmand

# Update: Gearman doesn't work out of the box

# You need to configure it - follow instructions https://www.accesstomemory.org/en/docs/2.5/admin-manual/installation/asynchronous-jobs/

# Now the good stuff. Download and unpack AtoM 2.5.x (current 2.5.3) from
# https://www.accesstomemory.org/en/download/

# I prefer to keep a clean, unpacked copy in case you need to start again, so suggest you unpack to /home/user/Downloads

> cd /home/user/Downloads

> wget http://storage.accesstomemory.org/releases/atom-2.5.3.tar.gz
> tar -xzvf atom-2.5.3.tar.gz
# you should now have /atom-2.5.3 in /home/user/Downloads

> cp -r /home/user/Downloads/atom-2.5.3 /var/www/html/atom
> chown -R apache:apache /var/www/html/atom

# configure php-fpm

> sudo nano /etc/php-fpm.d/www-conf

listen.owner = apache
listen.group = apache
listen.mode = 0600

> sudo systemctl enable php-fpm
> sudo systemctl start php-fpm
> sudo php-fpm -t


# create atom database
> mysql -u root -p
> CREATE DATABASE atom CHARACTER SET utf8 COLLATE utf8_unicode_ci;
> GRANT ALL ON atom.* TO 'atom'@'localhost' IDENTIFIED BY 'password'; // Change the password !
> flush privileges;
> quit;

# Not sure if this is necessary for MariaDB, but easy to add anyway :

> sudo nano /etc/my.cnf.d/mariadb-server.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mariadb/mariadb.log
pid-file=/run/mariadb/mariadb.pid
sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# Don't use > optimizer_switch='block_nested_loop=off' as it doesn't exist in MariaDB

# Don't waste a day and a half trying to work out why apache can't write to the file system
> sudo nano /etc/selinux/config
SELINUX=disabled
# !!!
> setenforce 0

# Use an apache vhost, you know it makes sense
# I set up localhost.atom and remember to add it to /etc/hosts

# add to /etc/httpd/conf.d/vhost.conf


<VirtualHost localhost.atom:80>
    ServerAdmin This email address is being protected from spambots. You need JavaScript enabled to view it.
    DocumentRoot /var/www/html/atom

    ServerName localhost.atom
    ServerAlias localhost.atom

   # Performance tweaks that attempt to avoid 504 gateway timout errors during AtoM install

    KeepAliveTimeout 300
    Timeout 300

    <Directory "/var/www/html/atom">
        AllowOverride All
        # Allow open access:
        Require all granted
    </Directory>
    ErrorLog logs/error_log
    CustomLog logs/access_log combined
</VirtualHost>

# now ready to run the web installer

> sudo systemctl restart php-fpm

> sudo systemctl restart httpd
> http://localhost.atom

# Errors/blank screen - check /var/log/httpd/error_log and /var/log/php-fpm/www-error.log
> sudo tail /var/log/php-fpm/www-error.log
> sudo tail /var/log/php-fpm/error.log

# Debugging is harder than it should be - can try
http://localhost.atom/qubit_dev.php
# for debug mode

504 Gateway timeout at http://localhost.atom/index.php/sfInstallPlugin/loadData
"No connection information in your runtime configuration file for datasource [propel]"
# See https://groups.google.com/forum/#!msg/ica-atom-users/LKVkkvT1DkY/DTLXaKoABwAJ
# Essentially, try :
http://localhost.atom/index.php/sfInstallPlugin/configureSite
# The implication being that the DB is populated but the FPM process has timed out/mysql has dropped the connection
# There are workarounds in Nginx but I *think* the Apache KeepAlive and Timeout directives will address this.

# If all goes well, you can remove the Apache performance directives.

# If you need to start again from scratch
> mysql -u root -p
mysql > DROP DATABASE `atom`;
> CREATE DATABASE atom CHARACTER SET utf8 COLLATE utf8_unicode_ci;
> GRANT ALL ON atom.* TO 'atom'@'localhost' IDENTIFIED BY 'password'; // Change the password !
> quit
> sudo rm -rf /var/www/html/atom
> sudo cp -r /path_to_unpacked_atom /var/www/html/
> sudo chown -R apache:apache /var/www/html/atom
> http://localhost.atom

Good luck, remember this a dev server and should be hardened for live deployment