Advertisement
Sergio_Istea

wordpress_deployer.sh

Sep 5th, 2023
1,179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3.  
  4. if test -f /deployed; then
  5.  
  6.     exit
  7. fi
  8.  
  9.  
  10. # instalacion del stack LAMP
  11.  
  12. apt update && apt install apache2 php mariadb-server libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y
  13.  
  14.  
  15. # creacion de base de datos
  16.  
  17. mysql -e "CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
  18.  
  19. # Creacion de usuario
  20.  
  21. mysql -e "CREATE USER 'wordpressuser'@'%' IDENTIFIED BY 'password';"
  22.  
  23. # PRivilegios
  24.  
  25. mysql -e "GRANT ALL ON wordpress.* TO 'wordpressuser'@'%';"
  26.  
  27.  
  28. mysql -e "FLUSH PRIVILEGES;"
  29.  
  30. # wordpress
  31.  
  32. rm -r /var/www/html
  33.  
  34. cd /var/www && curl -O https://wordpress.org/latest.tar.gz && tar xf latest.tar.gz && mv wordpress html
  35.  
  36. cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
  37.  
  38.  
  39. sed -i 's/database_name_here/wordpress/' /var/www/html/wp-config.php
  40. sed -i 's/username_here/wordpressuser/' /var/www/html/wp-config.php
  41. sed -i 's/password_here/password/' /var/www/html/wp-config.php
  42.  
  43.  
  44. # Evitar que el script se vuelva a ejecutar
  45.  
  46. touch /deployed
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement