[SOLVED] i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post tutorials, HOWTO's and other useful resources here.
inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

[SOLVED] i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#1 by inukaze » 05 Oct 2023, 02:39

Ok look i had few days trying to get this work, i try by my own method first, i notice that don't work, well the another thing was i just get work slpkg by error, but my point was make a OpenMRS server can get access from host.

well i need adapt this another tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1 (is on spanish) -> https://es.linux-console.net/?p=3614

But the important parts all intermediate users of gnu can understand, like :
* Oracle Java 8
* MySQL 5.6
* Tomcat 7.0.109
* Scripts for systemd with tomcat -> This is the part i need to adapt to the init of Slackware/Porteus
* Install OpenMRS
* Access OpenMRS from host to notice if working i need
* Start to configure OpenMRS.
----------------------------------------------------------------------------------------------------------------------------------------------------
I really write the follow text on spanish, but for this forum i translate to english in this post.
My first answer on this post, was be the Spanish Version of my tutorial :

OpenMRS on Porteus(64) 5.0.1 : On my case using VirtualBox 5.2.44 r139111 (Qt5.6.2) on Windows 7 Service Pack 1 Compile 2600 Ultimate 32 Bits.

OpenMRS - In Porteus, everything is quite comfortable.
The only thing I had to pass the files through cifs mount

Well because i am using VirtualBox, The Network configuration of VirtualBox
i suggest set to "Bridge Mode" and activate "Promicue Mode" to "Allow VM(s)"

Inside Porteus installed from Hard Disk Drive, i open a terminal wirh root privilegies and i use
the follow commands to mount cifs folder from my host folder :

Code: Select all

mkdir -p /media/cifs/Temporal
mount -t cifs //192.168.1.17/Temporal /media/cifs/Temporal -o vers=1.0,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL
in some case you should need add "user=username" before "password=password"

OpenMRS Reqs :
* Java 1.7 min. (JRE/JDK)
* Apache / httpd
* MySQL / MariaDB
* Tomcat [Exust apache-tomcat (Req java 8) and tomcat-native, for this i need apache-tomcat]

OpenMRS : The "War" Version is the edition for Enterprise or Production Env
looks like the better option for create a custom server.
------------------------------------------------------------------------------------------------------------------
Steps

01 : Install Porteus
I install Porteus 5.0.1 From Usb, without make a Boot Patition
because i don't need it and less on VirtualMachine

Once the installation is complete, use the menu option to Shutdown porteus and remove usb.
Restart i access to Porteus i had installed on Hard Disk Drive

Once the system has started i open a terminal and execute the follow commands

Code: Select all

su

echo 'Update the available packages from repositories from two package manager of Porteus'
slackpkg update ; slapt-get -u

echo 'I will install the most popular text editors in case you need one'
slackpkg install joe vim nano

echo 'I will create a symbolic link to the text editor of my choice'
echo 'In this case it will be "joe", with the following command'
ln -sf /usr/bin/joe /usr/bin/editor
		
echo 'I want change the machine (host) name'		
editor /etc/HOSTNAME
I change "porteus.example.net" by "openmrs"
To assing the name "openmrs" to this machine
i restart the entire (virtual) machine

02 : Change Language (System / Interface, Keyboard), Set Time/Date
I change the language of Porteus from English To Spanish
i Set country to "Venezuela" and set Time to "UTC" America/Caracas

From The Menu -> "System Tools -> Porteus Settings Centre"
On the top, make click on the second button from left to right
To access to the options allow you change the language


03 : Disable things i don't use :
From the Menu -> "Preferences -> LXQt Settings -> Power Management"
I Uncheck "Enable Battery Watcher" inside "Battery"
I Uncheck "Enable Idleness Watcher" from "Idle"

04 : Download Files
I open a terminal and use the follow commands

Code: Select all

echo 'Create sub-dir called openmrs inside guest home folder and enter on it'
mkdir -p /home/guest/openmrs ; cd /home/guest/openmrs
echo 'Download The Files i need'

wget -c http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.6/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
wget -c https://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/jdk-8u381-linux-x64.tar.gz
wget -c https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
wget -c https://sourceforge.net/projects/openmrs/files/releases/OpenMRS_Platform_2.5.0/openmrs.war/download -O openmrs.war

echo 'Solve a dependency of slapt-get, spkg looks like is ever use by slapt-get'
echo 'but for reasons i don't know, is not included on porteus 5.0.1'
wget -c https://download.salixos.org/x86_64/15.0/salix/a/spkg-1.7-x86_64-2gv.tgz ; \
installpkg spkg-1.7-x86_64-2gv.tgz ; ldconfig ; rm -rf spkg-1.7-x86_64-2gv.tgz
05 : Install Oracle Java Development Kit 1.8 Update 381 for 64 Bits Linux
Install Java System-Wide

Create and edit the file java_home.sh on the follow path :

Code: Select all

editor /etc/profile.d/java_home.sh
Add The Follow Lines :

Code: Select all

#!/bin/sh 
#JAVA :
export JAVA_HOME="/opt/java"
export PATH=$JAVA_HOME/bin:$PATH
Save the file and exit from editor

i grant execution permission to this startup script

Code: Select all

chmod +x /etc/profile.d/java_home.sh
I extract JDK on /opt with the follow command

Code: Select all

tar -zxvf jdk-8u381-linux-x64.tar.gz -C /opt/
I make a symbolic link from /opt/jdk1.8.0_381 to /opt/java:

Code: Select all

ln -sf "/opt/jdk1.8.0_381" "/opt/java"
execute a script file in current shell environment using "source" command

Code: Select all

source /etc/profile.d/java_home.sh
i check if work

Code: Select all

java -version
java version "1.8.0_381"
Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)

06 : Install & Configure "MySQL 5.6"

Resolve dependencies

Code: Select all

slackpkg install perl
slapt-get -i libaio numactl
I select "(O)" Option for Overwrite old files.

I make the folder /usr/local/mysql

Code: Select all

mkdir -p /usr/local/mysql
i extract the content of file mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz

Code: Select all

tar -xvf mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
I move folder using "mv" command the folder "mysql-5.6.46-linux-glibc2.12-x86_64" to "/opt/local/mysql"
like the destination folder is empty i not get error doing this

Code: Select all

mv mysql-5.6.46-linux-glibc2.12-x86_64 /usr/local/mysql
I go to the directory "/usr/local/mysql"

Code: Select all

cd /usr/local/mysql
I create the group mysql

Code: Select all

groupadd mysql
I create the user mysql

Code: Select all

useradd -g mysql mysql
I Change the owner of all files & folders
From the current path where i am "/usr/local/mysql"
From root:root to mysql:mysql

Code: Select all

chown -R mysql:mysql *
I run the script for create the default mysql database :

Code: Select all

./scripts/mysql_install_db --user=mysql
I change the owner of the current folder from mysql to root

Code: Select all

chown -R root .
I change the owner of the "data" folder to the user mysql

Code: Select all

chown -R mysql data
I clone the configuration file to /etc

Code: Select all

cp ./support-files/my-default.cnf /etc/my.cnf
I clone the mysql server startup script

Code: Select all

cp ./support-files/mysql.server /etc/rc.d/rc.mysqld
I grant execution permission

Code: Select all

chmod +x /etc/rc.d/rc.mysqld
I start mysqld in secure mode

Code: Select all

./bin/mysqld_safe --user=mysql &
I wait 11 seconds
I press enter three times

I set the password of root user of mysql
Its not the same root user from system
i set password 123456

Code: Select all

./bin/mysqladmin -u root password 123456
I make a symbolic link

Code: Select all

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
I restart entire machine
When the restart was complete i open a terminal and use the follow command

Code: Select all

ps -A | grep mysql
Must get two result mysqld & mysqld_safe

07 : Web Server httpd (Apache2)
In the same Terminal Window, i access to SuperUser account using "su" command

Code: Select all

su
i use the slackpkg package manager to install httpd and dependencies

Code: Select all

slackpkg install httpd apr apr-util
For avoid conflicts between the MySQL 5.6 (Older) and MariaDB (Use a lot the same names of file of MySQL)
I do the follow on the 100% manually way :

Code: Select all

mkdir -p /tmp/mariadb-10.5.22-x86_64 ; cd /tmp/mariadb-10.5.22-x86_64
wget -c http://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/mariadb-10.5.22-x86_64-1_slack15.0.txz
tar Jxvf mariadb-10.5.22-x86_64-1_slack15.0.txz
cd ./usr/lib64/
cp libmariadb.so.3 /usr/lib64/ ; ldconfig
cd /tmp ; rm -rf /tmp/mariadb-10.5.22-x86_64
I grant execution permission to the httpd startup script

Code: Select all

chmod a+x /etc/rc.d/rc.httpd
I must edit the configuration file of httpd before start it to avoid errors

Code: Select all

editor /etc/httpd/httpd.conf
I go to the end of file (httpd.conf) and add the follow Lines :

Code: Select all

	
#Error(es):
# AH00557: httpd: apr_sockaddr_info_get() failed for openmrs
# AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName
# Solution for AH00557 & AH00558 :
ServerName 127.0.0.1
Now its time to start httpd

Code: Select all

/etc/rc.d/rc.httpd start
You can check what is the current ip using ifconfig command :

Code: Select all

ifconfig
If using a Virtual Machine, i should try on the host machine access to ip
using http protocol from a graphical web browser, for example (Firefox / Chromium, etc) :
If you see the text "It Works!", is because is now completly configure and installed httpd (Apache2)

Image

08 : Tomcat for Apache

i create the tomcat group

Code: Select all

groupadd tomcat
i create the user tomcat

Code: Select all

useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
i go to the folder where i download the file apache-tomcat-7.0.109.tar.gz

Code: Select all

cd /home/guest/openmrs
i create the sub-folder tomcat inside the /opt

Code: Select all

mkdir -p /opt/tomcat
i extract the tomcat content on /opt/tomcat

Code: Select all

tar -xvzf apache-tomcat-7.0.109.tar.gz -C /opt/tomcat/ --strip-components=1
I Enter on the folder /opt/tomcat

Code: Select all

cd /opt/tomcat
I change the owner group from root to tomcat

Code: Select all

chgrp -R tomcat /opt/tomcat
i grant read permission to whole group over the configuration sub-folder of tomcat recursively

Code: Select all

chmod -R g+r conf
i grant execution permission to whole group over the configuration sub-folder of tomcat recursively

Code: Select all

chmod g+x conf
I change the owner root for tomcat in the follow sub-folders : webapps, work, temp, & logs

Code: Select all

chown -R tomcat webapps/ work/ temp/ logs/
In the Script for the Debian 11 OpenMRS tutorial the script for SystemD
i know the variables i must set before start tomcat are the follow :
export JAVA_HOME=/opt/java
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME=/opt/tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid
export tomcat_pid="$CATALINA_PID"
export TOMCAT_USER=tomcat

Well by the moment i use that variables with values to use tomcat startup script

Code: Select all

export TOMCAT_USER=tomcat ; \
export JAVA_HOME=/opt/java ; \
export PATH=$JAVA_HOME/bin:$PATH ; \
export CATALINA_HOME=/opt/tomcat ; \
export CATALINA_BASE=/opt/tomcat ; \
export tomcat_pid="$CATALINA_PID" ; \
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid ; \
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'


And now use the tomcat startup script :

Code: Select all

/opt/tomcat/bin/startup.sh
Image

09 - OpenMRS :

Code: Select all

mkdir -p /var/lib/OpenMRS
chown -R tomcat:tomcat /var/lib/OpenMRS
cd /home/guest/openmrs
cp openmrs.war /opt/tomcat/webapps/
chown -R tomcat:tomcat /opt/tomcat/webapps/openmrs.war
Note : The modules of OpenMRS Probably should be installed on path
/root/.OpenMRS/modules

Well its time to test, i go the graphical web browser (Firefox, Chromium, etc):
now based on http://«IP»:«PORT»/openmrs i should use
ImageImageImageImageImageImageImage

I found the follow script -> https://gist.github.com/rougesheep/2e66 ... 949d898554

But does not work for my, i try to customize but does not work, i think is better i whole write
my own whole script for this

The rc.tomcat script i try to use, but does not work for me :

Code: Select all

#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat  
# chkconfig: 234 20 80  
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Initially forked from: gist.github.com/valotas/1000094
# Source: gist.github.com/miglen/5590986

 
#Location of JAVA_HOME (bin files)
export JAVA_HOME=/opt/java
 
#Add Java binary files to PATH
export PATH=$JAVA_HOME/bin:$PATH

#CATALINA_HOME is the location of the bin files of Tomcat  
export CATALINA_HOME=/opt/tomcat
 
#CATALINA_BASE is the location of the configuration files of this instance of Tomcat
export CATALINA_BASE=/opt/tomcat

#CATALINA_OPTS are the options pass to java
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

#CATALINA_PID
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid
export tomcat_pid="$CATALINA_PID"

#TOMCAT_USER is the default user of tomcat
export TOMCAT_USER=tomcat
 
#TOMCAT_USAGE is the message if this script is called without any options
TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;31mkill\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}"
 
#SHUTDOWN_WAIT is wait time in seconds for java proccess to stop
SHUTDOWN_WAIT=20
 
tomcat_pid() {
        echo `ps -fe | grep $CATALINA_BASE | grep -v grep | tr -s " "|cut -d" " -f2`
}
 
start() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m"
  else
    # Start tomcat
    echo -e "\e[00;32mStarting tomcat\e[00m"
    #ulimit -n 100000
    #umask 007
    #/bin/su -p -s /bin/sh $TOMCAT_USER
        if [ `user_exists $TOMCAT_USER` = "1" ]
        then
                /bin/su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh
        else
                echo -e "\e[00;31mTomcat user $TOMCAT_USER does not exists. Starting with $(id)\e[00m"
                sh $CATALINA_HOME/bin/startup.sh
        fi
        status
  fi
  return 0
}
 
status(){
          pid=$(tomcat_pid)
          if [ -n "$pid" ]
            then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m"
          else
            echo -e "\e[00;31mTomcat is not running\e[00m"
            return 3
          fi
}

terminate() {
	echo -e "\e[00;31mTerminating Tomcat\e[00m"
	kill -9 $(tomcat_pid)
}

stop() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo -e "\e[00;31mStoping Tomcat\e[00m"
    #/bin/su -p -s /bin/sh $TOMCAT_USER
        sh $CATALINA_HOME/bin/shutdown.sh
 
    let kwait=$SHUTDOWN_WAIT
    count=0;
    until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
    do
      echo -n -e "\n\e[00;31mwaiting for processes to exit\e[00m";
      sleep 1
      let count=$count+1;
    done
 
    if [ $count -gt $kwait ]; then
      echo -n -e "\n\e[00;31mkilling processes didn't stop after $SHUTDOWN_WAIT seconds\e[00m"
      terminate
    fi
  else
    echo -e "\e[00;31mTomcat is not running\e[00m"
  fi
 
  return 0
}
 
user_exists(){
        if id -u $1 >/dev/null 2>&1; then
        echo "1"
        else
                echo "0"
        fi
}
 
case $1 in
	start)
	  start
	;;
	stop)  
	  stop
	;;
	restart)
	  stop
	  start
	;;
	status)
		status
		exit $?  
	;;
	kill)
		terminate
	;;		
	*)
		echo -e $TOMCAT_USAGE
	;;
esac    
exit 0
I save the file on /etc/rc.d/rc.tomcat
i grant execution permission to this startup script

Code: Select all

chmod a+x /etc/rc.d/rc.tomcat
I try start with

Code: Select all

/etc/rc.d/rc.tomcat
Well is not work, i need make my own script from scratch
Last edited by inukaze on 07 Oct 2023, 04:45, edited 6 times in total.

User avatar
francois
Contributor
Contributor
Posts: 6435
Joined: 28 Dec 2010, 14:25
Distribution: xfce plank porteus nemesis
Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.

i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#2 by francois » 06 Oct 2023, 01:45

There is no systemd on porteus.
Prendre son temps, profiter de celui qui passe.

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

[SOLVED] i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#3 by inukaze » 06 Oct 2023, 22:22

OpenMRS en Porteus(64) 5.0.1 : En mi caso estoy utilizando VirtualBox 5.2.44 r139111 (Qt5.6.2) en
Windows 7 Service Pack 1 Compilacion 2600 Ultimate de 32 Bits.

OpenMRS - En Porteus, todo es muy comodo

La unica cosa es que tuve que pasar los archivos a traves de una montura cifs

Bueno debido a que yo estoy utilizando VirtualBox, la configuracion de la red de VirtualBox
Sugiero establecerla en "Puente" y activar el "Modo Promiscuo" para "Permitir MV(s)"

Dentro del porteus instalado en el disco duro, Abri una ventana de terminal con privilegios
de administrador / SuperUsuario (root) i utilice los siguientes comandos :

Code: Select all

mkdir -p /media/cifs/Temporal
mount -t cifs //192.168.1.17/Temporal /media/cifs/Temporal -o vers=1.0,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL
En algunos casos, necesitas agregar "user=usuario" antes de "password=contraseña"

OpenMRS Requiere :
* Java 1.7 min. (JRE/JDK)
* Apache / httpd
* MySQL / MariaDB
* Tomcat [Existen apache-tomcat (Req java 8) & tomcat-native, para esto necesito usar apache-tomcat]

OpenMRS : La version "War" es la edicion para Empresas o Entornos de Produccion
Parace ser la mejor opcion para crear un servidor personalizado

------------------------------------------------------------------------------------------------------------------
Pasos :

01 : Instalar Porteus 5.0.1

Instale Porteus 5.0.1 desde un Usb, sin crear una particion de Inicio (boot)
Debido a que no la necesito y menos en una maquina virtual

Una vez finalizada la instalacion de Porteus, usando las opciones del menu lo mando a apagar y extraigo el usb
Reinicio y accedo al Porteus que acabas de instalar en la unidad de disco duro


Una vez el sistema inicia, abro una termina y ejecuto los siguientes comandos :

Code: Select all

su

echo 'Actualizar la lista de paquetes disponibles en los repositorios de 2 gestores de paquetes de Porteus'
slackpkg update ; slapt-get -u

echo 'Instalare los editores de texto más populares en caso de que necesite alguno'
slackpkg install joe vim nano


echo 'Creare un enlace simbolico al editor de texto de mi preferencia'
echo 'En este caso sera "joe", con el siguiente comando :'
ln -sf /usr/bin/joe /usr/bin/editor
		
echo 'Quiero cambiarle el nombre al equipo(anfitrion)'
editor /etc/HOSTNAME
Cambie "porteus.example.net" por "openmrs"
Para asignarle el nombre "openmrs" a este equipo

Reinicie la maquina (virtual) entera

02 : Cambiar el Idioma (Sistema, Interfaz, Teclado), Configurar Fecha/Hora
Cambie el idioma de Porteus de Ingles a Español
Cambie el Pais a "Venezuela" y Estableci la hora "UTC" America/Caracas

Desde el Menu "Herramientas del Sistema -> Porteus Settings Centre"
On la parte tope has clic en el segundo boton de izquierda a derecha
Para acceder a las opciones que permiten cambiar el idioma

03 : Deshabilte cosas que no uso
Desde el Menu -> "Preferencias -> "Configuración de LXQt" -> "Gestión de Energia"
Desactive "Activar Monitor de Bateria" dentro del apartado "Bateria"
Desactive "Activar Monitor de Inactividad" dentro del apartado "Inactividad"

04 : Descargar Archivos
Abri una terminal y utilice los siguientes comandos

Code: Select all


echo 'Crear un sub-directorio llamado openmrs dentro de la carpeta de usuario guest y entrar en ella'
mkdir -p /home/guest/openmrs ; cd /home/guest/openmrs
echo 'Descargar los archivos que necesito'

wget -c http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.6/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
wget -c https://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/jdk-8u381-linux-x64.tar.gz
wget -c https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
wget -c https://sourceforge.net/projects/openmrs/files/releases/OpenMRS_Platform_2.5.0/openmrs.war/download -O openmrs.war

echo 'Resolver una dependencia de slapt-get, spkg parece que siempre es usado por slapt-get'
echo 'Pero por razones que desconozco, no esta incluido en porteus 5.0.1'
wget -c https://download.salixos.org/x86_64/15.0/salix/a/spkg-1.7-x86_64-2gv.tgz ; \
installpkg spkg-1.7-x86_64-2gv.tgz ; ldconfig ; rm -rf spkg-1.7-x86_64-2gv.tgz
05 : Instalar Kit de Desarrollo Java de Oracle Actualizacion 381 para Linux de 64 Bits
Instalar Java a nivel de Sistema

Crear y editar el archivo java_home.sh en la siguiente ruta

Code: Select all

editor /etc/profile.d/java_home.sh
Agrego las siguientes lineas :

Code: Select all

#!/bin/sh 
#JAVA :
export JAVA_HOME="/opt/java"
export PATH=$JAVA_HOME/bin:$PATH
Guardo el archivo y salgo del editor

Le concedo permiso de ejecucion al guion de arranque

Code: Select all

chmod +x /etc/profile.d/java_home.sh
Extraigo JDK en /opt con el siguiente comando :

Code: Select all

tar -zxvf jdk-8u381-linux-x64.tar.gz -C /opt/
Creo un enlace simbolico desde /opt/jdk1.8.0_381 hasta /opt/java:

Code: Select all

ln -sf "/opt/jdk1.8.0_381" "/opt/java"
ejecuto el archivo de guion en el entorno de terminal actual usando el comando "sources"

Code: Select all

source /etc/profile.d/java_home.sh
Verifico que funcione :

Code: Select all

java -version
java version "1.8.0_381"
Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)

06 : Instalar & Configurar "MySQL 5.6"
Resolver Dependencias

Code: Select all

slackpkg install perl
slapt-get -i libaio numactl
I select "(O)" Option for Overwrite old files.
Seleccione la opcion "(O)" Para sobreescribir archivos antiguos

Creo la carpeta /usr/local/mysql

Code: Select all

mkdir -p /usr/local/mysql
extraigo el contenido del archivo mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz

Code: Select all

tar -xvf mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
Muevo la carpeta "mysql-5.6.46-linux-glibc2.12-x86_64" usando el comando "mv" hacia "/opt/local/mysql"
Como la carpeta de destino esta vacia, se combinara sin darme ninguna advertencia o error haciendo esto.

Code: Select all

mv mysql-5.6.46-linux-glibc2.12-x86_64 /usr/local/mysql
Entro en el directorio "/usr/local/mysql"

Code: Select all

cd /usr/local/mysql
Creo el grupo mysql

Code: Select all

groupadd mysql
Creo al usuario mysql

Code: Select all

useradd -g mysql mysql
Cambio al propietario de todos los archivos y carpetas
De la ruta actual en la que me encuentro "/usr/local/mysql"
Desde root:root a mysql:mysql

Code: Select all

chown -R mysql:mysql *
Ejecuto el guion para crear la base de datos predeterminada de mysql :

Code: Select all

./scripts/mysql_install_db --user=mysql
Cambio al propietario de la carpeta actual de mysql a root

Code: Select all

chown -R root .
Cambio al propietario de la carpeta "data" al usuario "mysql"

Code: Select all

chown -R mysql data
Clono el archivo de configuracion hacia /etc

Code: Select all

cp ./support-files/my-default.cnf /etc/my.cnf
Clono el guion de arranque del servidor mysql

Code: Select all

cp ./support-files/mysql.server /etc/rc.d/rc.mysqld
Le consedo permiso de ejecucion

Code: Select all

chmod +x /etc/rc.d/rc.mysqld
Inicio mysqld en modo seguro

Code: Select all

./bin/mysqld_safe --user=mysql &
Espero 11 segundos
Presiono 3 veces la tecla "Entrar"

Establezco la contraseña del usuario root de mysql
El cual no es el mismo usuario root que el del sistema
Esblezco la conseña 123456

Code: Select all

./bin/mysqladmin -u root password 123456
Creo un enlace simbolico

Code: Select all

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
Reinicio la maquina (virtual) completa.
Cuando el reinicio se completa, abro una ventana de terminal y uso los siguientes comandos

Code: Select all

ps -A | grep mysql
Debe devolver 2 resultados mysqld y mysqld_safe

07 : Servidor web httpd (Apache2)
En la misma ventana de terminal, accedo a la cuenta del SuperUsuario usando el comando "su"

Code: Select all

su
Uso el gestor de paquetes slackpkg para instalar httpd (Apache2) y sus dependencias

Code: Select all

slackpkg install httpd apr apr-util
Para evitar conflictos entre MySQL 5.6 (Antiguo) y MariaDB (Usa un monton de los mismos nombres de MySQL)
Hare lo siguiente de la manera 100% Manual :

Code: Select all

mkdir -p /tmp/mariadb-10.5.22-x86_64 ; cd /tmp/mariadb-10.5.22-x86_64
wget -c http://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/mariadb-10.5.22-x86_64-1_slack15.0.txz
tar Jxvf mariadb-10.5.22-x86_64-1_slack15.0.txz
cd ./usr/lib64/
cp libmariadb.so.3 /usr/lib64/ ; ldconfig
cd /tmp ; rm -rf /tmp/mariadb-10.5.22-x86_64
Le consedo permiso de ejecucion al guion de inicio de httpd

Code: Select all

chmod a+x /etc/rc.d/rc.httpd
Debo editar el archivo de configuracion de httpd antes de iniciarlo para evitar errores

Code: Select all

editor /etc/httpd/httpd.conf
Voy hasta el final del archivo (httpd.conf) y añado las siguientes lineas :

Code: Select all

	
#Error(es):
# AH00557: httpd: apr_sockaddr_info_get() failed for openmrs
# AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName
# Solucion for AH00557 & AH00558 :
ServerName 127.0.0.1
Es hora de iniciar httpd

Code: Select all

/etc/rc.d/rc.httpd start
Se puede verificar cual es la ip actual utilizando el comando ifconfig

Code: Select all

ifconfig
Si estas usando una Maquina Virtual, puedes intentar acceder a la IP de esta
utilizando el protocolo http desde un navegador web grafico, por ejemplo (Firefox, Chromium, etc) :
Si al acceder ves el texto "It Works!" es debido a que ahora esta completamente configurado e instalado httpd (Apache2)

Image

08 : Tomcat para Apache

Creo el grupo tomcat

Code: Select all

groupadd tomcat
Creo el usuario tomcat

Code: Select all

useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
Voy a la carpeta donde descargue el archivo apache-tomcat-7.0.109.tar.gz

Code: Select all

cd /home/guest/openmrs
Creo la sub-carpeta tomcat dentro de /opt

Code: Select all

mkdir -p /opt/tomcat
Extraigo el contenido de tomcat en /opt/tomcat

Code: Select all

tar -xvzf apache-tomcat-7.0.109.tar.gz -C /opt/tomcat/ --strip-components=1
Ingreso en la carpeta /opt/tomcat

Code: Select all

cd /opt/tomcat
Cambio al propietario del grupo de root por tomcat

Code: Select all

chgrp -R tomcat /opt/tomcat
Concedo permiso de lectura al grupo entero a la sub-carpeta de configuraciones "conf" de tomcat de forma recursiva

Code: Select all

chmod -R g+r conf
Concedo permiso de ejecucion al grupo entero a la sub-carpeta de configuraciones "conf" de tomcat de forma recursiva

Code: Select all

chmod g+x conf
Cambio al propietario root por tomcat en los siguientes sub-directorios : webapps, work, temp, & logs

Code: Select all

chown -R tomcat webapps/ work/ temp/ logs/
En el guion para SystemD de la guia de como instalar OpenRMS en Debian 11
Se que las variables que debo establecer antes de iniciar tomcat son las siguientes :
export JAVA_HOME=/opt/java
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME=/opt/tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid
export tomcat_pid="$CATALINA_PID"
export TOMCAT_USER=tomcat
Bueno por el momento usare estas variables y valores para poder usar el guion de arranque de tomcat

Code: Select all

export TOMCAT_USER=tomcat ; \
export JAVA_HOME=/opt/java ; \
export PATH=$JAVA_HOME/bin:$PATH ; \
export CATALINA_HOME=/opt/tomcat ; \
export CATALINA_BASE=/opt/tomcat ; \
export tomcat_pid="$CATALINA_PID" ; \
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid ; \
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'


Ahora utilizo el guion de arranque de tomcat :

Code: Select all

/opt/tomcat/bin/startup.sh
Image

09 - OpenMRS :

Code: Select all

mkdir -p /var/lib/OpenMRS
chown -R tomcat:tomcat /var/lib/OpenMRS
cd /home/guest/openmrs
cp openmrs.war /opt/tomcat/webapps/
chown -R tomcat:tomcat /opt/tomcat/webapps/openmrs.war
Nota : Los modules de OpenMRS Probablemente deban ser instalados en la ruta
/root/.OpenMRS/modules

Bueno es momento de probrar, voy a un navegador web grafico (Firefox, Chromium, etc):
Ahora basado en http://«IP»:«PUERTO»/openmrs i should use
ImageImageImageImageImageImageImage

Me encontre el siguiente guion -> https://gist.github.com/rougesheep/2e66 ... 949d898554

Pero no funciona para mi, intente personalizarlo pero no funciono, pienso que es mejor que me escriba
mi propio guion entero para este proposito

el guion rc.tomcat que intente usar, pero no funciono para mi :

Code: Select all

#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat  
# chkconfig: 234 20 80  
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Initially forked from: gist.github.com/valotas/1000094
# Source: gist.github.com/miglen/5590986

 
#Location of JAVA_HOME (bin files)
export JAVA_HOME=/opt/java
 
#Add Java binary files to PATH
export PATH=$JAVA_HOME/bin:$PATH

#CATALINA_HOME is the location of the bin files of Tomcat  
export CATALINA_HOME=/opt/tomcat
 
#CATALINA_BASE is the location of the configuration files of this instance of Tomcat
export CATALINA_BASE=/opt/tomcat

#CATALINA_OPTS are the options pass to java
export CATALINA_OPTS='-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

#CATALINA_PID
export CATALINA_PID=/opt/tomcat/temp/tomcat.pid
export tomcat_pid="$CATALINA_PID"

#TOMCAT_USER is the default user of tomcat
export TOMCAT_USER=tomcat
 
#TOMCAT_USAGE is the message if this script is called without any options
TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;31mkill\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}"
 
#SHUTDOWN_WAIT is wait time in seconds for java proccess to stop
SHUTDOWN_WAIT=20
 
tomcat_pid() {
        echo `ps -fe | grep $CATALINA_BASE | grep -v grep | tr -s " "|cut -d" " -f2`
}
 
start() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m"
  else
    # Start tomcat
    echo -e "\e[00;32mStarting tomcat\e[00m"
    #ulimit -n 100000
    #umask 007
    #/bin/su -p -s /bin/sh $TOMCAT_USER
        if [ `user_exists $TOMCAT_USER` = "1" ]
        then
                /bin/su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh
        else
                echo -e "\e[00;31mTomcat user $TOMCAT_USER does not exists. Starting with $(id)\e[00m"
                sh $CATALINA_HOME/bin/startup.sh
        fi
        status
  fi
  return 0
}
 
status(){
          pid=$(tomcat_pid)
          if [ -n "$pid" ]
            then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m"
          else
            echo -e "\e[00;31mTomcat is not running\e[00m"
            return 3
          fi
}

terminate() {
	echo -e "\e[00;31mTerminating Tomcat\e[00m"
	kill -9 $(tomcat_pid)
}

stop() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo -e "\e[00;31mStoping Tomcat\e[00m"
    #/bin/su -p -s /bin/sh $TOMCAT_USER
        sh $CATALINA_HOME/bin/shutdown.sh
 
    let kwait=$SHUTDOWN_WAIT
    count=0;
    until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
    do
      echo -n -e "\n\e[00;31mwaiting for processes to exit\e[00m";
      sleep 1
      let count=$count+1;
    done
 
    if [ $count -gt $kwait ]; then
      echo -n -e "\n\e[00;31mkilling processes didn't stop after $SHUTDOWN_WAIT seconds\e[00m"
      terminate
    fi
  else
    echo -e "\e[00;31mTomcat is not running\e[00m"
  fi
 
  return 0
}
 
user_exists(){
        if id -u $1 >/dev/null 2>&1; then
        echo "1"
        else
                echo "0"
        fi
}
 
case $1 in
	start)
	  start
	;;
	stop)  
	  stop
	;;
	restart)
	  stop
	  start
	;;
	status)
		status
		exit $?  
	;;
	kill)
		terminate
	;;		
	*)
		echo -e $TOMCAT_USAGE
	;;
esac    
exit 0
Guarde el archivo como /etc/rc.d/rc.tomcat
Le otorgue permiso de ejecucion a este guion de arranque

Code: Select all

chmod a+x /etc/rc.d/rc.tomcat
Intente iniciarlo manualmente con :

Code: Select all

/etc/rc.d/rc.tomcat
Pero no funciona, necesito escribir mi propio guion desde cero.
Last edited by inukaze on 07 Oct 2023, 04:52, edited 5 times in total.

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#4 by inukaze » 06 Oct 2023, 22:28

francois wrote:
06 Oct 2023, 01:45
There is no systemd on porteus.
i know that, and for that reason i wrote
* Scripts for systemd with tomcat -> This is the part i need to adapt to the init of Slackware/Porteus
Well i need to think how make my own bsd startup script for this propuse.

Another question, You know i should configure ssh to enable access from sftp from another machine to porteus machine?

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#5 by beny » 06 Oct 2023, 23:25

Code: Select all

 hi inukaze this is the script included into the slackbuild of apache-tomcat   named rc.tomcat       
     #!/bin/sh
# Start/stop/restart apache-tomcat.
# $Id: rc.apache-tomcat,v 1.2.0 2013/11/30
# Authors: Heinz Wiesinger <pprkut@liwjatan.at>, Vincent Batts <vbatts@hashbangbash.com>
# ---------------------------------------------------------------------------

# Load tomcat specific java vm options
. /etc/tomcat/tomcat-java.conf

# Load environment variables
. /etc/profile.d/apache-tomcat.sh

if [ -z "$JAVA_HOME" ]; then
  for i in /etc/profile.d/*jdk*.sh; do
    if [ -x $i ]; then
      source $i
      break
    fi
  done
fi

PIDFILE="/var/spool/tomcat/tomcat.pid"
LOGFILE="/var/log/tomcat/tomcat.log"

CLASSPATH="$CATALINA_BASE/bin/bootstrap.jar:$CATALINA_BASE/bin/tomcat-juli.jar"
CLASSPATH="$CLASSPATH:/usr/share/java/commons-daemon.jar"
for i in $CATALINA_LIBDIR/*.jar; do
  CLASSPATH=$CLASSPATH:$i
done

USER="tomcat"

JSVC="/usr/bin/jsvc"
TOMCAT_CMD="-user $USER -cp $CLASSPATH \
  -pidfile $PIDFILE -outfile $LOGFILE -errfile $LOGFILE \
  -Xms$MEMALLOC_MIN -Xmx$MEMALLOC_MAX -Xss$STACK -XX:MaxPermSize=$MAXPERMSIZE \
  -Djava.io.tmpdir="$CATALINA_TMPDIR" \
  -Dcatalina.home=$CATALINA_HOME -Dcatalina.base=$CATALINA_BASE \
  -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
  -Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
  -Djava.awt.headless=true org.apache.catalina.startup.Bootstrap"

tomcat_start() {
  echo -n "Starting Apache Tomcat ... "
  if ! [ -e /var/run/tomcat ]; then
    mkdir /var/run/tomcat
    chown tomcat:tomcat /var/run/tomcat
    chmod 755 /var/run/tomcat
  fi
  if ! [ -e /var/tmp/tomcat ]; then
    mkdir /var/tmp/tomcat
    chown tomcat:tomcat /var/tmp/tomcat
    chmod 755 /var/tmp/tomcat
  fi

  if [ -e "$PIDFILE" ]; then
    echo "already running!"
  else
    unset DISPLAY
    cd /var/lib/tomcat
      $JSVC $TOMCAT_CMD
    echo "done!"
  fi
}

tomcat_stop() {
  echo -n "Stopping Apache Tomcat ... "
  if [ -e "$PIDFILE" ]; then
    cd /var/lib/tomcat
      $JSVC -stop $TOMCAT_CMD
    echo "done!"
  else
    echo "not running!"
  fi
}

# Restart tomcat:
tomcat_restart() {
  tomcat_stop
  sleep 1
  tomcat_start
}

case "$1" in
'start')
  tomcat_start
  ;;
'stop')
  tomcat_stop
  ;;
'restart')
  tomcat_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
                                                                 

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#6 by beny » 06 Oct 2023, 23:31

bash-5.2# installpkg '/tmp/apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz'
Verifying package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz.
Installing package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz:
PACKAGE DESCRIPTION:
Executing install script for apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz.
Package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz installed.
bash-5.2# sh '/etc/rc.d/rc.tomcat' start
Starting Apache Tomcat ... done!
bash-5.2#

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#7 by inukaze » 07 Oct 2023, 00:07

beny wrote:
06 Oct 2023, 23:31
bash-5.2# installpkg '/tmp/apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz'
Verifying package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz.
Installing package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz:
PACKAGE DESCRIPTION:
Executing install script for apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz.
Package apache-tomcat-11.0.0-M11-noarch-1_SBo.tgz installed.
bash-5.2# sh '/etc/rc.d/rc.tomcat' start
Starting Apache Tomcat ... done!
bash-5.2#
Dunno you have enogh hardware for make a virtual machine an try to do almost the same i do but with that version of tomcat?
Becuase i don't know if openmrs works with tomcat version > 7 and in that package the version is 11

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

[SOLVED] i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#8 by beny » 07 Oct 2023, 12:10

hi inukaze i have build the openMRS from source,the trouble is i have done this on a current system so it is too far from porteus 5,but near at porteux current: http://localhost:8080/openmrs/initialsetup
but i have started with the inside server:[INFO] Started ServerConnector@49986178{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO] Started @35642ms
[INFO] Started Jetty Server
this is for test without tomcat, you need also apache-ant and apache-maven if you want to build from source openmrs,ok i have to read carefully all the info of your post.
OpenMRS Core 2.7.0-a367e7 Installation Wizard

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

[SOLVED] i need Adapt Tutorial for Debian 11 to Slackware(64) 15.0 / Porteus 5.0.1

Post#9 by inukaze » 08 Oct 2023, 05:01

beny wrote:
07 Oct 2023, 12:10
hi inukaze i have build the openMRS from source,the trouble is i have done this on a current system so it is too far from porteus 5,but near at porteux current: http://localhost:8080/openmrs/initialsetup
but i have started with the inside server:[INFO] Started ServerConnector@49986178{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO] Started @35642ms
[INFO] Started Jetty Server
this is for test without tomcat, you need also apache-ant and apache-maven if you want to build from source openmrs,ok i have to read carefully all the info of your post.
OpenMRS Core 2.7.0-a367e7 Installation Wizard
:O Awesome i had read on OpenMRS you can make it work using OpenJDK 8, Jetty / Jitter (i don't remember the exact name) instead Tomcat

Post Reply