Usando Linux para muchas cosas y disfrutando de videojuegos, en dispositivos moviles, consolas y pc. Using Linux for many things and enjoying video games, mobile devices, consoles and pc

Como instalar y configurar SuiteCRM en Ubuntu Server

Como instalar y configurar SuiteCRM en Ubuntu Server

Tienes un negocio (o trabajas para el) que tiene sus clientes o esta en camino de conseguir nuevos, no quieres perderlos ademas de mantener una buena relación con ellos. Necesitas un CRM (de las siglas Customer Relationship Management) para hacer seguimiento de esto y mas lo que nos lleva a nuestro articulo del día de hoy, Como instalar y configurar SuiteCRM en Servidor Ubuntu LTS.

Para este articulo utilizare Ubuntu Server LTS, no obstante en otra distro su instalación es bastante parecida. Comencemos este tutorial en español.

Que es SuiteCRM

SuiteCRM es un fork de SugarCRM que como muchos otros proyectos, cuando se decide dejar de mantener una versión community o opensource la comunidad decide tomar el ultimo código libre publicado y crear otro producto con esta base. De ahí su primera versión en octubre del 2013 manteniéndose al día de hoy como una solución bastante popular y activa

Requerimientos instalación SuiteCRM

Como instalar y configurar SuiteCRM en Ubuntu Server

-Instalamos dependencias necesarias para la instalación de SuiteCRM. Abrimos una consola en nuestro servidor opensource y ejecutamos
sudo apt install unzip php7.0-xml php7.0-zip php7.0-imap php7.0-gd

-Creamos una db en MariaDB y un usuario con permisos totales para su manejo. Por seguridad es mejor así y no utilizar la cuenta root para esto
mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 51
Server version: 10.0.33-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database suitecrmdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on suitecrmdb.* to suitecrmadm@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye

-Abrimos un navegador y nos dirigimos al sitio oficial de descarga de SuiteCRM. Damos click boton derecho del mouse al botón Download y copiamos el URL de descarga de la ultima versión disponible.
Nos cambiamos al directorio donde instalaremos y descargamos el zip
cd /var/www/html/
sudo wget -c https://suitecrm.com/files/160/SuiteCRM-7.10/224/SuiteCRM-7.10.zip
Copiamos el URL de descarga para con wget descargar el zip de SuiteCRM

-Descomprimimos el archivo
sudo unzip SuiteCRM-7.10.zip

-Cambiamos el nombre de la carpeta default y cambiamos los permisos dándole permisos a apache de forma recursiva
sudo mv SuiteCRM-7.10 scrm
sudo chown -R www-data:www-data scrm/

-Modificamos php para que nos permita cargar archivos mas grandes. El default son 2Mb
sudo vi /etc/php/7.0/apache2/php.ini
upload_max_filesize = 7M

-Reiniciamos y verificamos el servicio de Apache
sudo systemctl restart apache2
sudo systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2018-02-20 19:01:58 UTC; 14s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 16133 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 16155 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service
           ├─16170 /usr/sbin/apache2 -k start
           ├─16173 /usr/sbin/apache2 -k start
           ├─16174 /usr/sbin/apache2 -k start
           ├─16175 /usr/sbin/apache2 -k start
           ├─16176 /usr/sbin/apache2 -k start
           └─16177 /usr/sbin/apache2 -k start

Feb 20 19:01:57 censuitecrm systemd[1]: Starting LSB: Apache2 web server...
Feb 20 19:01:57 censuitecrm apache2[16155]:  * Starting Apache httpd web server apache2
Feb 20 19:01:57 censuitecrm apache2[16155]: AH00558: apache2: Could not reliably determine the server's fu
Feb 20 19:01:58 censuitecrm apache2[16155]:  *
Feb 20 19:01:58 censuitecrm systemd[1]: Started LSB: Apache2 web server.

Configuración web de SuiteCRM

-Abrimos un browser y navegamos al url http://ip-servidor-ubuntu/scrm Verificamos la licencia de uso, marcamos su checkmark I Accept y damos click al botón Next para continuar
Aceptamos la licencia de uso de SuiteCRM

-El asistente hace un pre chequeo de requisitos de paquetes PHP, en caso de faltar alguno, se nos mostrara el mensaje de error para que lo corrijamos. Damos click al botón Next
El asistente verifica esten todos los paquetes PHP necesitados

-En el paso 2 del asistente debemos configurar la conexión a MariaDB

  • Database Name: Nombre de la db creada en pasos anteriores en MariaDB
  • Host Name: localhost o la ip del servidor MariaDB
  • SuiteCRM Database User: Provide existing user (Elegimos que usaremos un usuario ya creado)
  • SuiteCRM Database User: suitecrmadm (usuario ya creado en pasos anteriores)
  • SuiteCRM Database User Password: Contraseña del usuario
  • Re-enter SuiteCRM Database User Password: Confirmamos la contraseña
  • SuiteCRM Application Admin Name: admin o el nombre que quieras para el usuario administrador de SuiteCRM
  • SuiteCRM Admin User Password: Contraseña de la cuenta
  • Re-enter SuiteCRM Admin User Password: Volvemos a escribir la contraseña
  • URL of SuiteCRM Instance: http://192.168.5.103/scrm o URL final que tendrá SuiteCRM
  • Email Address: email del administrador

Configuramos en el paso 2 la conexion a MariaDB

-Bajo More options veremos una serie de opciones interesantes que aunque no son obligatorias (la mayoría las podemos configurar después de instalar) es bueno que las veamos antes

  • Choose Demo Data: No sabes usar o como comenzar con SuiteCRM? Instala los datos de ejemplo activando Popular Database with Demo Data
  • SMTP Server Specification: Para que nuestro CRM te alerte, debe haber un smtp server configurado. En este articulo no lo veremos, pero lo podemos configurar ya después de instalado. Te recomiendo este articulo sobre Postfix smtp server
  • Branding: Nombra tu CRM y coloca tu Logo, ejemplo, DriveMeca SuiteCRM
  • System Locale Settings: Personaliza zona horaria, símbolo de moneda, código, etc (mas adelante podemos modificarlo ya instalado)
Damos click al botón Next
El asistente nos permite configurar mas opciones para SuiteCRM

-Se realiza un proceso en la db y se nos redirecciona a la pagina de inicio. Ingresamos con la cuenta admin y su contraseña. Presionamos Enter o damos click a Log In
Ingresamos con la cuenta admin de SuiteCRM

-Se ejecuta un asistente dándonos la bienvenida. Damos click al botón Next
En el primer inicio un asistente nos da la bienvenida en SuiteCRM

-En el siguiente paso se nos piden datos para nuestra cuenta admin. No son obligatorios todos pero es bueno llenar la mayor cantidad posible. Damos click al botón Next
Llenamos los campos de informacion de nuestra cuenta admin de SuiteCRM

-Activamos zona horaria, tipo de moneda, formato de fecha, etc. Damos click al botón Next
Activamos zona horaria, hora, fecha y demas datos para nuestro CRM

-Ya en el final del asistente podemos dirigirnos directamente a una función o ingresar a SuiteCRM. Damos click a Start Using SuiteCRM
Ingresamos a SuiteCRM al final del asistente

-Se nos muestra el dashboard de SuiteCRM
El dashboard de SuiteCRM muestra mucha informacion

-Volvemos a la consola a crear una tarea cron. Esta tarea nos permitirá ejecutar los procesos que se creen dentro de SuiteCRM como el usuario de Apache
sudo crontab -e -u www-data
[sudo] password for drivemeca: 
no crontab for www-data - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.tiny

Choose 1-3 [2]: 3

* * * * *       cd /var/www/html/scrm; php -f cron.php > /dev/null 2>&1

-Activamos el proceso cron, lo iniciamos y verificamos quede ejecutandose
sudo systemctl enable cron
sudo systemctl restart cron
sudo systemctl status cron
cron.service - Regular background program processing daemon
   Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-02-20 23:51:39 UTC; 5s ago
     Docs: man:cron(8)
 Main PID: 16946 (cron)
   CGroup: /system.slice/cron.service
           └─16946 /usr/sbin/cron -f

Feb 20 23:51:39 censuitecrm systemd[1]: Started Regular background program processing daemon.
Feb 20 23:51:39 censuitecrm cron[16946]: (CRON) INFO (pidfile fd = 3)
Feb 20 23:51:39 censuitecrm cron[16946]: (CRON) INFO (Skipping @reboot jobs -- not system startup)

Como instalar idioma español

-SuiteCRM viene por default en idioma ingles pero podemos pasarlo a otros idiomas gracias a la comunidad que ha hecho las traducciones y publicado estos archivos.
Navegamos al URL oficial de traducciones SuiteCRM y buscamos las variantes de Español. Damos click a la bandera de la opción que elijamos

En la pagina de traducciones damos click a la bandera de la que elijamos

-En la siguiente pagina veremos mas información sobre la traducción que elegimos. Para descargar damos click al botón de nube en la esquina superior derecha y seguidamente click al botón Download para descargar un zip en nuestro equipo local
Descargamos el zip de traduccion de SuiteCRM

-De regreso a SuiteCRM damos click al nombre de nuestro usuario en la esquina superior derecha y seguidamente click a Admin
Ingresamos a las opciones de Admin

-En la sección Developer Tools damos click a Module Loader
Ingresamos a Module Loader

-En la pagina que nos aparece damos click al botón Seleccionar archivo. Buscamos el zip que descargamos de la traducción y lo abrimos
Abrimos el zip de traducciones

-Seguidamente damos click al botón UPLOAD
Cargamos la traduccion dando click al boton UPLOAD

-Ya veremos la traducción cargada. Damos click al botón INSTALL
Instalamos la traduccion en SuiteCRM

-Listos para activar la traducción? Damos click al botón COMMIT
Activamos la traduccion dando click al boton COMMIT

-Muy bien, ya tenemos instalada y activa la traduccion
Ya tenemos instalada y activa la traduccion

Como eliminar un modulo o idioma en SuiteCRM

-En un momento dado si queremos eliminar un modulo o traducción, los veremos listados en Module Loader dentro de la sección Developer Tools. Damos click a su botón UNINSTALL para eliminarlo o DISABLE para deshabilitarlo sin eliminarlo
Es sencillo eliminar o deshabilitar un modulo en SuiteCRM

-Seguidamente nos desconectamos para que tomen efecto los cambios. Damos click a nuestro nombre de usuario en la esquina superior derecha y seguidamente click a Logout
Nos desconectamos para activar cambios

-Ya en la pantalla de inicio podemos elegir el idioma en que trabajaremos dentro de nuestro CRM
En la pantalla de inicio ahora podemos elegir el idioma

-Al ingresar, el dashboard o pantalla principal de SuiteCRM ya se muestra en Español
Ya podemos ver el dashboard de SuiteCRM en Español

Como crear empleados SuiteCRM

-Conectados como admin damos click al nombre de nuestro usuario en la esquina superior derecha y seguidamente click a Empleados
Ingresamos al menu Empleados

-En la esquina superior izquierda veremos el botón Crear Empleado, le daremos click
Damos click a Crear Empleado

-En la pagina que veremos tendremos los campos para crear un nuevo empleado. Al final damos click al botón GUARDAR
Tenemos una variedad de campos a llenar para crear un empleado

-El sistema nos mostrara un listado de los empleados actuales creados en el sistema
En el listado de Empleados tambien vemos informacion valiosa

-SuiteCRM es una gran herramienta para organizar tu negocio
SuiteCRM sera tu aliado para manejar tu negocio

SuiteCRM es una formidable opción CRM para manejar cualquier negocio, independientemente su tamaño y con un servidor Ubuntu, mucho mejor. Ya lo conocías, lo utilizas, usas otro, cual?

Artículos recomendadosConoce mejor a tus clientes; instala SugarCRM
                                            Llevando el control de tu negocio con Dolibarr ERP/CRM
                                            Como instalar Vtiger CRM paso a paso en Linux
                                            Como instalar odoo ERP en Linux Centos 7 paso a paso


Quiero vivir de mi blog, de enseñar opensource, pero esto no sera posible sin tu apoyo, me ayudas?

Donar 25 USD

Satisfech@ con el articulo? Bien, hazme un favor, compártelo en tus redes sociales (compartir es sexy). Escríbeme en los comentarios aquí debajo y pasa la voz compartiendo el tweet.
Sígueme en twitter google+facebook, email o YouTube  y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.


Share/Bookmark

Como instalar LAMP en Linux Ubuntu server paso a paso

DriveMeca instalando LAMP en Linux Ubuntu LTS
Una de las formas mas comunes en que usamos nuestros servidores Linux es sirviendo paginas web como por ejemplo instalando algún CMS como WordPress, Joomla, Drupal entre otros. Esta configuracion es conocida como LAMP y viene de las iniciales Linux-Apache-MySQL/MariaDB-PHP.

Para este articulo veremos como instalar y configurar un servidor Linux Ubuntu 16.04 LTS en modo LAMP (en vez de MySQL usaremos MariaDB) paso a paso de la forma mas sencilla y rápida.

Debo aclarar que LAMP no solo se ve en Linux Ubuntu, en todas las distribuciones Linux podemos instalar y configurar gracias a la "magia" del opensource con relativamente pocos cambios. Comencemos entonces con otro articulo de Ubuntu en español

Requerimientos para instalar LAMP en Linux Ubuntu

Como instalar LAMP en Linux Ubuntu server paso a paso

Instalamos dependencias

-Abrimos una consola e instalamos apache, mariadb y php en su versión 7
sudo apt install apache2 mariadb-server php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0

Vídeo tutorial instalando y configurando LAMP en Ubuntu Server



Activamos Apache 2 en Linux Ubuntu Server

-Activamos el servicio para que ejecute cada vez que haga boot el servidor Linux y ejecutamos apache 2
sudo systemctl enable apache2
sudo systemctl start apache2

-Verificamos este ejecutándose el servicio de Apache 2
sudo systemctl status apache2
apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since dom 2016-05-01 17:22:24 COT; 24min ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/apache2.service
           ├─11573 /usr/sbin/apache2 -k start
           ├─11576 /usr/sbin/apache2 -k start
           ├─11577 /usr/sbin/apache2 -k start
           ├─11578 /usr/sbin/apache2 -k start
           ├─11579 /usr/sbin/apache2 -k start
           └─11580 /usr/sbin/apache2 -k start

may 01 17:22:23 xe systemd[1]: Stopped LSB: Apache2 web server.
may 01 17:22:23 xe systemd[1]: Starting LSB: Apache2 web server...
may 01 17:22:23 xe apache2[11555]:  * Starting Apache httpd web server apache2
may 01 17:22:24 xe apache2[11555]:  *
may 01 17:22:24 xe systemd[1]: Started LSB: Apache2 web server.
may 01 17:46:52 xe systemd[1]: Started LSB: Apache2 web server.

-Abrimos un browser en otro pc dentro de nuestra LAN y navegamos a la ip del servidor Linux
Navegamos a la ip de nuestro Ubuntu LAMP verificando apache

Ya tenemos activo nuestro Apache2

Articulo recomendado: Como instalar interfaz grafica en Ubuntu server paso a paso

Activamos MariaDB en Linux Ubuntu Server

-En estos momentos en Linux Ubuntu al instalar MariaDB no se pide la contraseña  de la cuenta root, por ello la borraremos directamente en la db para poder cambiarla despues
sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
quit;

-Aseguramos nuestra instalación de MariaDB colocándole contraseña a la cuenta root de MariaDB. Solo escribimos la contraseña y las demás preguntas las dejamos con el default presionando Enter
sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password: <---escribimos contraseña a la cuenta root de MariaDB
Re-enter new password: <---confirmamos contraseña a la cuenta root de MariaDB
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

-Activamos el servicio de MariaDB y verificamos que este ejecutándose
sudo systemctl enable mysql
sudo systemctl status mysql
mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: active (running) since dom 2016-05-01 17:21:45 COT; 2h 17min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 27 (limit: 512)
   Memory: 83.5M
      CPU: 6.150s
   CGroup: /system.slice/mysql.service
           ├─4272 /bin/bash /usr/bin/mysqld_safe
           ├─4273 logger -p daemon err -t /etc/init.d/mysql -i
           ├─4417 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file
           └─4418 logger -t mysqld -p daemon error

may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.func                                         OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.gtid_slave_pos                               OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.help_category                                OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.help_keyword                                 OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.help_relation                                OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.help_topic                                   OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.host                                         OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.index_stats                                  OK
may 01 17:22:21 xe /etc/mysql/debian-start[4469]: mysql.innodb_index_stats                           OK
may 01 17:22:21 xe /etc/mysql/debian-start[11440]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Artículos recomendadosComo optimizar MySQL / MariaDB de forma segura
                                           5 pasos para instalar MariaDB en Ubuntu Server

Verificamos PHP y sus módulos instalados en Linux Ubuntu Server


-Verificamos versión de PHP instalada
php -v
PHP 7.0.25-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.25-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

-Creamos un archivo php para verificar módulos instalados con PHP
sudo vi /var/www/html/index.php
<?php
phpinfo();
?>

-Reiniciamos el servicio de Apache2
sudo systemctl restart apache2

-Abrimos un browser en otro pc en nuestra LAN y navegamos a la ip del servidor Linux Ubuntu LTS http://ip-server/index.php
Verificamos nuestro Ubuntu LAMP


Ya tenemos un servidor Linux Ubuntu LTS con Apache, MariaDB y PHP 7 (comúnmente conocido como LAMP Ubuntu) listo para trabajar con nuestros proyectos web.

Artículos recomendadosComo agregar una cuenta a sudoers en Linux Ubuntu o Debian
                                           Como instalar MySQL Workbench en Linux Ubuntu paso a paso
                                           Como instalar phpMyAdmin paso a paso
                                           Como instalar Webmin en Linux Ubuntu paso a paso

Quiero vivir de mi blog, de enseñar opensource, pero esto no sera posible sin tu apoyo, me ayudas?

Donar 25 USD

Satisfech@ con el articulo? Bien, hazme un favor, compártelo en tus redes sociales (compartir es sexy). Escríbeme en los comentarios aquí debajo y pasa la voz compartiendo el tweet.

Sígueme en twitter google+facebook, email o YouTube  y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.


Share/Bookmark

Como optimizar MySQL / MariaDB de forma segura

Como optimizar MySQL / MariaDB de forma segura

Muchas de las aplicaciones de hoy en día utilizan MySQL o MariaDB como motor de bases de datos para soluciones LAMP. En base a esto se necesita que los query (consultas por medio de SQL) sean lo mas rápido posible para que no tengamos retrasos en la entrega de datos. Nuestro articulo hoy sera sobre como optimizar MySQL / MariaDB de forma segura.

Ademas de tener un buen código, es buena idea tener bien optimizado tu sistema para que todo sea rápido. Buscando en internet encontré este script que nos permite optimizar el motor de bases de datos de una forma bastante sencilla.

Su nombre es MySQLTuner y esta escrito en perl pudiéndose ejecutar en cualquier distribución Linux actual que tenga perl instalado. Para este articulo lo mostrare en un servidor Linux Centos 7 con MariaDB pero esto no significa que no lo puedas ejecutarlo en otra distribución Linux cumpliendo los siguientes requerimientos.

Requerimientos para ejecutar MySQLTuner

  • Linux
  • MariaDB o MySQL
  • Cuenta root del motor de bases de datos
  • Perl

Como optimizar MySQL / MariaDB de forma segura

-Antes de comenzar te recomiendo siempre tener un backup de la configuracion de tu MariaDB o MySQL. Ya sea copiando el /etc/my.cnf a otro carpeta o dejando una copia comentada de las variables modificadas

-Instalamos para nuestro uso
yum install wget less

-El primer paso es verificar que nuestro servidor de bases de datos este ejecutándose. Ejecutamos el siguiente comando

sudo systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-02-16 20:32:43 UTC; 12min ago
 Main PID: 389 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─389 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─550 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/pl...

Feb 16 20:32:38 cenwp.drivemeca.com systemd[1]: Starting MariaDB database server...
Feb 16 20:32:38 cenwp.drivemeca.com mariadb-prepare-db-dir[358]: Database MariaDB is probably initialized i...e.
Feb 16 20:32:39 cenwp.drivemeca.com mysqld_safe[389]: 180216 20:32:39 mysqld_safe Logging to '/var/log/mar...g'.
Feb 16 20:32:39 cenwp.drivemeca.com mysqld_safe[389]: 180216 20:32:39 mysqld_safe Starting mysqld daemon w...sql
Feb 16 20:32:43 cenwp.drivemeca.com systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
Verificamos este ejecutandose el servicio en Linux

-Para conocer mas sobre MariaDB verificamos que versión tenemos instalada en nuestro Linux Centos
rpm -qa|grep mariadb
mariadb-5.5.56-2.el7.x86_64
mariadb-server-5.5.56-2.el7.x86_64
mariadb-libs-5.5.56-2.el7.x86_64
Conocer que paquetes tienes de MariaDB puede ser ventajoso

-Creamos un directorio para descargar el script y ejecutarlo desde ahi
mkdir mysqltuner
cd mysqltuner

-Descargamos el script MySQLTuner junto a dos archivos mas que nos pueden servir para otras tareas de verificacion
wget http://mysqltuner.pl/ -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
Con MySQLTuner descargamos 2 archivos mas

-Damos permisos de ejecución al script
chmod +x mysqltuner.pl

-Tienes dudas de como usar el script. Su ayuda te servirá para sacarle el mayor provecho al script
./mysqltuner.pl --help
Name:
     MySQLTuner 1.7.5 - MySQL High Performance Tuning Script

Important Usage Guidelines:
    To run the script with the default options, run the script without
    arguments Allow MySQL server to run for at least 24-48 hours before
    trusting suggestions Some routines may require root level privileges
    (script will provide warnings) You must provide the remote server's
    total memory when connecting to other servers

Connection and Authentification:
     --host <hostname>           Connect to a remote host to perform tests (default: localhost)
     --socket <socket>           Use a different socket for a local connection
     --port <port>               Port to use for connection (default: 3306)
     --user <username>           Username to use for authentication
     --userenv <envvar>          Name of env variable which contains username to use for authentication
     --pass <password>           Password to use for authentication
     --passenv <envvar>          Name of env variable which contains password to use for authentication
     --ssl-ca <path>             Path to public key
     --mysqladmin <path>         Path to a custom mysqladmin executable
     --mysqlcmd <path>           Path to a custom mysql executable
     --defaults-file <path>      Path to a custom .my.cnf

Performance and Reporting Options:
     --skipsize                  Don't enumerate tables and their types/sizes (default: on)
                                 (Recommended for servers with many tables)
     --skippassword              Don't perform checks on user passwords(default: off)
     --checkversion              Check for updates to MySQLTuner (default: don't check)
     --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check)
     --forcemem <size>           Amount of RAM installed in megabytes
     --forceswap <size>          Amount of swap memory configured in megabytes
     --passwordfile <path>       Path to a password file list(one password by line)

Output Options:
     --silent                    Don't output anything on screen
     --nogood                    Remove OK responses
     --nobad                     Remove negative/suggestion responses
     --noinfo                    Remove informational responses
     --debug                     Print debug information
     --dbstat                    Print database information
     --idxstat                   Print index information
     --sysstat                   Print system information
     --pfstat                    Print Performance schema
     --bannedports               Ports banned separated by comma(,)
     --maxportallowed            Number of ports opened allowed on this hosts
     --cvefile <path>            CVE File for vulnerability checks
     --nocolor                   Don't print output in color
     --json                      Print result as JSON string
     --buffers                   Print global and per-thread buffer values
     --outputfile <path>         Path to a output txt file
     --reportfile <path>         Path to a report txt file
     --template   <path>         Path to a template file
     --verbose                   Prints out all options (default: no verbose)

-La forma mas sencilla de ejecutarlo es sin parámetros. De esta forma buscara un MySQL /MariaDB ejecutándose localmente. MySQLTuner nos muestra mucha información ayudado con colores

  • Mensajes en verde: Normal
  • Mensajes en rojo: Corregir o mejorar


Se nos pedirá la cuenta root (o una cuenta con permisos de root) y contraseña de MySQL / MariaDB
./mysqltuner.pl 
 >>  MySQLTuner 1.7.5 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 5.5.56-MariaDB
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mariadb/mariadb.log(3K)
[OK] Log file /var/log/mariadb/mariadb.log exists
[OK] Log file /var/log/mariadb/mariadb.log is readable.
[OK] Log file /var/log/mariadb/mariadb.log is not empty
[OK] Log file /var/log/mariadb/mariadb.log is smaller than 32 Mb
[OK] /var/log/mariadb/mariadb.log doesn't contain any warning.
[OK] /var/log/mariadb/mariadb.log doesn't contain any error.
[--] 2 start(s) detected in /var/log/mariadb/mariadb.log
[--] 1) 180216 20:32:42 [Note] /usr/libexec/mysqld: ready for connections.
[--] 2) 171127 23:14:55 [Note] /usr/libexec/mysqld: ready for connections.
[--] 1 shutdown(s) detected in /var/log/mariadb/mariadb.log
[--] 1) 171127 23:57:34 [Note] /usr/libexec/mysqld: Shutdown complete

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA 
[--] Data in InnoDB tables: 976K (Tables: 12)
[OK] Total fragmented tables: 0

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[--] There are 612 basic passwords in the list.

-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 24m 45s (17 q [0.011 qps], 15 conn, TX: 40K, RX: 1K)
[--] Reads / Writes: 100% / 0%
[--] Binary logging is disabled
[--] Physical Memory     : 512.0M
[--] Max MySQL memory    : 836.0M
[--] Other process memory: 78.2M
[--] Total buffers: 416.0M global + 2.8M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 418.8M (81.79% of installed RAM)
[!!] Maximum possible memory usage: 836.0M (163.28% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/17)
[OK] Highest usage of available connections: 0% (1/151)
[!!] Aborted connections: 46.67%  (7/15)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 7 selects)
[OK] Query cache prunes per day: 0
[OK] No Sort requiring temporary tables
[OK] No joins without indexes
[OK] Temporary tables created on disk: 0% (0 on disk / 4 total)
[!!] Thread cache is disabled
[OK] Table cache hit rate: 100% (26 open / 0 opened)
[OK] Open file limit used: 2% (21/1K)
[OK] Table locks acquired immediately: 100% (36 immediate / 36 locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 4 thread(s).
[--] Using default value is good enough for your version (5.5.56-MariaDB)

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (24M used / 134M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/99.0K

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[!!] InnoDB File per table is not activated
[OK] InnoDB buffer pool / data size: 128.0M/976.0K
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (7.8125 %): 5.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[OK] InnoDB Read buffer efficiency: 91.91% (4531 hits/ 4930 total)
[!!] InnoDB Write Log efficiency: 0% (1 hits/ 0 total)
[OK] InnoDB log waits: 0.00% (0 waits / 1 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/1B

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    MySQL started within last 24 hours - recommendations may be inaccurate
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Enable the slow query log to troubleshoot bad queries
    Reduce or eliminate unclosed connections and network issues
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    Set thread_cache_size to 4 as a starting value
    Consider installing Sys schema from https://github.com/mysql/mysql-sys
    Read this before changing innodb_log_file_size and/or innodb_log_files_in_group: http://bit.ly/2wgkDvS
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    thread_cache_size (start at 4)
    innodb_file_per_table=ON

    innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.

-Despues de ejecutar MySQLTuner veremos al final una serie de recomendaciones para agregar a nuestro motor de bases de datos. Editamos y agregamos
vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
query_cache_size=0
query_cache_type=0
query_cache_limit=1M
thread_cache_size=4

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

!includedir /etc/my.cnf.d

-Reiniciamos el servicio y verificamos quede ejecutándose correctamente con los cambios en su configuracion
systemctl restart mariadb
systemctl status mariadb


-Tienes dudas de como mas ejecutar el script? Su ayuda te servira
./mysqltuner.pl --help
Name:
     MySQLTuner 1.7.5 - MySQL High Performance Tuning Script

Important Usage Guidelines:
    To run the script with the default options, run the script without
    arguments Allow MySQL server to run for at least 24-48 hours before
    trusting suggestions Some routines may require root level privileges
    (script will provide warnings) You must provide the remote server's
    total memory when connecting to other servers

Connection and Authentification:
     --host <hostname>           Connect to a remote host to perform tests (default: localhost)
     --socket <socket>           Use a different socket for a local connection
     --port <port>               Port to use for connection (default: 3306)
     --user <username>           Username to use for authentication
     --userenv <envvar>          Name of env variable which contains username to use for authentication
     --pass <password>           Password to use for authentication
     --passenv <envvar>          Name of env variable which contains password to use for authentication
     --ssl-ca <path>             Path to public key
     --mysqladmin <path>         Path to a custom mysqladmin executable
     --mysqlcmd <path>           Path to a custom mysql executable
     --defaults-file <path>      Path to a custom .my.cnf

Performance and Reporting Options:
     --skipsize                  Don't enumerate tables and their types/sizes (default: on)
                                 (Recommended for servers with many tables)
     --skippassword              Don't perform checks on user passwords(default: off)
     --checkversion              Check for updates to MySQLTuner (default: don't check)
     --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check)
     --forcemem <size>           Amount of RAM installed in megabytes
     --forceswap <size>          Amount of swap memory configured in megabytes
     --passwordfile <path>       Path to a password file list(one password by line)

Output Options:
     --silent                    Don't output anything on screen
     --nogood                    Remove OK responses
     --nobad                     Remove negative/suggestion responses
     --noinfo                    Remove informational responses
     --debug                     Print debug information
     --dbstat                    Print database information
     --idxstat                   Print index information
     --sysstat                   Print system information
     --pfstat                    Print Performance schema
     --bannedports               Ports banned separated by comma(,)
     --maxportallowed            Number of ports opened allowed on this hosts
     --cvefile <path>            CVE File for vulnerability checks
     --nocolor                   Don't print output in color
     --json                      Print result as JSON string
     --buffers                   Print global and per-thread buffer values
     --outputfile <path>         Path to a output txt file
     --reportfile <path>         Path to a report txt file
     --template   <path>         Path to a template file

     --verbose                   Prints out all options (default: no verbose)

MySQLTuner no reemplaza a un DBA pero te servirá para hacer unos cambios simples en la configuracion de MySQL / MariaDB mejorando su rendimiento

Artículos recomendados:Acelera con nginx tu servidor Ubuntu LEMP
                       Como instalar Adminer en Linux Centos paso a paso
                       Como cambiar la contraseña de root en MySQL
                       15 minutos para configurar un Linux Centos 7 LAMP
                       Como instalar phpMyAdmin paso a paso
                       Como instalar MySQL Workbench en Linux Ubuntu paso a paso



Quiero vivir de mi blog, de enseñar opensource, pero esto no sera posible sin tu apoyo, me ayudas?


Satisfech@ con el articulo? Bien, hazme un favor, compártelo en tus redes sociales (compartir es sexy). Escríbeme en los comentarios aquí debajo y pasa la voz compartiendo el tweet.
Sígueme en twitter google+facebook, email o YouTube  y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.


Share/Bookmark