Instruções de Instalação do AtoM 2.6.4 para as Oficinas de Instalação para Arquivistas e Bibliotecários/as (Grupo CNPq UFF Ged/A):

 

Instruções de Instalação do AtoM 2.6.4 para as Oficinas de Instalação para Arquivistas e Bibliotecários/as (Grupo CNPq UFF Ged/A):


Com o Linux - Ubuntu 18.04 LTS (Bionic Beaver)
Tradução para o Português - Brasil de: https://accesstomemory.org/pt-br/docs/2.6/admin-manual/installation/linux/ubuntu-bionic/ 


Pesquisadores do Grupo CNPq UFF Ged/A
Coord. do Pesquisador Sérgio R. da S. Rodrigues


Download: 

https://docs.google.com/document/d/1BMv-fNLcuk3ecT7psUqq4CK2OoHeWKgCfLuj8DfSNkg/edit?usp=sharing 

Most of the configuration steps described in this document apply to any modern Linux environment, however some of them will apply only to Ubuntu and likely to any Ubuntu-based distribution.

This document is based in Ubuntu 18.04 LTS (Bionic Beaver). Once you have installed it, you should be able to follow the instructions described below. In particular, we are going to use Ubuntu packages that can be found under the repositories main and universe.

Important

Please make sure you have reviewed the requirements before proceeding. Also, you may want to consider setting up the firewall before you start installing the services described below to avoid exposing them to outside access.

Install the dependencies

MYSQL

AtoM 2.6 requires MySQL 8.0 or higher as it uses common table expressions. Also, we’ve experienced very good results using Percona Server for MySQL 8.0, so don’t be afraid and use it if you want!

 

For MySQL, check the latest APT repository version in their downloads page and download it from there or use wget as below. When asked about which product do you wish to configure, leave the defaults, select “Ok” and continue.

wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb

sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb

 

During the installation, you will be prompted to set a password for the default administrator user (root). We strongly recommend that you use a strong password and please write it down somewhere safe, you are going to need it later. Also, you will be asked to select the default authentication plugin, which has to be set to “Use Legacy Authentication Method”.

sudo apt update

sudo apt install mysql-server

 

Tip

The default MySQL installation is not completely secure, but it comes with a security script that can be executed to improve the default configuration:

sudo mysql_secure_installation

 

Finally, let’s configure our MySQL modes. The The MySQL server can operate in different SQL modes, which affects the SQL syntax MySQL supports and the data validation checks it performs. We’ll add our preferred mode settings in a new file.

First, let’s create a new file with our SQL modes.

Paste the following values in a new file at /etc/mysql/conf.d/mysqld.cnf and save:

[mysqld]

sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

optimizer_switch='block_nested_loop=off'

 

Now we’ll restart MySQL:

sudo systemctl restart mysql

 

ELASTICSEARCH

A relatively new search server based on Apache Lucene and developed in Java that has brought AtoM a lot of advanced features, performance and scalability. This is probably the biggest change introduced in AtoM 2.x and we are pleased with the results.

Ubuntu doesn’t provide a package but you can download it directly from the Elasticsearch site if you are unable to download it using the method that follows.

Make sure that Java is installed. In this example we are going to use OpenJDK but Oracle’s JVM would also work.

sudo add-apt-repository ppa:openjdk-r/ppa

sudo apt update

sudo apt install openjdk-8-jre-headless software-properties-common

 

After successfully installing Java, proceed to install Elasticsearch. Download and install the public signing key used in their repository:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

 

Important

Don’t miss the dash ( - ) at the end of the above command!

Now add their repository:

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

 

Ready to be installed. Run:

sudo apt update

sudo apt install elasticsearch

 

Start the service and configure it to start when the system is booted.

sudo systemctl enable elasticsearch

sudo systemctl start elasticsearch

 

 

WEB SERVER

There are many web servers out there capable of working well with PHP. Apache is probably the most popular and we like it, but we’ve found that Nginx adapts itself much better to limited resource environments while it also scales better and more predictably under high loads. You are welcome to try other solutions, but the following documentation will focus on Nginx.

Warning

The following instructions assume that the Nginx package is creating the directory /usr/share/nginx and that is the location where we are going to place the AtoM sources. However, we have been told this location may be different in certain environments (e.g. /var/www) or you may opt for a different location. If that is the case, please make sure that you update the configuration snippets that we share later in this document according to your location.

Nginx

In Ubuntu, the installation of Nginx is simple:

sudo apt install nginx

 

Nginx deploys a default server (aka VirtualHost, for Apache users) called default and you can find it in /etc/nginx/sites-available/default. In order to install AtoM you could edit the existing server block or add a new one. We are going to you show you how to do the latter:

sudo touch /etc/nginx/sites-available/atom

sudo ln -sf /etc/nginx/sites-available/atom /etc/nginx/sites-enabled/atom

sudo rm /etc/nginx/sites-enabled/default

 

We have now created the configuration file and linked it from sites-enabled/, which is the directory that Nginx will look for. This means that you could disable a site by removing its symlink from sites-enabled/ while keeping the original one under sites-available/, in case that you want to re-use it in the future. You can do this with the Nginx default server.

The following is a recommended server block for AtoM. Put the following contents in /etc/nginx/sites-available/atom.

upstream atom {

  server unix:/run/php7.2-fpm.atom.sock;

}


server {


  listen 80;

  root /usr/share/nginx/atom;


  # http://wiki.nginx.org/HttpCoreModule#server_name

  # _ means catch any, but it's better if you replace this with your server

  # name, e.g. archives.foobar.com

  server_name _;


  client_max_body_size 72M;


  # http://wiki.nginx.org/HttpCoreModule#try_files

  location / {

    try_files $uri /index.php?$args;

  }


  location ~ /\. {

    deny all;

    return 404;

  }


  location ~* (\.yml|\.ini|\.tmpl)$ {

    deny all;

    return 404;

  }


  location ~* /(?:uploads|files)/.*\.php$ {

    deny all;

    return 404;

  }


  location ~* /uploads/r/(.*)/conf/ {


  }


  location ~* ^/uploads/r/(.*)$ {

    include /etc/nginx/fastcgi_params;

    set $index /index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$index;

    fastcgi_param SCRIPT_NAME $index;

    fastcgi_pass atom;

  }


  location ~ ^/private/(.*)$ {

    internal;

    alias /usr/share/nginx/atom/$1;

  }


  location ~ ^/(index|qubit_dev)\.php(/|$) {

    include /etc/nginx/fastcgi_params;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_split_path_info ^(.+\.php)(/.*)$;

    fastcgi_pass atom;

  }


  location ~* \.php$ {

    deny all;

    return 404;

  }


}

 

Now you need to enable and reload Nginx:

sudo systemctl enable nginx

sudo systemctl reload nginx

 

PHP

Ubuntu 18.04 bundles PHP 7.2, which is much faster than older releases.

Our favorite way to deploy AtoM is using PHP-FPM, a process manager that scales better than other solutions like FastCGI. The following command will install it along with the rest of PHP extensions required by AtoM:

sudo apt install php7.2-cli php7.2-curl php7.2-json php7.2-ldap php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-fpm php7.2-mbstring php7.2-xsl php7.2-zip php-apcu

 

If you are using Memcached as cache engine, you will also need to install php-memcache:

sudo apt install php-memcache

 

Let’s add a new PHP pool for AtoM by adding the following contents in a new file called /etc/php/7.2/fpm/pool.d/atom.conf:

[atom]


; The user running the application

user = www-data

group = www-data


; Use UNIX sockets if Nginx and PHP-FPM are running in the same machine

listen = /run/php7.2-fpm.atom.sock

listen.owner = www-data

listen.group = www-data

listen.mode = 0600


; The following directives should be tweaked based in your hardware resources

pm = dynamic

pm.max_children = 30

pm.start_servers = 10

pm.min_spare_servers = 10

pm.max_spare_servers = 10

pm.max_requests = 200


chdir = /


; Some defaults for your PHP production environment

; A full list here: http://www.php.net/manual/en/ini.list.php

php_admin_value[expose_php] = off

php_admin_value[allow_url_fopen] = on

php_admin_value[memory_limit] = 512M

php_admin_value[max_execution_time] = 120

php_admin_value[post_max_size] = 72M

php_admin_value[upload_max_filesize] = 64M

php_admin_value[max_file_uploads] = 10

php_admin_value[cgi.fix_pathinfo] = 0

php_admin_value[display_errors] = off

php_admin_value[display_startup_errors] = off

php_admin_value[html_errors] = off

php_admin_value[session.use_only_cookies] = 0


; APC

php_admin_value[apc.enabled] = 1

php_admin_value[apc.shm_size] = 64M

php_admin_value[apc.num_files_hint] = 5000

php_admin_value[apc.stat] = 0


; Zend OPcache

php_admin_value[opcache.enable] = 1

php_admin_value[opcache.memory_consumption] = 192

php_admin_value[opcache.interned_strings_buffer] = 16

php_admin_value[opcache.max_accelerated_files] = 4000

php_admin_value[opcache.validate_timestamps] = 0

php_admin_value[opcache.fast_shutdown] = 1


; This is a good place to define some environment variables, e.g. use

; ATOM_DEBUG_IP to define a list of IP addresses with full access to the

; debug frontend or ATOM_READ_ONLY if you want AtoM to prevent

; authenticated users

env[ATOM_DEBUG_IP] = "10.10.10.10,127.0.0.1"

env[ATOM_READ_ONLY] = "off"

 

The process manager has to be enabled and restarted:

sudo systemctl enable php7.2-fpm

sudo systemctl start php7.2-fpm

 

If the service fails to start, make sure that the configuration file has been has been pasted properly. You can also check the syntax by running:

sudo php-fpm7.2 --test

 

If you are not planning to use the default PHP pool (www), feel free to remove it:

sudo rm /etc/php/7.2/fpm/pool.d/www.conf

sudo systemctl restart php7.2-fpm

 

GEARMAN JOB SERVER

Gearman job server is required by AtoM as of version 2.2.

sudo apt install gearman-job-server

 

We’ll configure the job server and the workers after initial installation (see below). Full configuration detalis can be found here:

OTHER PACKAGES

In order to generate PDF finding aids, AtoM requires Apache FOP 2.1 to be installed. Fortunately, Apache FOP 2.1 can now be installed directly from Ubuntu packages using the command below.

 

Note

The command specified below uses the --no-install-recommends parameter: this is intentional and ensures that only dependencies are installed and not ‘recommended’ packages. If --no-install-recommends is not specified, openjdk-8-jre will be installed as a dependency for one of the recommended packages. Since openjdk-8-jre-headless was already installed in the Elasticsearch installation section above, we want to prevent installing the openjdk-8-jre package as well.

sudo apt install --no-install-recommends fop libsaxon-java

 

If you want AtoM to be able to process digital objects in formats like JPEG or to extract the text from your PDF documents, there are certain packages that you need to install. They are not mandatory but if they are found in the system, AtoM will use them to produce digital object derivatives from your master objects. for more information on each, see: Requirements: other dependencies. The following will install all the recommended dependencies at once:

sudo apt install imagemagick ghostscript poppler-utils ffmpeg

 

Download AtoM

Now that we have installed and configured all dependencies, we are ready to download and install AtoM itself. The safest way is to install AtoM from the tarball, which you can find in the download section. However, experienced users may prefer to check out the code from our public repository.

The following instructions assume that we are installing AtoM under /usr/share/nginx and that you are using AtoM 2.6.4.

OPTION 1: DOWNLOAD THE TARBALL

wget https://storage.accesstomemory.org/releases/atom-2.6.4.tar.gz

sudo mkdir /usr/share/nginx/atom

sudo tar xzf atom-2.6.4.tar.gz -C /usr/share/nginx/atom --strip 1

 

Please note that the tarball may not be available yet if this version is still in development. In this case, you can try the alternative installation method explained below.

OPTION 2: CHECK OUT THE CODE FROM OUR GIT REPOSITORY

Install git:

sudo apt install git

 

sudo mkdir /usr/share/nginx/atom

sudo git clone -b stable/2.6.x http://github.com/artefactual/atom.git /usr/share/nginx/atom

 

If you are not interested in downloading all the history from git, you could also truncate it to a specific number of revisions, e.g.: just one revision

git clone -b stable/2.6.x --depth 1 http://github.com/artefactual/atom.git /usr/share/nginx/atom

 

We use Composer to install and manage some third-party PHP libraries. To install Composer download and run the Composer installer according to the instructions at https://getcomposer.org/download/ in the “Command-line installation” section.

Once Composer is installed you will need to run it to install the required libraries. First, move to the AtoM folder:

cd /usr/share/nginx/atom

 

For production AtoM sites, the development libraries do not need to be included:

sudo ~/composer.phar install --no-dev

 

Or if you have installed Composer globally:

sudo composer install --no-dev

 

For development environments, the dev libraries should also be installed:

sudo ~/composer.phar install

 

After downloading the code, you will need to compile the CSS files:

sudo apt install npm make

sudo npm install -g "less@<4.0.0"

sudo make -C /usr/share/nginx/atom/plugins/arDominionPlugin

sudo make -C /usr/share/nginx/atom/plugins/arArchivesCanadaPlugin

 

 

 

Filesystem permissions

By default, Nginx runs as the www-data user. There are a few directories under AtoM that must be writable by the web server. The easiest way to ensure this is to update the owner of the AtoM directory and its contents by running:

sudo chown -R www-data:www-data /usr/share/nginx/atom

 

If you are deploying AtoM in a shared environment we recommend you to pay attention to the permissions assigned to others. The following is an example on how to clear all mode bits for others:

sudo chmod o= /usr/share/nginx/atom

 

Create the database

Assuming that you are running MySQL in localhost, please create the database by running the following command using the password you created earlier:

sudo mysql -h localhost -u root -p -e "CREATE DATABASE atom CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;"

 

Note

If you do not supply the MySQL root password after the -p, you will be prompted for it when you enter the command. If you do supply the password, there is no space following -p; in other words, -pPASSWORD. (Replace PASSWORD with the password you created.) Remember, supplying the password on the command line is less secure as it may be visible to others in the .bash_history file.

 

Notice that the database has been called atom. Feel free to change its name.

In case your MySQL server is not the same as your web server, replace “localhost” with the address of your MySQL server.

Warning

Plase make sure that you are using an empty database! Don’t reuse an old database unless it’s empty. You can always drop it by using the DROP DATABASE command and then create it again.

Additionally, it’s always a good idea to create a specific MySQL user for AtoM to keep things safer. This is how you can create a user called atom with password 12345 and the permissions needed for the database created above.

sudo mysql -h localhost -u root -p -e "CREATE USER 'atom'@'localhost' IDENTIFIED BY '12345';"

sudo mysql -h localhost -u root -p -e "GRANT ALL PRIVILEGES ON atom.* TO 'atom'@'localhost';"

 

Note that the INDEX, CREATE and ALTER privileges are only necessary during the installation process or when you are upgrading AtoM to a newer version. They can be removed from the user once you are finished with the installation or you can change the user used by AtoM in config.php.

 

Run the web installer

You should now be ready to run the installer. It’s a simple web interface that changes some internal configuration files according to your environment and adds the necessary tables and initial data to the database recently created.

Open your browser and type the URL in the address bar. The URL can greatly change depending on your web server configuration. The URL will usually be something like http://localhost. AtoM will redirect you to the installer automatically.

The installation process consists of a number of steps where you will be asked for configuration details such as the location of your database server. In some cases, it may provide default values, such as root for the database username. If you have followed this document to the letter (including creating a different database user in the database configuration step :ref:` above <linux-ubuntu-bionic-create-database>`, this is how you should fill the following fields:

  • Database name: atom

  • Database username: atom

  • Database password: 12345

  • Database host: localhost

  • Database port: 3306

  • Search host: localhost

  • Search port: 9200

  • Search index: atom

Of course, some of these fields will look very different if you are running AtoM in a distributed way, where your services like MySQL or Elasticsearch are running in separate machines.

The rest of the fields can be filled as you need:

  • Site title

  • Site description

  • Site base URL

  • Username

  • E-mail address

  • Password

Tip

You can always change the site title, site description, and Base URL later via Admin > Settings > Site information. See: Site information for more information. The Username, email, and password can also be changed by an administrator after installation via the user interface - see: Edit an existing user.

Deployment of workers

Gearman is used in AtoM to add support for asynchronous tasks like SWORD deposits, managing rights inheritance, and generating finding aids. Check out the following page for further installation details: Asynchronous jobs and worker management.

Important

You must complete the installation instructions found on the Job Scheduler page for your AtoM installation to be fully functional! Increasingly in AtoM, the job scheduler is used to support long-running tasks, some of which are core functionality such as updating the publication status of a descriptive hierarchy, moving descriptions to a new parent record, and much more. Please do this now! See:

Configure AtoM via the command-line

There are various settings that can only be configured via the command-line - for example, the default timezone of the application. Depending on your local requirements, it may be preferable to configure some of these now. For more information on these settings see: Manage AtoM configuration files.

Security considerations

Now that AtoM is installed, please take a moment to read our security section where we will show you how to configure the firewall in Ubuntu and back up AtoM.

We strongly encourage our users to configure a firewall because some of the services configured should not be exposed in the wild, e.g. Elasticsearch was not designed to be accessible from untrusted networks and it’s a common attack vector.

A maioria das etapas de configuração descritas neste documento se aplicam a qualquer ambiente Linux moderno, no entanto, algumas delas se aplicam apenas ao Ubuntu e provavelmente a qualquer distribuição baseada no Ubuntu.


Este documento é baseado no Ubuntu 18.04 LTS (Bionic Beaver). Depois de instalá-lo, você poderá seguir as instruções descritas abaixo. Em particular, vamos usar pacotes do Ubuntu que podem ser encontrados nos repositórios main e universe.

Importante

Verifique se você revisou os requisitos antes de continuar. Além disso, convém configurar o firewall antes de começar a instalar os serviços descritos abaixo para evitar expô-los a acesso externo.


Instale as dependências

MYSQL

AtoM 2.6 requer MySQL 8.0 ou superior, pois usa expressões de tabela comuns. Além disso, obtivemos resultados muito bons usando o Percona Server for MySQL 8.0, então não tenha medo e use-o se quiser!


Para MySQL, verifique a versão mais recente do repositório APT em sua página de downloads e faça o download de lá ou use wget como abaixo. Quando perguntado sobre qual produto você deseja configurar, deixe os padrões, selecione “Ok” e continue.


wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb

sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb



Durante a instalação, você será solicitado a definir uma senha para o usuário administrador padrão (root). Recomendamos fortemente que você use uma senha forte e anote-a em algum lugar seguro, pois você precisará dela mais tarde. Além disso, você será solicitado a selecionar o plug-in de autenticação padrão, que deve ser definido como “Use Legacy Authentication Method”.


sudo apt update

sudo apt install mysql-server

 

Dica

A instalação padrão do MySQL não é totalmente segura, mas vem com um script de segurança que pode ser executado para melhorar a configuração padrão:

 

sudo mysql_secure_installation

 

Finalmente, vamos configurar nossos modos MySQL. O servidor MySQL pode operar em diferentes modos SQL, o que afeta a sintaxe SQL que o MySQL suporta e as verificações de validação de dados que ele executa. Adicionaremos nossas configurações de modo preferido em um novo arquivo.

Primeiro, vamos criar um novo arquivo com nossos modos SQL.

Cole os seguintes valores em um novo arquivo em /etc/mysql/conf.d/mysqld.cnf e salve:

 

[mysqld]

sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

optimizer_switch='block_nested_loop=off'

 

Agora vamos reiniciar o MySQL:

 

sudo systemctl restart mysql



ELASTICSEARCH

Um servidor de busca relativamente novo baseado no Apache Lucene e desenvolvido em Java que trouxe ao AtoM muitos recursos avançados, desempenho e escalabilidade. Esta é provavelmente a maior mudança introduzida no AtoM 2.x e estamos satisfeitos com os resultados.

O Ubuntu não fornece um pacote, mas você pode baixá-lo diretamente do site do Elasticsearch, se não conseguir baixá-lo use o método a seguir.

Certifique-se de que o Java esteja instalado. Neste exemplo, vamos usar o OpenJDK, mas a JVM da Oracle também funcionaria.

 

sudo add-apt-repository ppa:openjdk-r/ppa

sudo apt update

sudo apt install openjdk-8-jre-headless software-properties-common

 

Depois de instalar o Java com sucesso, prossiga para instalar o Elasticsearch. Baixe e instale a chave de assinatura pública usada em seu repositório:


wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

 

Importante

 

Não perca o traço ( - ) no final do comando acima!

 

Agora adicione seu repositório:

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

 

Pronto para ser instalado.  Run:

 

sudo apt update

sudo apt install elasticsearch

 

Inicie o serviço e configure-o para iniciar quando o sistema for inicializado.

 

sudo systemctl enable elasticsearch

sudo systemctl start elasticsearch

 




WEB SERVER

Existem muitos servidores web capazes de trabalhar bem com PHP. O Apache é provavelmente o mais popular e nós gostamos dele, mas descobrimos que o Nginx se adapta muito melhor a ambientes de recursos limitados, enquanto também escala melhor e mais previsivelmente sob altas cargas. Você pode experimentar outras soluções, mas a documentação a seguir se concentrará no Nginx.

 

Aviso

As instruções a seguir assumem que o pacote Nginx está criando o diretório /usr/share/nginx e esse é o local onde colocaremos as fontes AtoM. No entanto, fomos informados que esse local pode ser diferente em determinados ambientes (por exemplo, /var/www) ou você pode optar por um local diferente. Se for esse o caso, certifique-se de atualizar os snippets de configuração que compartilharemos posteriormente neste documento de acordo com sua localização.

 


Nginx

No Ubuntu, a instalação do Nginx é simples:

 

sudo apt install nginx

 

O Nginx implanta um servidor padrão (também conhecido como VirtualHost, para usuários do Apache) chamado default e você pode encontrá-lo em /etc/nginx/sites-available/default. Para instalar o AtoM você pode editar o bloco de servidor existente ou adicionar um novo. Vamos mostrar a você como fazer o último:

 

sudo touch /etc/nginx/sites-available/atom

sudo ln -sf /etc/nginx/sites-available/atom /etc/nginx/sites-enabled/atom

sudo rm /etc/nginx/sites-enabled/default

 

Agora criamos o arquivo de configuração e o vinculamos a partir de sites-enabled/, que é o diretório que o Nginx procurará. Isso significa que você pode desabilitar um site removendo seu link simbólico de sites-enabled/ enquanto mantém o original em sites-available/, caso queira reutilizá-lo no futuro. Você pode fazer isso com o servidor padrão Nginx.

Veja a seguir um bloco de servidor recomendado para AtoM. Coloque o seguinte conteúdo em /etc/nginx/sites-available/atom.

 

 

upstream atom {

  server unix:/run/php7.2-fpm.atom.sock;

}


server {


  listen 80;

  root /usr/share/nginx/atom;


  # http://wiki.nginx.org/HttpCoreModule#server_name

  # _ means catch any, but it's better if you replace this with your server

  # name, e.g. archives.foobar.com

  server_name _;


  client_max_body_size 72M;


  # http://wiki.nginx.org/HttpCoreModule#try_files

  location / {

    try_files $uri /index.php?$args;

  }


  location ~ /\. {

    deny all;

    return 404;

  }


  location ~* (\.yml|\.ini|\.tmpl)$ {

    deny all;

    return 404;

  }


  location ~* /(?:uploads|files)/.*\.php$ {

    deny all;

    return 404;

  }


  location ~* /uploads/r/(.*)/conf/ {


  }


  location ~* ^/uploads/r/(.*)$ {

    include /etc/nginx/fastcgi_params;

    set $index /index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$index;

    fastcgi_param SCRIPT_NAME $index;

    fastcgi_pass atom;

  }


  location ~ ^/private/(.*)$ {

    internal;

    alias /usr/share/nginx/atom/$1;

  }


  location ~ ^/(index|qubit_dev)\.php(/|$) {

    include /etc/nginx/fastcgi_params;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_split_path_info ^(.+\.php)(/.*)$;

    fastcgi_pass atom;

  }


  location ~* \.php$ {

    deny all;

    return 404;

  }


}

 

Agora você precisa habilitar e recarregar o Nginx:

 

sudo systemctl enable nginx

sudo systemctl reload nginx

 

 

PHP

O Ubuntu 18.04 inclui o PHP 7.2, que é muito mais rápido que as versões mais antigas.

Nossa maneira favorita de implantar o AtoM é usando o PHP-FPM, um gerenciador de processos que escala melhor do que outras soluções como FastCGI. O comando a seguir irá instalá-lo junto com o restante das extensões PHP exigidas pelo AtoM:

 

sudo apt install php7.2-cli php7.2-curl php7.2-json php7.2-ldap php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-fpm php7.2-mbstring php7.2-xsl php7.2-zip php-apcu

 

Se você estiver usando o Memcached como mecanismo de cache, também precisará instalar o php-memcache:

 

sudo apt install php-memcache

 

Vamos adicionar um novo pool PHP para AtoM adicionando o seguinte conteúdo em um novo arquivo chamado 

 /etc/php/7.2/fpm/pool.d/atom.conf:

[atom]


; The user running the application

user = www-data

group = www-data


; Use UNIX sockets if Nginx and PHP-FPM are running in the same machine

listen = /run/php7.2-fpm.atom.sock

listen.owner = www-data

listen.group = www-data

listen.mode = 0600


; The following directives should be tweaked based in your hardware resources

pm = dynamic

pm.max_children = 30

pm.start_servers = 10

pm.min_spare_servers = 10

pm.max_spare_servers = 10

pm.max_requests = 200


chdir = /


; Some defaults for your PHP production environment

; A full list here: http://www.php.net/manual/en/ini.list.php

php_admin_value[expose_php] = off

php_admin_value[allow_url_fopen] = on

php_admin_value[memory_limit] = 512M

php_admin_value[max_execution_time] = 120

php_admin_value[post_max_size] = 72M

php_admin_value[upload_max_filesize] = 64M

php_admin_value[max_file_uploads] = 10

php_admin_value[cgi.fix_pathinfo] = 0

php_admin_value[display_errors] = off

php_admin_value[display_startup_errors] = off

php_admin_value[html_errors] = off

php_admin_value[session.use_only_cookies] = 0


; APC

php_admin_value[apc.enabled] = 1

php_admin_value[apc.shm_size] = 64M

php_admin_value[apc.num_files_hint] = 5000

php_admin_value[apc.stat] = 0


; Zend OPcache

php_admin_value[opcache.enable] = 1

php_admin_value[opcache.memory_consumption] = 192

php_admin_value[opcache.interned_strings_buffer] = 16

php_admin_value[opcache.max_accelerated_files] = 4000

php_admin_value[opcache.validate_timestamps] = 0

php_admin_value[opcache.fast_shutdown] = 1


; This is a good place to define some environment variables, e.g. use

; ATOM_DEBUG_IP to define a list of IP addresses with full access to the

; debug frontend or ATOM_READ_ONLY if you want AtoM to prevent

; authenticated users

env[ATOM_DEBUG_IP] = "10.10.10.10,127.0.0.1"

env[ATOM_READ_ONLY] = "off"

 

O gerenciador de processos deve ser ativado e reiniciado:

 

sudo systemctl enable php7.2-fpm

sudo systemctl start php7.2-fpm

 

Se o serviço não iniciar, certifique-se de que o arquivo de configuração foi colado corretamente. Você também pode verificar a sintaxe executando:

 

sudo php-fpm7.2 --test

 

Se você não planeja usar o pool PHP padrão (www), sinta-se à vontade para removê-lo:

 

sudo rm /etc/php/7.2/fpm/pool.d/www.conf

sudo systemctl restart php7.2-fpm

 

 

SERVIDOR DE TAREFAS DO GEARMAN


O servidor de trabalho Gearman é exigido pelo AtoM a partir da versão 2.2.

 

sudo apt install gearman-job-server

 

Vamos configurar o servidor de trabalho e os trabalhos após a instalação inicial (veja abaixo). Os detalhes completos da configuração podem ser encontrados aqui:

 

 

OUTROS PACOTES

 

Para gerar ajudas de localização de PDF, o AtoM requer a instalação do Apache FOP 2.1. Felizmente, o Apache FOP 2.1 agora pode ser instalado diretamente dos pacotes do Ubuntu usando o comando abaixo.

 

 

 

 

 

Nota

O comando especificado abaixo usa o parâmetro --no-install-recommends : isso é intencional e garante que apenas dependências sejam instaladas e não pacotes 'recomendados'. Se --no-install-recommends não for especificado, o openjdk-8-jre será instalado como uma dependência para um dos pacotes recomendados. Como o openjdk-8-jre-headless já foi instalado na seção de instalação do Elasticsearch acima, também queremos evitar a instalação do pacote openjdk-8-jre.

 

sudo apt install --no-install-recommends fop libsaxon-java

 

Se você deseja que o AtoM seja capaz de processar objetos digitais em formatos como JPEG ou extrair o texto de seus documentos PDF, existem alguns pacotes que você precisa instalar. Eles não são obrigatórios, mas se forem encontrados no sistema, o AtoM os usará para produzir derivados de objetos digitais de seus objetos mestres. para obter mais informações sobre cada um, consulte: Requisitos: outras dependências. O seguinte instalará todas as dependências recomendadas de uma só vez:

 

 

sudo apt install imagemagick ghostscript poppler-utils ffmpeg

 

 

Download AtoM

Agora que instalamos e configuramos todas as dependências, estamos prontos para baixar e instalar o próprio AtoM. A maneira mais segura é instalar o AtoM a partir do tarball, que você encontra na seção de download. No entanto, usuários experientes podem preferir verificar o código em nosso repositório público.

 

 

As instruções a seguir pressupõem que estamos instalando o AtoM em /usr/share/nginx e que você está usando o AtoM 2.6.4.

 

OPÇÃO 1: BAIXE O TARBALL


wget https://storage.accesstomemory.org/releases/atom-2.6.4.tar.gz

sudo mkdir /usr/share/nginx/atom

sudo tar xzf atom-2.6.4.tar.gz -C /usr/share/nginx/atom --strip 1

 

Observe que o tarball pode não estar disponível ainda se esta versão ainda estiver em desenvolvimento. Nesse caso, você pode tentar o método de instalação alternativo explicado abaixo.

 

OPÇÃO 2: CONFIRA O CÓDIGO DO NOSSO REPOSITÓRIO GIT

 

Instale o git:

sudo apt install git

 

sudo mkdir /usr/share/nginx/atom

sudo git clone -b stable/2.6.x http://github.com/artefactual/atom.git /usr/share/nginx/atom

 

 

se você não estiver interessado em baixar todo o histórico do git, também poderá truncá-lo para um número específico de revisões, por exemplo: apenas uma revisão

 

git clone -b stable/2.6.x --depth 1 http://github.com/artefactual/atom.git /usr/share/nginx/atom

 

Usamos o Composer para instalar e gerenciar algumas bibliotecas PHP de terceiros. Para instalar o Composer, baixe e execute o instalador do Composer de acordo com as instruções em https://getcomposer.org/download/ na seção “Instalação de linha de comando”.

Depois que o Composer estiver instalado, você precisará executá-lo para instalar as bibliotecas necessárias. Primeiro, vá para a pasta AtoM:

 

cd /usr/share/nginx/atom

 

Para sites AtoM de produção, as bibliotecas de desenvolvimento não precisam ser incluídas:

 

sudo ~/composer.phar install --no-dev

 

Ou se você instalou o Composer globally:


sudo composer install --no-dev

 

Para ambientes de desenvolvimento, as bibliotecas dev também devem ser instaladas:

 

sudo ~/composer.phar install

 

Após baixar o código, você precisará compilar os arquivos CSS:

 

sudo apt install npm make

sudo npm install -g "less@<4.0.0"

sudo make -C /usr/share/nginx/atom/plugins/arDominionPlugin

sudo make -C /usr/share/nginx/atom/plugins/arArchivesCanadaPlugin

 

Permissões do sistema de arquivos

Por padrão, o Nginx é executado como o usuário www-data. Existem alguns diretórios no AtoM que devem ser graváveis ​​pelo servidor web. A maneira mais fácil de garantir isso é atualizar o proprietário do diretório AtoM e seu conteúdo executando:

 

sudo chown -R www-data:www-data /usr/share/nginx/atom

 

Se você estiver implantando o AtoM em um ambiente compartilhado, recomendamos que preste atenção às permissões atribuídas a outras pessoas. O seguinte é um exemplo de como limpar todos os bits de modo para outros:

 

sudo chmod o= /usr/share/nginx/atom

 

Crie o banco de dados

Supondo que você esteja executando o MySQL no host local, crie o banco de dados executando o seguinte comando usando a senha que você criou anteriormente:

 

sudo mysql -h localhost -u root -p -e "CREATE DATABASE atom CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;"

 

Nota

Se você não fornecer a senha de root do MySQL após o -p, ela será solicitada ao digitar o comando. Se você fornecer a senha, não haverá espaço após -p; em outras palavras, -pPASSWORD. (Substitua PASSWORD pela senha que você criou.) Lembre-se, fornecer a senha na linha de comando é menos seguro, pois pode ser visível para outras pessoas no arquivo .bash_history.

 

Observe que o banco de dados foi chamado de atom. Sinta-se livre para mudar seu nome.

Caso seu servidor MySQL não seja igual ao seu servidor web, substitua “localhost” pelo endereço do seu servidor MySQL.

 

Aviso

Verifique se você está usando um banco de dados vazio! Não reutilize um banco de dados antigo, a menos que esteja vazio. Você sempre pode eliminá-lo usando o comando DROP DATABASE e, em seguida, criá-lo novamente.

 

Além disso, é sempre uma boa ideia criar um usuário MySQL específico para AtoM para manter as coisas mais seguras. É assim que você pode criar um usuário chamado atom com a senha 12345 e as permissões necessárias para o banco de dados criado acima.

 

sudo mysql -h localhost -u root -p -e "CREATE USER 'atom'@'localhost' IDENTIFIED BY '12345';"

sudo mysql -h localhost -u root -p -e "GRANT ALL PRIVILEGES ON atom.* TO 'atom'@'localhost';"

 

Observe que os privilégios INDEX, CREATE e ALTER são necessários apenas durante o processo de instalação ou quando você está atualizando o AtoM para uma versão mais recente. Eles podem ser removidos do usuário assim que você terminar a instalação ou você pode alterar o usuário usado pelo AtoM em config.php.

 

Execute o instalador da web

Agora você deve estar pronto para executar o instalador. É uma interface web simples que altera alguns arquivos de configuração interna de acordo com seu ambiente e adiciona as tabelas necessárias e os dados iniciais ao banco de dados criado recentemente.

Abra seu navegador e digite a URL na barra de endereços. A URL pode mudar muito dependendo da configuração do seu servidor web. A URL geralmente será algo como http://localhost. AtoM irá redirecioná-lo para o instalador automaticamente.

 

O processo de instalação consiste em várias etapas nas quais serão solicitados detalhes de configuração, como a localização do servidor de banco de dados. Em alguns casos, pode fornecer valores padrão, como root para o nome de usuário do banco de dados. Se você seguiu este documento à risca (incluindo a criação de um usuário de banco de dados diferente na etapa de configuração do banco de dados :ref:` acima <linux-ubuntu-bionic-create-database>`, é assim que você deve preencher os seguintes campos:

 

  • Database name: atom

  • Database username: atom

  • Database password: 12345

  • Database host: localhost

  • Database port: 3306

  • Search host: localhost

  • Search port: 9200

  • Search index: atom

É claro que alguns desses campos parecerão muito diferentes se você estiver executando o AtoM de forma distribuída, onde seus serviços como MySQL ou Elasticsearch estão sendo executados em máquinas separadas.

Os demais campos podem ser preenchidos conforme sua necessidade:

 

  • Site title

  • Site description

  • Site base URL

  • Username

  • E-mail address

  • Password

Dica

Você sempre pode alterar o título do site, a descrição do site e o URL base posteriormente em Admin > Configurações > Informações do site. Consulte: Informações do site para obter mais informações. O nome de usuário, e-mail e senha também podem ser alterados por um administrador após a instalação através da interface do usuário - consulte: Editar um usuário existente.

 

Implantação de tarefas

Gearman é usado no AtoM para adicionar suporte para tarefas assíncronas como depósitos SWORD, gerenciamento de herança de direitos e geração de auxílios de busca. Confira a página a seguir para obter mais detalhes de instalação: Asynchronous jobs and worker management.

Importante

Você deve concluir as instruções de instalação encontradas na página do Job Scheduler para que sua instalação do AtoM seja totalmente funcional! Cada vez mais no AtoM, o agendador de tarefas é usado para dar suporte a tarefas de longa duração, algumas das quais são funcionalidades essenciais, como atualizar o status de publicação de uma hierarquia descritiva, mover descrições para um novo registro pai e muito mais. Por favor, faça isso agora! Ver:

 

Configurar o AtoM por meio de linha de comando

Existem várias configurações que só podem ser configuradas por meio da linha de comando - por exemplo, o fuso horário padrão do aplicativo. Dependendo de seus requisitos locais, pode ser preferível configurar alguns deles agora. Para obter mais informações sobre essas configurações, consulte: Gerenciar arquivos de configuração AtoM.

 

Considerações de segurança

Agora que o AtoM está instalado, reserve um momento para ler nossa seção de segurança, onde mostraremos como configurar o firewall no Ubuntu e fazer backup do AtoM.

 

Recomendamos fortemente que nossos usuários configurem um firewall porque alguns dos serviços configurados não devem ser expostos em estado selvagem, por exemplo, O Elasticsearch não foi projetado para ser acessível a partir de redes não confiáveis ​​e é um vetor de ataque comum.


Pesquisadores do Grupo CNPq UFF Ged/A

Coord. do Pesquisador Sérgio R. da S. Rodrigues


Comentários

Postagens mais visitadas deste blog

DOCUMENTOS ARQUIVÍSTICOS DIGITAIS: CONSIDERAÇÕES SOBRE SUA CONCEITUAÇÃO

Repositórios arquivísticos digitais confiáveis (RDC-Arq) como plataforma de preservação digital em um ambiente de gestão arquivística

CNA Salvador 2024