# SciELO Publishing Framework # HOW TO INSTALL MINIO ON ROCKY LINUX 8 ## Prerequisites - An Rocky Linux system. - A user with root or sudo privileges. This user will be used for installing new packages and make changes system-wide. ## Downloading MinIO on Rocky Linux Use the following command to download a standalone MinIO server on Linux hosts running 64-bit Intel/AMD architectures. Replace `/data` with the path to the drive or directory in which you want MinIO to store data. ```command dnf -y install wget wget https://dl.min.io/server/minio/release/linux-amd64/minio chmod +x minio mkdir /data mv minio /usr/local/bin ``` ## Create default configuration - This file serves as input to MinIO systemd service. Use this file to add `MINIO_VOLUMES` with the correct paths, `MINIO_OPTS` to add MinIO server options like `certs-dir`, `address`. MinIO credentials can be `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` in this file as well. - Run the command bellow to create the file with minio parameters. ```command cat <> /etc/default/minio # Volume to be used for MinIO server. MINIO_VOLUMES="/data" # Use if you want to run MinIO on a custom port. MINIO_OPTS="--address :9199" # Root user for the server. MINIO_ROOT_USER=spf-user # Root secret for the server. MINIO_ROOT_PASSWORD=spf-Password # setting access key to access the interface web MINIO_ACCESS_KEY="minio" # setting secret key. Avoid using the value default from this tutorial. MINIO_SECRET_KEY="miniostorage" EOT ``` ## Creating minio user to run the systemd - creating the user with no shell login and change binary and data directory ownership ```command useradd -r minio-user -s /sbin/nologin chown minio-user:minio-user /usr/local/bin/minio chown minio-user:minio-user /data ``` ## Systemd service MinIO on Rocky Linux - Systemd script is configured to run the binary from /usr/local/bin - Create minio.service in /etc/systemd/system/ ```command [Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/minio [Service] WorkingDirectory=/usr/local/ User=minio-user Group=minio-user EnvironmentFile=/etc/default/minio ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi" ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES # Let systemd restart this service always Restart=always # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Disable timeout logic and wait until process is stopped TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target # Built for ${project.name}-${project.version} (${project.name}) ``` Enable startup on boot ```command systemctl daemon-reload systemctl enable minio ``` Starting minio ```command systemctl start minio ``` [![image-1636415567865.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636415567865.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636415567865.png) ## Interface Web [![image-1636416514806.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636416514806.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636416514806.png) [![image-1636416589909.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636416589909.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636416589909.png) ## Reference link [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04-pt](https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04-pt) [https://github.com/minio/minio](https://github.com/minio/minio) # HOW TO INSTALL ROCKY LINUX 8 # HOW TO INSTALL MONGODB ON ROCKY LINUX ## Prerequisites - A fresh server running Rocky Linux 8 with a minimum of 10 GB of free disk space - A non-root user with sudo privileges configured on the server ## Update the System Login to the system using root or sudo user depending on your privilege configuration, and update the system using the following command. ```command sudo dnf update -y ``` ## Installing MongoDB The MongoDB package is not included in the default repositories for Rocky Linux 8 because it is not considered part of the "base" system. Thus, you need to add the repository containing the package before installing MongoDB. MongoDB comes in two editions the community edition and the enterprise edition. The community edition is free while the enterprise edition offers additional features. This guide is for the community edition. Run the following command to add the MongoDB Repository on your system. ``` cat > /etc/yum.repos.d/mongodb.repo << 'EOL' [mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc EOL ``` Once the repository is enabled, run the following command to install the mongoDB community edition. ```command dnf update dnf install -y mongodb-org ``` Once the installation is complete, verify the version installed as follows. ```command mongod --version ``` [![image-1636410940818.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636410940818.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636410940818.png) The MongoDB service doesn't start automatically after installation. You can verify this by running the command as follows. ```command systemctl status mongod ``` The output should be similar to that below: [![image-1636411003039.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636411003039.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636411003039.png) Since the service has not started, start it manually by running the following command. ```command systemctl start mongod ``` To enable MongoDB to automatically start on boot time, run the following command. ```command systemctl enable mongod ``` At this point, MongoDB has been installed and configured on the server. Verify the status of MongoDB service as follows. ```command systemctl status mongod ``` [![image-1636411097194.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636411097194.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636411097194.png) # HOW TO INSTALL POSTGRESQL ON ROCKY LINUX ## Prerequisites - An Rocky Linux system. - A user with root or sudo privileges. This user will be used for installing new packages and make changes system-wide. ## Installing PostgreSQL on Rocky Linux Install the latest version of PostgreSQL from the repository using the dnf command below. ```command dnf install postgresql-server.x86_64 ``` [![image-1636411419853.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636411419853.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636411419853.png) ## PostgreSQL Database Initialization Next, after the PostgreSQL installation is complete, you must initialize the PostgreSQL configuration and then start and enable the PostgreSQL service. 1. Execute the following command to initialize the PostgreSQL database configuration. ```command postgresql-setup --initdb --unit postgresql ``` 2. After that, start and enable the PostgreSQL service using the command below. ```command sudo systemctl enable postgresql sudo systemctl start postgresql ``` Now the PostgreSQL service is active and running, and it will run automatically on every boot. 3\. Now execute the command below to verify the PostgreSQL service. ```command systemctl status postgresql ``` If your PostgreSQL service is running, you will see the green output such as **"active(running)"** as below. Otherwise, you will see the red output such as "**failed**" following by the error message logs. [![image-1636411733930.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636411733930.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636411733930.png) ## Securing PostgreSQL Deployment During the installation, PostgreSQL will create a new system user and database user name as "**postgres**". And for this stage, you will be setting up a new password for the "**postgres**" user, both for the **system user** and **database user**. 1. Change the password for default system user "*postgres*" using the following command. ```command passwd postgres ``` Now type the new password for the system user "*postgres*". 2\. Next, to change the password for the "*postgres*" database user, you must log in to the PostgreSQL shell. First, log in as a system user "*postgres*" using the following command. ```command su - postgres ``` Now login to the PostgreSQL shell using the psql command below. ```command psql ``` Execute the following query to create a new password for the default "*postgres*" database user. ```command ALTER USER postgres WITH PASSWORD 'strongpostgrespassword'; ``` Change the string 'strongpostgrespassword' to your own password. Now type exit and press "**Ctrl+d**" to exit and log out from the '*postgres*' user shell. [![image-1636412051559.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412051559.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412051559.png) ## Change Authentication Method By default, local PostgreSQL users will connect to the PostgreSQL shell using the 'peer' method. The peer authentication method will work only for local connections. In the development environment, you can use this type of authentication, but for production, consider using the password-based authentication method. For this stage, you will learn how to change the default peer authentication method to password authentication using '**md5**'. 1\. First, log in to the PostgreSQL shell using the following command. ```command sudo -u postgres psql ``` Now execute the following query to check the location of the PostgreSQL configuration '**pg\_hba.conf**'. ```command SHOW hba_file; SHOW password_encryption; ``` You will see the output as below. [![image-1636412188727.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412188727.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412188727.png) You will notice the PostgreSQL configuration "pg\_hba.conf" are located at the '**/var/lib/pgsql/data**' directory, and the default password encryption for PostgreSQL on RHEL based operating system is '**md5**'. Now type '\\q' to exit and quit the PostgreSQL shell. 2. Next, change the working directory to '**/var/lib/pgsql/data**' and edit the configuration '**pg\_hba.conf**' using nano editor. ```command cd /var/lib/pgsql/data/ vi pg_hba.conf ``` [![image-1636412445157.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412445157.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412445157.png) At the bottom of the line, change the local authentication method to '**md5**' as below. [![image-1636412520423.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412520423.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412520423.png) Now press '**ESC**', type '**:wq**', and press "**Enter**" to save and exit. Using this configuration, you will be prompted for the password to log in to the PostgreSQL shell. 3\. Next, apply the new configuration by restarting the PostgreSQL service using the following command. ```command systemctl restart postgresql ``` Now every time you want to access the PostgreSQL shell, you must type the password for authentication. 4\. To make sure of the password authentication configuration, log in to the PostgreSQL shell using the following command. ```command su - postgres psql ``` Now you will be asked for a password for the default user '*postgres*'. Type the password for the '*postgres*' database user and press '**Enter**'. If your password is correct, you will see the PostgreSQL shell as follows. Otherwise, you will see the '**FATAL**' error because the password is incorrect. [![image-1636412705058.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412705058.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412705058.png) Additionally, you can use the one-line command to log in to the PostgreSQL shell as below. ```command # Log in as default "postgres" user sudo -u postgres psql # Log in as another user sudo -u postgres psql -U username ``` ## Creating New User and Database for your Application At this stage, you will learn how to create a new user and database on PostgreSQL. 1\. Log in to the PostgreSQL shell by executing the command below. ```command sudo -u postgres psql ``` Now type the password for PostgreSQL user '**postgres**'. 2\. Run the PostgreSQL query below to create a new user 'johndoe' with the password 'johndoestrongpassword' and give the user privileges for creating a new database and role. ```command CREATE USER spf WITH CREATEDB CREATEROLE PASSWORD 'spfstrongpassword'; ``` After that, verify the new user using the following query. ```command \du ``` Now you will see the new user 'spf' with the list of roles '**Create role**' and '**Create DB**' as below. [![image-1636412942826.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636412942826.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636412942826.png) 3. Next, to create a new user database on PostgreSQL, run the following query. ```command CREATE DATABASE spf OWNER spf; ``` Now verify the new database using the following query. ```command \l ``` And you will see the new database 'spf' with the owner 'spf' as the screenshot below. [![image-1636413026643.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636413026643.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636413026643.png) ## Reference link [https://www.howtoforge.com/how-to-install-postgresql-on-rocky-linux/](https://www.howtoforge.com/how-to-install-postgresql-on-rocky-linux/) # HOW TO INSTALL SCIELO OPAC ON ROCKY LINUX ## Prerequisites - An Rocky Linux system. - A user with root or sudo privileges. This user will be used for installing new packages and make changes system-wide. - Python 3.x (earlier version) and git command ## Getting the last version - Dowloading the [newest release,](https://github.com/scieloorg/opac/releases) uncompress and move to the directory /usr/local/opac ```command wget https://github.com/scieloorg/opac/archive/refs/tags/v3.4.51.tar.gz tar -zxvf v3.4.51.tar.gz mv opac-3.4.51 /usr/local/opac ``` ## Installing OPAC - Create python environment and install using pip ```command # Installing git command dnf install git cd /usr/local/opac # Creating the environment python3 -m venv .venv # Activating the environment source .venv/bin/activate # Installing pip install -U pip & pip install -r requirements.txt ``` ## Configuring OPAC - Copy the variable file default.py to local\_settings.py ```command cd /usr/local/opac cp opac/webapp/config/default.py opac/webapp/config/local_settings.py ```
**Variable de entorno** **Descripción** **Valor predeterminado**
OPAC\_DEBUG\_MODE Habilita/deshabilita el modo DEBUG False
OPAC\_CONFIG Archivo de configuración de la aplicación (consulte las instrucciones a continuación)
OPAC\_COLLECTION Acrónimo de la colección mex
OPAC\_MONGODB\_NAME Nombre de la base de datos MongoDB opac
OPAC\_MONGODB\_HOST Host do MongoDB localhost
OPAC\_MONGODB\_PORT Puerto de host MongoDB 27017
OPAC\_DATABASE\_DIR Directorio de almacenamiento base de SQLite /tmp
OPAC\_DATABASE\_FILE Nombre de archivo SQLite Opac.sqlite
OPAC\_DATABASE\_URI URI da base SQLite sqlite:////tmp/opac.sqlite
OPAC\_MEDIA\_ROOT Ruta absoluta de la carpeta que almacenará las imágenes registradas por los usuarios a través de la interfaz de administración <ruta>/media
OPAC\_MEDIA\_URL RUTA DE ACCESO DE LA URL para servir las imágenes /media
OPAC\_MAIL\_SERVER Host del servidor de correo localhost
OPAC\_MAIL\_PORT Puerto de host del servidor de correo 1025
OPAC\_SECRET\_KEY Clave necesaria para la seguridad de los formularios de solicitud (consulte las instrucciones a continuación)
OPAC\_SSM\_SCHEME Protocolo de conexión del almacén de objetos https
OPAC\_SSM\_DOMAIN Host do Object Store ssm.scielo.org
OPAC\_SSM\_PORT Puerto de host de almacén de objetos 80
OPAC\_SSM\_XML\_URL\_REWRITE ¿Cambiará el esquema de URL + autoridad registrada en el artículo? Si es true, fuerce la búsqueda del artículo en la url 'OPAC\_SSM\_SCHEME + '://' + OPAC\_SSM\_DOMAIN + ':' + OPAC\_SSM\_PORT'. De lo contrario, carga la dirección URL registrada en el artículo True
OPAC\_CACHE\_ENABLED Activa/desactiva la cache con Redis True
OPAC\_CACHE\_DEFAULT\_TIMEOUT Duración de los objetos de la memoria caché en segundos 3600
OPAC\_CACHE\_REDIS\_HOST Host de Redis para cache cache en redis
OPAC\_USE\_METRICS Activa/desactiva la integración con SciELO Analytics False
OPAC\_METRICS\_URL URL de SciELO Analytics http://analytics.scielo.org
OPAC\_USE\_DIMENSIONS Activa/desactiva la integración de dimensiones False
OPAC\_DIMENSIONS\_METRICS\_URL Dirección URL de dimensiones https://badge.dimensions.ai/details/doi
OPAC\_USE\_PLUMX Activa/desactiva la integración con PlumX False
OPAC\_PLUMX\_METRICS\_URL URL de PlumX https://plu.mx/scielo/a
OPAC\_USE\_ALTMETRIC Activa/desactiva la integración altmetric False
OPAC\_ALTMETRIC\_METRICS\_URL Dirección URL de Altmetric https://www.altmetric.com/details.php
OPAC\_AUDIT\_LOG\_NOTIFICATION\_ENABLED Activa/desactiva las notificaciones de informes de auditoría True
OPAC\_AUDIT\_LOG\_NOTIFICATION\_RECIPIENTS Lista de correos electrónicos que deben recibir el informe de auditoría, separados por comas (",") Lista vacía (ninguna)
OPAC\_SERVER\_NAME Nombre del servidor/IP Vacío (ninguno)
OPAC\_SESSION\_COOKIE\_DOMAIN Dominio para cookie de sesión. Configura SESSION\_COOKIE\_DOMAIN Valor del OPAC\_SERVER\_NAME
OPAC\_SESSION\_COOKIE\_HTTPONLY Habilita o deshabilita la cookie de sesión solo en HTTP. Configura SESSION\_COOKIE\_NAME True
OPAC\_SESSION\_COOKIE\_NAME Nombre de la cookie de sesión. Configura SESSION\_COOKIE\_NAME opac\_session
OPAC\_SESSION\_COOKIE\_PATH Ruta de acceso a la cookie de sesión. Configura SESSION\_COOKIE\_PATH Ninguno, que es la raíz de la aplicación ("/")
OPAC\_SESSION\_COOKIE\_SECURE Establece si la cookie de sesión debe marcarse como segura. Conjuntos SESSION\_COOKIE\_SECURE False
OPAC\_SESSION\_REFRESH\_EACH\_REQUEST Envío de la cookie en cada solicitud. Conjuntos SESSION\_REFRESH\_EACH\_REQUEST False
OPAC\_TWITTER\_ACCESS\_TOKEN Token de acceso de la cuenta de twitter
OPAC\_TWITTER\_ACCESS\_TOKEN\_SECRET Secreto de token de acceso desde la cuenta de Twitter
OPAC\_TWITTER\_CONSUMER\_KEY Cuenta de Twitter de clave de consumidor
OPAC\_TWITTER\_CONSUMER\_SECRET Secreto del consumidor de la cuenta de Twitter
OPAC\_TWITTER\_SCREEN\_NAME Nombre de pantalla de la cuenta de Twitter Red SciELO