Difference between revisions of "LAMP"

From RHS Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Insalar Linux Apache MySQL PHP (LAMP) ==
 
== Insalar Linux Apache MySQL PHP (LAMP) ==
 
1.- Crear una instancia en Amazon AWS con Ubuntu 14<br />
 
1.- Crear una instancia en Amazon AWS con Ubuntu 14<br />
2.- Instalar Apache: sudo apt-get install apache2
+
2.- Instalar Apache: sudo apt-get install apache2<br />
 +
to change 404 edit: sudoedit /etc/apache2/conf.d/localized-error-pages (plaintext or html)<br />
 
3.- Instalar MySQL  
 
3.- Instalar MySQL  
 
  <nowiki>sudo apt-get install mysql-server php5-mysql
 
  <nowiki>sudo apt-get install mysql-server php5-mysql
sudo mysql_install_db</nowiki>
+
sudo mysql_install_db
 +
mysql_secure_installation </nowiki>
 +
 
 +
<source lang="mysql">
 +
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
 +
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
 +
    ->    WITH GRANT OPTION;
 +
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
 +
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
 +
    ->    WITH GRANT OPTION;
 +
</source>
 
4.- Install PHP
 
4.- Install PHP
 
  <nowiki>sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt</nowiki>
 
  <nowiki>sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt</nowiki>
Line 11: Line 22:
 
     DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
 
     DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
 
</IfModule></nowiki>
 
</IfModule></nowiki>
 +
<br />
 +
Change phpmyadmin path: <br />
 +
edit:<br />
 +
/etc/phpmyadmin/apache.conf
 +
change Alias /phpmyadmin /usr/share/phpmyadmin<br /> to:<br />
 +
Alias /someothername /usr/share/phpmyadmin
 
restart apache: sudo service apache2 restart
 
restart apache: sudo service apache2 restart
  
Line 20: Line 37:
 
  <nowiki>CREATE USER rafaweb@localhost IDENTIFIED BY 'RafaTeVasA0lviD4r';</nowiki>
 
  <nowiki>CREATE USER rafaweb@localhost IDENTIFIED BY 'RafaTeVasA0lviD4r';</nowiki>
 
3.- Dar permisos al nuevo usuario para acceder a la base de datos creada anteriormente
 
3.- Dar permisos al nuevo usuario para acceder a la base de datos creada anteriormente
  <nowiki>GRANT ALL PRIVILEGES ON wordpress.* TO rafaweb@localhost;
+
  <nowiki>GRANT ALL PRIVILEGES ON rafawpsite.* TO rafaweb@localhost;
 
FLUSH PRIVILEGES;</nowiki>
 
FLUSH PRIVILEGES;</nowiki>
 
exit
 
exit
 +
4.- Descargar wordpress:
 +
<nowiki>cd ~
 +
wget http://wordpress.org/latest.tar.gz
 +
tar xzvf latest.tar.gz
 +
sudo apt-get update
 +
sudo apt-get install php5-gd libssh2-php
 +
</nowiki>
 +
5.- Configurar wordpress
 +
<nowiki>cd ~/wordpress
 +
cp wp-config-sample.php wp-config.php
 +
nano wp-config.php
 +
</nowiki>
 +
Definir los valores para DB_NAME, DB_USER, y DB_PASSWORD
 +
6.- Copiar los archivos al directorio donde cargara la web apache
 +
<nowiki>sudo rsync -avP ~/wordpress/ /var/www/html/</nowiki>
 +
7.- Cambiar los permisos
 +
<nowiki>cd /var/www/html
 +
sudo chown -R demo:www-data *</nowiki>
 +
8.- Crear directorio para uploads y asignarle los permisos correctos
 +
<nowiki>mkdir /var/www/html/wp-content/uploads
 +
sudo chown -R :www-data /var/www/html/wp-content/uploads</nowiki>
 +
 +
9.- Access Control
 +
Apache provides access control based on client hostname, IP address, or other characteristics of the client request using mod_access module.
 +
 +
Open your httpd.conf file:
 +
# vi /etc/httpd/conf/httpd.conf
 +
Locate directory section (for example/var/www/sub/payroll) and set it as follows:
 +
 +
<Directory /var/www/sub/payroll/>
 +
Order allow,deny
 +
Allow from 192.168.1.0/24
 +
Allow from 127
 +
</Directory>
 +
9.- Completar la instalación accediendo a la url
 +
 +
Fuente: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04

Latest revision as of 17:55, 30 September 2017

Insalar Linux Apache MySQL PHP (LAMP)

1.- Crear una instancia en Amazon AWS con Ubuntu 14
2.- Instalar Apache: sudo apt-get install apache2
to change 404 edit: sudoedit /etc/apache2/conf.d/localized-error-pages (plaintext or html)
3.- Instalar MySQL

sudo apt-get install mysql-server php5-mysql
 sudo mysql_install_db
 mysql_secure_installation 
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;

4.- Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

5.- Modify the order that Apache uses for loading pages: sudo nano /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>


Change phpmyadmin path:
edit:

/etc/phpmyadmin/apache.conf

change Alias /phpmyadmin /usr/share/phpmyadmin
to:
Alias /someothername /usr/share/phpmyadmin restart apache: sudo service apache2 restart

Instalar Wordpress

1.- Crear base de datos para wordpress en MySQL

mysql -u root -p
CREATE DATABASE rafawpsite;

2.- Crear usuario en MySQL

CREATE USER rafaweb@localhost IDENTIFIED BY 'RafaTeVasA0lviD4r';

3.- Dar permisos al nuevo usuario para acceder a la base de datos creada anteriormente

GRANT ALL PRIVILEGES ON rafawpsite.* TO rafaweb@localhost;
FLUSH PRIVILEGES;

exit 4.- Descargar wordpress:

cd ~
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo apt-get update
sudo apt-get install php5-gd libssh2-php

5.- Configurar wordpress

cd ~/wordpress
cp wp-config-sample.php wp-config.php
nano wp-config.php

Definir los valores para DB_NAME, DB_USER, y DB_PASSWORD 6.- Copiar los archivos al directorio donde cargara la web apache

sudo rsync -avP ~/wordpress/ /var/www/html/

7.- Cambiar los permisos

cd /var/www/html
sudo chown -R demo:www-data *

8.- Crear directorio para uploads y asignarle los permisos correctos

mkdir /var/www/html/wp-content/uploads
sudo chown -R :www-data /var/www/html/wp-content/uploads

9.- Access Control Apache provides access control based on client hostname, IP address, or other characteristics of the client request using mod_access module.

Open your httpd.conf file:

  1. vi /etc/httpd/conf/httpd.conf

Locate directory section (for example/var/www/sub/payroll) and set it as follows:

<Directory /var/www/sub/payroll/> Order allow,deny Allow from 192.168.1.0/24 Allow from 127 </Directory> 9.- Completar la instalación accediendo a la url

Fuente: https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04