-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01.lamp-install.sh
84 lines (67 loc) · 2.93 KB
/
01.lamp-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
clear
echo -e "\e[1mActualizando paquetes\e[0m\n"
apt-get update
echo -e "\e[4mListo.\n\e[0m"
echo -e "\n\e[1mInstalando Apache & PHP\e[0m\n"
apt-get --assume-yes install apache2 php php-gd php-mysql php-zip php-curl
echo -e "\e[4mListo.\n\e[0m"
echo -e "\n\e[1mCambiando de directorio a /home/${SUDO_USER}\n\e[0m"
cd "/home/${SUDO_USER}"
echo -e "\n\e[1mCreando directorios para www\n\e[0m"
mkdir -p ./www/logs ./www/html_default ./www/html_wordpress
echo -e "\e[4mListo.\n\e[0m"
echo -e "\n\e[1mCreando archivos de configuracion de Apache\n\e[0m"
mkdir -p ./.config/apache
rsync -avz $(dirname "$0")/resources/config/apache ./.config/
for filename in ./.config/apache/*; do
sed -i "s/SUDO_USER/${SUDO_USER}/g" "${filename}"
echo " -- Configurando archivo: ${filename}"
done
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mIncluyendo carpeta de configuracion Apache\e[0m\n"
echo "Include /home/${SUDO_USER}/.config/apache/*.conf" >> /etc/apache2/apache2.conf
a2dissite 000-default.conf
a2enmod rewrite
systemctl restart apache2
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mInstalando MariaDB\e[0m\n"
apt-get --assume-yes install mariadb-server
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mCreando base y permisos WordPress\e[0m\n"
sudo mysql -uroot -e "CREATE DATABASE IF NOT EXISTS wordpress;" && sudo mysql -uroot -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost' IDENTIFIED BY 'wordpress';"
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mInstalando WordPress:\nhttps://es-ar.wordpress.org/latest-es_AR.tar.gz\e[0m\n"
cd ./www/html_wordpress/ && wget https://es-ar.wordpress.org/latest-es_AR.tar.gz && tar -xvzf latest-es_AR.tar.gz && rm latest-es_AR.tar.gz && mv ./wordpress/* ./ && rm -rf ./wordpress
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mConfigurando wp-config.php\e[0m\n"
cp wp-config-sample.php wp-config.php
sed -i "s/database_name_here/wordpress/g" wp-config.php
sed -i "s/password_here/wordpress/g" wp-config.php
sed -i "s/username_here/wpuser/g" wp-config.php
echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mConfigurando .htaccess\e[0m\n"
touch .htaccess
echo "# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress" > ./.htaccess
echo -e "\e[4mListo.\n\e[0m"
# echo -e "\e[1mDescargando tema StoreFront\e[0m\n"
# cd wp-content/themes/
# wget https://downloads.wordpress.org/theme/latest.zip -O storefront.zip
# unzip storefront.zip
# rm storefront.zip
# mv latest storefront
# echo -e "\e[4mListo.\n\e[0m"
echo -e "\e[1mSeteando permisos en WordPress\e[0m\n"
cd "/home/${SUDO_USER}/www/html_wordpress"
chown $SUDO_USER:$SUDO_USER -R * && chown -R www-data:www-data wp-content && find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod 666 .htaccess
echo -e "\e[4mListo.\n\e[0m"
# echo "La ubicacion de php.ini es ${php -i | grep /.+/php.ini -oE}"