MySQL: Data Base Server installation
Oct 18, 07 by Juan Lebrijo about blog, MySQL
We are going to install a MySQL data base server over Debian etch. Install:
elite:~# apt-get install mysql-server mysql-client
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Se instalarán los siguientes paquetes extras:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl
 libplrpc-perl mysql-client-5.0 mysql-server-5.0
Paquetes sugeridos:
  dbishell libcompress-zlib-perl tinyca
Se instalarán los siguientes paquetes NUEVOS:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl
 libplrpc-perl mysql-client mysql-client-5.0 mysql-server
 mysql-server-5.0
0 actualizados, 8 se instalarán, 0 para eliminar y 1 no actualizados.
Necesito descargar 33,4MB de archivos.
Se utilizarán 87,7MB de espacio de disco adicional después de desempaquetar.
Insure the server puting a secure password:
elite:~# mysqladmin -u root password very-secure-password
In order to do remote connections:
  • Must comment the line: bind-address = 127.0.0.1 in configuration file: /etc/mysql/my.cnf. This line makes only ear to localhost, if comment, we ear all the world 0.0.0.0.
Create a test scheme:
elite:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 21 to server version: 5.0.26-Debian_0.dotdeb.1-log

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> create database pruebas;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on pruebas.* to pruebas@’%’ identified by "very-secure-password";
Query OK, 0 rows affected (0.05 sec)

mysql> quit
Bye
With the root user we connect locally, and with pruebas user from all network. We can connect with MySQL administration tools (MySQL Administrator) provided by  MySQL:
mysql.admin.png 17.9 KB
Connect perfectly:
mysql.admin.2.png 102 KB
If you want extend your knowledge: Origin http://www.mysql.org/ Repository apt Package apt 5.0.32 Documentation (Spanish) http://www.mysql.org/doc/ Tools: http://www.mysql.com/products/tools/ Documentation (English) Files Configuration: /etc/mysql/my.cnf Daemon script: /etc/init.d/mysql Log: /var/log/mysql.log Server ports: 3306 TCP
MySQL: Instalación de un servidor de Base de Datos
Oct 18, 07 by Juan Lebrijo about blog, MySQL
Instalaremos un servidor de base de datos en red MySQL sobre un Debian etch. Instalar:
elite:~# apt-get install mysql-server mysql-client
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Se instalarán los siguientes paquetes extras:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl
 libplrpc-perl mysql-client-5.0 mysql-server-5.0
Paquetes sugeridos:
  dbishell libcompress-zlib-perl tinyca
Se instalarán los siguientes paquetes NUEVOS:
  libdbd-mysql-perl libdbi-perl libnet-daemon-perl
 libplrpc-perl mysql-client mysql-client-5.0 mysql-server
 mysql-server-5.0
0 actualizados, 8 se instalarán, 0 para eliminar y 1 no actualizados.
Necesito descargar 33,4MB de archivos.
Se utilizarán 87,7MB de espacio de disco adicional después de desempaquetar.
Aseguramos el servidor poniendo contraseña al usuario root:
elite:~# mysqladmin -u root password contraseñasupersegura
Para que podamos hacer conexiones remotas:
  • Debe estar comentada la línea: bind-address = 127.0.0.1 del fichero de configuración: /etc/mysql/my.cnf. Esta línea indica que solo se debe escuchar a localhost, si se comenta , escuchamos a todo el mundo 0.0.0.0.
Creamos un esquema de pruebas:
elite:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 21 to server version: 5.0.26-Debian_0.dotdeb.1-log

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> create database pruebas;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on pruebas.* to pruebas@’%’ identified by "supercontraseñasegura";
Query OK, 0 rows affected (0.05 sec)

mysql> quit
Bye
Con el usuario root nos conectaremos localmente, y con el usuario pruebas desde todos sitios. Podemos conectarnos con las herramientas de admistración (MySQL Administrator) que provee MySQL:
mysql.admin.png 17.9 KB
Conectaremos perfectaente:
mysql.admin.2.png 102 KB
Si quereis profundizar más os dejo la ficha: Origen http://www.mysql.org/ Repositorio apt Paquete apt 5.0.32 Documentación (Castellano) http://www.mysql.org/doc/ Herramientas: http://www.mysql.com/products/tools/ Documentación (Inglés)   Ficheros Configuración: /etc/mysql/my.cnf Control demonio: /etc/init.d/mysql Log: /var/log/mysql.log Puertos Servidor: 3306 TCP
Insure Apache (HTTPS)
Oct 15, 07 by Juan Lebrijo about blog, Web
I am going to tell you how implementing a secure web server with OpenSSL and Apache2. Then we want the system root with site configurations is encrypted. Create certificates:
  • Generate private key:
openssl genrsa 1024 > web.key
  • Without passwor to boot directly.
  • Generate the certificate petition:
openssl req -new -key web.key -out web.csr
  • Generate certificate with 10000 days validity, signed by us.
openssl req -x509 -days 10000 -key web.key -in web.csr -out web.crt
Enable SSL module mod_ssl in apache:
elite:~# cd /etc/apache2/mods-enabled/
elite:/etc/apache2/mods-enabled# ln -s ../mods-available/ssl.conf ssl.conf
elite:/etc/apache2/mods-enabled# ln -s ../mods-available/ssl.load ssl.load
elite:/etc/apache2/mods-enabled# /etc/init.d/apache restart
In order to create a Virtual Host with SSL, we must include the port declare, and host. Minium declaration:
#NameVirtualHost *:443
<VirtualHost *>
	ServerName www.midominioseguro.com
        DocumentRoot /var/www/midominioseguro/

        SSLEngine On
        SSLCertificateFile /root/web.crt
        SSLCertificateKeyFile /root/web.key
</ VirtualHost>
Activating SSL mode with SSLEngine sirective, and giving the public key web.crt, and private key web.key. Then it could access from every client to our web: https://www.midominioseguro.com. Of course, your DNS must have this name configured.