sudo apt-get -y install mariadb-client mariadb-server nginx php5-fpm php5-cli php5-gd php5-mysql git drush
cgi.fix_pathinfo=0
-Modificamos el virtualhost de nginx
cd /etc/nginx/sites-available/
sudo vi default
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
-Verificamos la configuración este ok
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
-Reiniciamos servicios
sudo /etc/init.d/nginx restart
sudo /etc/init.d/php5-fpm restart
-Nos cambiamos a la cuenta root y creamos el archivo info.php para probar que nuestro php este correctamente instalado
sudo su
echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/info.php
-Para que nos funcionen las pruebas con el dominio drupal.test.com creamos una linea en el archivo hosts en el equipo linux desde el que nos conectaremos al servidor (si el dominio es real esto no lo necesitaremos hacer)
sudo vi /etc/hosts
192.168.1.102 drupal.test.com
-Abrimos en el otro equipo un browser y navegamos a la ip del servidor para verificar la configuración de php http://drupal.test.com/info.php
-Iniciamos el servicio de mariadb
/etc/init.d/mysql start
-Aseguramos la configuración de mariadb. En los casos que el default es suficiente, presionamos Enter sin escribir para tomar el valor por default
mysql_secure_installation
/usr/bin/mysql_secure_installation: 379: /usr/bin/mysql_secure_installation: find_mysql_client: not found
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): (contraseña que colocamos al instalar mariadb)
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
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!
-Entramos a mariadb para crear la db, user y privilegios para Drupal
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 5.5.46-MariaDB-1ubuntu0.14.04.2 (Ubuntu)
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
create database drupaldb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
create user drupaluser@localhost identified by 'drupaluser';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on drupaldb.* to drupaluser@localhost identified by 'drupaluser';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
quit;
Bye
-Creamos un directorio para el certificado web y entramos a el
mkdir -p /etc/nginx/ssl
cd /etc/nginx/ssl
-Creamos un certificado con nuestros datos
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/drupal.key -out /etc/nginx/ssl/drupal.crt
Generating a 2048 bit RSA private key
........................................................+++
.......................................................................................................................................................................................+++
writing new private key to '/etc/nginx/ssl/drupal.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
CO
State or Province Name (full name) [Some-State]:
Distrito Capital
Locality Name (eg, city) []:
Bogota
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
DriveMeca
Organizational Unit Name (eg, section) []:
Opensource
Common Name (e.g. server FQDN or YOUR name) []:
DriveMeca
Email Address []:
mecasoft @ gmail.com
-Restringimos el acceso
chmod 600 drupal.key
-Creamos un directorio para las paginas de drupal
mkdir /usr/share/nginx/html/drupal
-Creamos un archivo de configuración para drupal en nginx. Este redireccionara las conexiones por el puerto 80 al puerto 443 (https)
vi /etc/nginx/sites-available/drupal
server {
server_name drupal.test.com;
root /usr/share/nginx/html/drupal;
listen 80;
listen [::]:80;
listen 443 default ssl;
ssl_certificate /etc/nginx/ssl/drupal.crt;
ssl_certificate_key /etc/nginx/ssl/drupal.key;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
location ~ \..*/.*\.php$ {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
location ~ (^|/)\. {
return 403;
}
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ '\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7
try_files $uri @rewrite;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
-Creamos un enlace simbólico para activar el sitio drupal en nginx
ln -s /etc/nginx/sites-available/drupal /etc/nginx/sites-enabled/
-Verificamos la configuración de nginx
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
-Reiniciamos el servicio de nginx
/etc/init.d/nginx restart
-Volvemos al directorio donde instalaremos y descargamos drupal con git. Hora de ir por un café ;-)
cd /usr/share/nginx/html/drupal
git clone --branch 8.0.x http://git.drupal.org/project/drupal.git
Clonar en «drupal»...
remote: Counting objects: 505518, done.
remote: Compressing objects: 100% (97092/97092), done.
Receiving objects: 100% (505518/505518), 111.09 MiB | 658.00 KiB/s, done.
remote: Total 505518 (delta 362723), reused 504132 (delta 361816)
Resolving deltas: 100% (362723/362723), done.
Checking connectivity... hecho.
-Movemos todo al directorio original (OJO con el punto (.) final)
mv drupal/* .
-Creamos archivos de configuración
cd sites/default
cp default.settings.php settings.php
cp default.services.yml services.yml
mkdir files/
chmod a+w *
-Modificamos permisos
chown -R www-data:www-data /usr/share/nginx/html/drupal/
-Abrimos un browser y navegamos a drupal.test.com/drupal. Se nos alerta de que el certificado SSL no es firmado por un emisor confiable. Hacemos caso omiso y damos click para proceder al sitio
-En la primera ventana de drupal cambiamos el idioma en que instalaremos y damos click al botón
Save and continue
-Paso seguido se nos pregunta tipo de instalación siendo la estandar la que usaremos para tomar todos los defaults (ya eres ducho con drupal, entonces usa la versión mínima). Damos click al botón
Guardar y continuar
-Escribimos los datos de la db creada en mariadb en pasos anteriores y damos click al botón
Guardar y continuar
-Finaliza la instalación
-Paso final, ponerle nombre a nuestro sitio web hecho con drupal, especificar una dirección de email desde donde se enviaran emails de alerta, etc, crear una cuenta de administrador y colocarle contraseña
-Enhorabuena ya tenemos Drupal listo para ponerse en funcionamiento alimentándolo con contenido o personalizar lo ya creado
Que tal te ha parecido la instalación, sencilla o compleja? Ya conocías Drupal, ya usas la versión 8? Déjame un comentario diciéndome como te ha ido con el.
Si te resulto útil este articulo, se social, haz un tweet, compártelo con otros por medio de los botones o sígueme en twitter , google+, facebook o email y podrás estar enterado de todas mis publicaciones.