--- title: 'Instalación de Nexus 3 en Centos 8' --- Instalación de Nexus 3 en Centos 8 === * **Coordinador Tecnológico:** Rafael Palau * **Arquitecto:** Horacio Nemeth * **Consultores:** Julio Mello Marcos Benítez Marco Aquino Ilse Grau Alan Sanier Lauro Segovia # Contenido [TOC] # Requerimientos del sistema * CPU: mínimo 4, recomendado 8+. * Memoria: memoría física mínima 8GB. * OpenJDK 8 * Todos los procesos de Nexus deben ejecutarse como un usuario nexus no root. # Instalación de Nexus en Centos 8 ## Paso 1. Requerimientos del sistema 1. Actualizar los paquetes yum e instalar las utilidades necesarias. ``` shell= $ yum update -y $ yum install wget -y ``` 2. Instalar el OpenJDK 8. ``` shell= $ yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel ``` ## Paso 2. Instalar nexus 1. Navegar hasta el directorio opt: ``` shell= $ cd /opt ``` 2. Descargar Nexus ``` shell= $ wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz ``` 3. Extraer el archivo .tar ``` shell= $ tar -xvzf latest-unix.tar.gz ``` 4. Visualizar directorios ``` shell= $ ls -lh ``` 5. Renombrar carpetas ``` shell= $ mv nexus-3.37.0-01 nexus $ mv sonatype-work nexusdata ``` ## Paso 3. Setear las configuraciones y permisos de usuarios 1. Agregar un usuario para el servicio de nexus ```shell= $ useradd --system --no-create-home nexus ``` 2. Estrablecer la propiedad de los archivos nexus y los datos nexus. ``` shell= $ chown -R nexus:nexus /opt/nexus $ chown -R nexus:nexus /opt/nexusdata ``` 3. Cambiar la configuración de Nexus y establecer el directorio de datos personalizado. Editar “nexus.vmoptions”. ``` shell= $ vim /opt/nexus/bin/nexus.vmoptions ``` Cambiar el directorio de datos. ```shell= -Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=../nexusdata/nexus3/log/jvm.log -XX:-OmitStackTraceInFastThrow -Djava.net.preferIPv4Stack=true -Dkaraf.home=. -Dkaraf.base=. -Dkaraf.etc=etc/karaf -Djava.util.logging.config.file=etc/karaf/java.util.logging.properties -Dkaraf.data=../nexusdata/nexus3 -Dkaraf.log=../nexusdata/nexus3/log -Djava.io.tmpdir=../nexusdata/nexus3/tmp -Dkaraf.startLocalConsole=false ``` Guadar el archivo y salir. 4. Cambiar el usuario de la cuenta del servicio nexus. Editar el archivo “nexus.rc”. ``` shell= $ vim /opt/nexus/bin/nexus.rc ``` Descomentar el parámetro “run_as_user” y agregar un valor nuevo. ``` shell= run_as_user="nexus" ``` 5. Parar de escuchar las conexiones remotas. Modificar el archivo “nexus-default.properties”. ``` shell= $ vim /opt/nexus/etc/nexus-default.properties ``` Cambiar *application-host=0.0.0.0* por *application-host=127.0.0.1*. 6. Configure the open file limit of the nexus user. ``` shell= $ vim /etc/security/limits.conf ``` Añadir los siguientes valores al archivo. ``` shell= nexus - nofile 65536 ``` Guardar el archivo y salir. ## Paso 4. Establecer Nexus como un servicio del sistema. 1. Crear el archivo de servicio Systemd en “/etc/systemd/system/”. ``` shell= $ vim /etc/systemd/system/nexus.service ``` 2. Agregar al archivo lo siguiente: ``` shell= [Unit] Description=Nexus Service After=syslog.target network.target [Service] Type=forking LimitNOFILE=65536 ExecStart=/opt/nexus/bin/nexus start ExecStop=/opt/nexus/bin/nexus stop User=nexus Group=nexus Restart=on-failure [Install] WantedBy=multi-user.target ``` 3. Recargar systemctl. ``` shell= $ systemctl daemon-reload ``` 4. Habilitar el servicio en el arranque del sistema. ```shell= $ systemctl enable nexus.service ``` 5. Iniciar el servicio. ``` shell= $ systemctl start nexus.service ``` 6. Monitorear el archivo log. ``` shell= $ tail -f /opt/nexusdata/nexus3/log/nexus.log ``` 7. Comprobar el puerto del servicio ``` shell= $ netstat -tunlp | grep 8081 ``` # Referencias [1] Fosslinux. Installing Sonatype Nexus Repository OSS on CentOS 7. Recuperado el 14 de diciembre del 2021, de https://www.fosslinux.com/27838/installing-sonatype-nexus-repository-oss-on-centos-7.htm [2] Sonatype. Repository Manager 3. Recuperado el 14 de diciembre del 2021, de https://help.sonatype.com/repomanager3