Instalación de múltiples instancias de un servidor SQL en GNU/Linux mediante docker

docker

Instalación de múltiples instancias de un servidor SQL en GNU/Linux mediante docker

Descargar la imagen de Microsoft

docker pull mcr.microsoft.com/mssql/server:2017-latest

docker run –restart on-failure:3 –name <nombre instancia> -v /var/opt/mssql/<ruta>:/var/opt/mssql -e ‘ACCEPT_EULA=Y’ -e ‘MSSQL_SA_PASSWORD=<password>’ -p 1402:1433 -d mcr.microsoft.com/mssql/server:2017-latest

/** docker run –restart unless-stopped –name nocrash nocrashing  **/  opción para rearrancar siempre el contenedor, excepto si fue parado implícitamente

Para realizar backup de una BBDD desde sqlserver (Linux)

/opt/mssql-tools/bin/sqlcmd -S <ip>,<port> -U SA -P <password> -Q “BACKUP DATABASE <BBDD> TO DISK = N’/var/opt/mssql/data/<URL>/<BBDD>.bak’ WITH NOFORMAT, NOINIT, NAME = ‘<BBDD>-full’, SKIP, NOREWIND, NOUNLOAD, STATS = 10”

Comandos docker (apuntes)

  • docker pull NOMBREIMAGEN . Este comando sirve para descargar una imagen
    docker images muestra imágenes que tenemos descargadas
    docker ps -a muestra que contenedores estan funcionando
    docker rmi IMAGE_ID
    docker info Muestra informacion de las imagenes, tamaño , fecha creacion nombre ,…
    docker search NAME para buscar in docker
    docker inspect <friendly-name|container-id> . para saber acerca del contenedor
    docker logs <friendly-name|container-id>

Comandos para el contenedor

  • docker start
    docker stop
    docker kill
    docker rm

Impactos: 0

PRESTASHOP: Añadir cif a la factura PDF

prestashop

Para mostrar en nuestras facturas el CIF de nuestra empresa (o DNI en caso de que seas autónomo) tenemos dos formas de hacerlo, una muy sencilla y otra algo más complicada.

1.- Forma fácil

Ir a Pedidos->Facturas donde verás un campo que pone Texto legal libre que podrías aprovechar para poner el CIF de tu empresa.

Este método tiene un inconveniente, ya que el CIF o DNI saldría en la parte inferior de la factura y no parece la forma más profesional.

2.- Forma menos sencilla

Para conseguir poner el CIF junto con tu dirección en la esquina superior izquierda de la factura tienes que editar el archivo invoice.addresses-tab.tpl que se encuentra en la ruta;

public_html/pdf/invoice.addresses-tab.tpl

Descarga este archivo y añade debajo de

{if isset($order_invoice)}{$order_invoice->shop_address}{/if}

la siguiente linea de código:

<br/>CIF: XXXXXXXXX

cambiando XXXXXXXXX por el CIF que quieras mostrar. Guarda los cambios y sube el archivo a la carpeta pdf.

De esta forma el CIF se mostrará debajo de tu dirección.
————————————————————
otra manera:
Preferencias -> Contacto y tiendas

Sitúate en esa opción del menú y en la parte central de la pantalla te aparecerán todos los datos de contacto de tu tienda.

Nombre, email, código postal, etc. El campo que a ti te interesa es Número de registro. Ahí puedes introducir tu CIF o NIF y automáticamente aparecerá al pie de página de tus facturas en PDF.

Impactos: 2

Insertar video en prestashop

prestashop

Cómo insertar Videos en Prestashop

<p><iframe width=”300″ height=”200″ style=”margin-left: auto; margin-right: auto;” src=”https://www.youtube-nocookie.com/embed/yoZU3H5-0ag?rel=0&controls=0” frameborder=”0″></iframe></p>

<iframe width=”300″ height=”200″ style=”margin-left: auto; margin-right: auto;” src=”https://www.youtube.com/embed/vOAXDSuvn4I” frameborder=”0″ allow=”autoplay; encrypted-media” allowfullscreen></iframe>

Impactos: 1

Configuración del error 404 en el httpd.conf Apache

Apache

Cómo configurar y personalizar la página de error 404, de página no encontrada, en el servidor Apache con la directiva ErrorDocument.

Editar:
etc/apache2/sites-available/000-default.conf
y añadir.
ErrorDocument 404 /index.php “Url que queremos que responda”

En este caso, se indicaría que, bajo un error 404, se debe enviar el documento que está en el archivo “mipagina404.html” (o cualquier otro documento que queramos utilizar como página de error). La ruta indicada hacia el archivo comienza por “/”, por lo que Apache entenderá que el mismo está en la raíz del dominio

https://desarrolloweb.com/articulos/configurar-pagina-error-404-apache.html

Impactos: 1

Como evitar el límite de subida de 2 Mb en WordPress

limpiar-html-wordpress

Cambiar en php.ini

Maximum allowed size for uploaded files.
upload_max_filesize = 2M
por
Maximum allowed size for uploaded files.
upload_max_filesize = 10M

Si lo anterior falla
max_execution_time = 7200; //Aumentar el tiempo de espera
upload_max_filesize = 20M; //aumentar tamaño permitido de archivos a subir
post_max_size = 20M; //aumentar tamaño de post

sino .htaccess
php_value upload_max_filesize 10M#set max post size
php_value post_max_size 10M

Impactos: 4

Aliños VMware

vmware

mainMem.useNamedFile = “FALSE”
logging = “FALSE”
isolation.tools.unity.disable=”TRUE”
unity.allowCompositingInGuest=”FALSE”
unity.enableLaunchMenu = “FALSE”
unity.showBadges = “FALSE”
unity.showBorders = “FALSE”
unity.wasCapable = “FALSE”
MemAllowAutoScaleDown = “FALSE”
MemTrimRate = “0”
sched.mem.pshare.enable = “FALSE”
snapshot.disabled = “TRUE”
prefvmx.useRecommendedLockedMemSize = “TRUE”

Impactos: 9

notas ESX-i

vmware

vim-cmd vmsvc/getallvms

Start /MIN /D “C:\Program Files\VMware\VMware Remote Console\” vmrc vmrc://root@<IP>/?moid=<ID>
—————————————————-

Apagar virtual machine

esxcli vm process list

esxcli vm process kill –type= [soft,hard,force] –world-id= WorldNumber

Empezaremos realizando una comprobación de disco, cualquier de las dos posibles opciones siguientes es valida:

vmkfstools -x check /vmfs/volumes/NOMBRE_DATASTORE/NOMBRE_CARPETA/NOMBRE_DISCO.vmdk

vmkfstools –fix check /vmfs/volumes/NOMBRE_DATASTORE/NOMBRE_CARPETA/NOMBRE_DISCO.vmdk

La construcción final que hemos hecho en nuestro laboratorio será la siguiente:

vmkfstools –fix check /vmfs/volumes/Datastore3/SRVDC/SRVDC.vmdk

Disk is error free

Si no se encuentran errores en nuestro disco nos desvolverá el mensaje que podemos ver en nuestro ejemplo.

Continuaremos con las opciones de reparación de un disco virtual como en el caso anterior cualquiera de las dos versiones es totalmente válida:

vmkfstools -x repair /vmfs/volumes/NOMBRE_DATASTORE/NOMBRE_CARPETA/NOMBRE_DISCO.vmdk

vmkfstools –fix repair /vmfs/volumes/NOMBRE_DATASTORE/NOMBRE_CARPETA/NOMBRE_DISCO.vmdk

La construcción final que hemos hecho en nuestro laboratorio será la siguiente:

vmkfstools –fix repair /vmfs/volumes/Datastore3/SRVDC/SRVDC.vmdk

Disk is error free

También tenemos la opción de poder comprobar toda la cadena de disco, así podremos determinar si alguno de los eslabones de la cadena están dañados o existe alguna relación no válida entre padres e hijos.

Para llevar a cabo esta acción usaremos el parámetro –chainConsistent en la construcción que mostramos a continuación

vmkfstools –chainConsistent /vmfs/volumes/NOMBRE_DATASTORE/NOMBRE_CARPETA/NOMBRE_DISCO.vmdk

La construcción final que hemos construido en nuestro laboratorio será la siguiente:

vmkfstools –chainConsistent /vmfs/volumes/Datastore3/SRVDC/SRVDC.vmdk

/vmfs/volumes/58faf513-14e12610-798d-002186282a26/ram

sched.swap.dir
cambiar hora sistema
esxcli system time set -d 24 -H 18 -m 10 -M 07 -y 2017

esxcli hardware clock set -d 24 -H 18 -m 10 -M 07 -y 2017

How to Increase Session Timeout on ESXi 6 & 6.5

To increase the session timeout, all you need to do is change one advanced configuration parameter in the ESXi Host Client Web Interface.

First, log in to the web interface. After doing so, navigate to Host > Manage > System > Advanced Settings. Scroll down or search for the UserVars.HostClient.SessionTimeout key.

Impactos: 3

Habilitar ssh root Ubuntu

Ubuntu

sudo nano /etc/ssh/sshd_config
change
PermitRootLogin prohibit-password
to
PermitRootLogin yes
or sudo sed -i ‘s/prohibit-password/yes/’ /etc/ssh/sshd_config
in order to PAM authentication add
AllowUsers root
or sudo echo “AllowUsers root” >> /etc/ssh/sshd_config
sudo service ssh restart

sudo passwd root

Impactos: 3

Habilitar VNC en implementaciones de VMware

vmware

This article outlines the steps needed to enable VNC on VMware, so that the VNC console can be used within the Platform9 UI.
Step 1 – Changes Needed on the ESXi Hosts Housing the Virtual Machines

SSH to the ESXi host (not vCenter). We need to open the VNC ports on the ESXi firewall. These steps need to be performed on all the ESX hosts that are part of the clusters authorized with Platform9 controller. An automated script for doing same is coming soon.

chmod 644 /etc/vmware/firewall/service.xml
chmod +t /etc/vmware/firewall/service.xml
vi /etc/vmware/firewall/service.xml

Create a new service block before the end of ConfigRoot tag.

<service id=”new unique id within this file”>
<id>VNC</id>
<rule id=”0000″>
<direction>inbound</direction>
<protocol>tcp</protocol>
<porttype>dst</porttype>
<port>
<begin>5900</begin>
<end>6199</end>
</port>
</rule>
</service>

Step 2 – Add Firewall Rules to the ESXi Firewall and Verify that Ports Have Been Opened

On the ESXi host, execute the following commands

esxcli network firewall refresh
esxcli network firewall ruleset set –ruleset-id VNC –enabled true

Verify that the firewall rules were applied and the ports are open by executing the following commands

esxcli network firewall ruleset list
# You should see a rule labelled VNC in the output
esxcli network firewall ruleset rule list
# You should see the details of VNC rule i.e. port range, protocol, direction, etc.

Step 3 – Enable VNC for Existing Virtual Machines (Optional)

To enable VNC console for existing VMs, power off the VM and use one of the following:

Using vSphere Web Client
Click on “edit settings”-> Select the “VM Options” tab->Expand the “Advanced” section-> click on “Edit configuration” and add the settings mentioned at the end of this step
Directly on ESXi Host
Edit the *.vmx file of the corresponding VM and the lines mentioned here.

RemoteDisplay.vnc.enabled = “TRUE”
RemoteDisplay.vnc.port = “<port>” # Port between 5900 and 6199

IMPORTANT NOTES –
1. The key point in the step 3 is to make sure that the port number that you are adding does not collide with any other VM. One way to verify that is to SSH into the ESXi host and run grep on all the *.vmx files and choose a port that is not present in the output

grep “vnc.port” */*/*/*/*.vmx

2. For VNC console to work, the appliance, the ESX host, and the browser where the VNC is being accessed need to have IP connectivity to each other.

https://docs.platform9.com/support/enable-vnc-on-vmware-deployments/

Impactos: 0

Instalar Android Studio en Centos 7

Install Android Studio on CentOS 7

If you have installed CentOS7 on your computer, you can install android studio by just running two scripts. The scripts are given below. If you are not interested to install using the scripts, you can run the commands one by one.

For the installation you have to download jdk-8u101-linux-x64.rpm(for 64 bit) and android-studio-ide-145.3330264-linux.zip. JDK can be downloaded from the link http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
Assumed that you installed 64 bit version of CentOS.

Android studio zip file can be downloaded from https://developer.android.com/studio/index.html.

Take your terminal and login as root. Move the downloaded files to your /opt folder. Then create step1.sh and step2.sh in your /opt folder. Run them as

#./step1.sh
#./step2.sh

step1.sh
#!/bin/bash
yum group install -y “Development Tools”
yum install -y glibc.i686
yum install -y libgcc_s.so.1
yum remove -y java
cd /opt
yum localinstall -y jdk-8u101-linux-x64.rpm

step2.sh
#!/bin/bash
cd /opt
unzip android-studio-ide-145.3330264-linux.zip
cd android-studio/bin
./studio.sh

Oracle JDK is required for Android, because of that we are removing Open JDK and installing Oracle JDK.

Impactos: 1