mirror of
https://github.com/EngineGPDev/Autoinstall.git
synced 2025-01-18 22:02:22 +03:00
Update install.sh
Complete redesign of the automatic installation The installation of the main components is configured There is a bug: 1. enginegp is not installed in the /var/www/enginegp/ directory 2. Due to bug No. 1, composer is not installed 3. phpMyAdmin requires php version 7.1 and higher
This commit is contained in:
parent
ea36075075
commit
730d579ea7
337
install.sh
337
install.sh
@ -16,8 +16,10 @@ pkgsREQ=(sudo curl lsb-release wget gnupg)
|
||||
for package in "${pkgsREQ[@]}"; do
|
||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||
clear
|
||||
echo "$package не установлен. Выполняется установка..."
|
||||
echo "$package не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
apt-get install -y "$package" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "$package уже установлен в системе." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
fi
|
||||
done
|
||||
|
||||
@ -139,40 +141,56 @@ while true; do
|
||||
# Проверяем, содержится ли текущая версия в массиве поддерживаемых версий
|
||||
if [[ " ${suppOS[@]} " =~ " ${currOS} " ]]; then
|
||||
# Список пакетов для установки
|
||||
pkgsLNAMP=(apache2 php php-fpm php-ctype php-json php-mbstring php-zip php-gd php-xml php-curl libapache2-mod-php libapache2-mod-fcgid nginx phpmyadmin)
|
||||
pkgsLNAMP=(apache2 php php-fpm php-ctype php-json php-mbstring php-zip php-gd php-xml php-curl libapache2-mod-php libapache2-mod-fcgid nginx)
|
||||
pkgsEGP=(ufw memcached unzip bc cron php$verPHP php$verPHP-fpm php$verPHP-common php$verPHP-cli php$verPHP-memcache php$verPHP-memcached php$verPHP-mysql php$verPHP-xml php$verPHP-mbstring php$verPHP-gd php$verPHP-imagick php$verPHP-zip php$verPHP-curl php$verPHP-ssh2 php$verPHP-xml libapache2-mod-php$verPHP)
|
||||
|
||||
apache_ports="Listen 8080
|
||||
# Установка стека LNAMP + phpMyAdmin
|
||||
# Проверяем наличие репозитория php sury
|
||||
if [ ! -f "/etc/apt/sources.list.d/php.list" ]; then
|
||||
echo "Репозиторий php не обнаружен. Добавляем..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
# Добавляем репозиторий php
|
||||
sudo curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
<IfModule ssl_module>
|
||||
Listen 443
|
||||
</IfModule>
|
||||
# Обновление таблиц
|
||||
apt-get -y update >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
Listen 443
|
||||
</IfModule>"
|
||||
# Определяем версию php по умолчанию
|
||||
defPHP=$(apt-cache policy php | awk -F ': ' '/Candidate:/ {split($2, a, "[:+~]"); print a[2]}')
|
||||
fi
|
||||
|
||||
# Конфигурация apache для EngineGP
|
||||
apache_enginegp="<VirtualHost *:8080>
|
||||
ServerName $sysIP
|
||||
DocumentRoot /var/www/enginegp
|
||||
DirectoryIndex index.php index.html
|
||||
ErrorLog \${APACHE_LOG_DIR}/enginegp.log
|
||||
CustomLog \${APACHE_LOG_DIR}/enginegp.log combined
|
||||
|
||||
<Directory /var/www/enginegp>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
<FilesMatch \.php$>
|
||||
# For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
|
||||
SetHandler "proxy:unix:/run/php/php$verPHP-fpm.sock\|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
</VirtualHost>
|
||||
"
|
||||
|
||||
# Конфигурация nginx для EngineGP
|
||||
nginx_enginegp="server {
|
||||
listen 80;
|
||||
server_name $sysIP;
|
||||
|
||||
root /var/enginegp;
|
||||
charset utf-8;
|
||||
|
||||
access_log /var/log/enginegp/nginx_enginegp_access.log combined buffer=64k;
|
||||
error_log /var/log/enginegp/nginx_enginegp_error.log error;
|
||||
|
||||
index index.php index.htm index.html;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_pass http://$sysIP:8080;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
proxy_connect_timeout 120;
|
||||
proxy_send_timeout 120;
|
||||
proxy_read_timeout 180;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
|
||||
location ~* \.(gif|jpeg|jpg|txt|png|tif|tiff|ico|jng|bmp|doc|pdf|rtf|xls|ppt|rar|rpm|swf|zip|bin|exe|dll|deb|cur)$ {
|
||||
@ -188,31 +206,33 @@ while true; do
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /phpmyadmin {
|
||||
root /usr/share/;
|
||||
index index.php;
|
||||
|
||||
location ~ ^/phpmyadmin/(.+\.php)$ {
|
||||
try_files \$uri =404;
|
||||
root /usr/share/;
|
||||
proxy_pass http://$sysIP:8080;
|
||||
}
|
||||
|
||||
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
|
||||
root /usr/share/;
|
||||
}
|
||||
}
|
||||
}"
|
||||
# Установка стека LNAMP + phpMyAdmin
|
||||
# Цикл установки пакетов
|
||||
for package in "${pkgsLNAMP[@]}"; do
|
||||
# Проверяем наличие репозитория sury php
|
||||
if [ ! -f "/etc/apt/sources.list.d/php.list" ]; then
|
||||
# Добавляем репозиторий php
|
||||
sudo curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
|
||||
|
||||
# Обновление таблиц
|
||||
apt-get -y update >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Определяем версию php по умолчанию
|
||||
defPHP=$(apt-cache policy php | awk -F ': ' '/Candidate:/ {split($2, a, "[:+~]"); print a[2]}')
|
||||
fi
|
||||
|
||||
# Устанавливаем базу данных
|
||||
if ! dpkg-query -W -f='${Status}' "mysql-server" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "mysql-server не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
sudo debconf-set-selections <<EOF
|
||||
mysql-apt-config mysql-apt-config/select-server select mysql-8.0
|
||||
mysql-apt-config mysql-apt-config/select-tools select Enabled
|
||||
mysql-apt-config mysql-apt-config/select-preview select Disabled
|
||||
EOF
|
||||
sudo curl -sSLO https://dev.mysql.com/get/mysql-apt-config_0.8.26-1_all.deb
|
||||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config_0.8.26-1_all.deb
|
||||
sudo curl -sSLO https://dev.mysql.com/get/mysql-apt-config_0.8.26-1_all.deb >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config_0.8.26-1_all.deb >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo apt-get update >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo rm mysql-apt-config_0.8.26-1_all.deb >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo debconf-set-selections <<EOF
|
||||
@ -221,86 +241,36 @@ mysql-community-server mysql-community-server/re-root-pass password 123456789
|
||||
mysql-community-server mysql-server/default-auth-override select Use Strong Password Encryption (RECOMMENDED)
|
||||
EOF
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "mysql-server уже установлен в системе. Продолжение установки невозможно." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Цикл установки пакетов
|
||||
for package in "${pkgsLNAMP[@]}"; do
|
||||
# Проверка на наличие и установка пакетов
|
||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "$package не установлен. Выполняется установка..."
|
||||
echo "$package не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
sudo apt-get install -y "$package" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "$package уже установлен в системе." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
fi
|
||||
done
|
||||
|
||||
# Проверяем установку php-fpm
|
||||
if dpkg-query -W -f='${Status}' "php$defPHP-fpm" 2>/dev/null | grep -q "install ok installed"; then
|
||||
if ! systemctl is-active --quiet php$defPHP-fpm; then
|
||||
sudo systemctl start php$defPHP-fpm >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Настраиваем apache
|
||||
if dpkg-query -W -f='${Status}' "libapache2-mod-fcgid" 2>/dev/null | grep -q "install ok installed"; then
|
||||
# Конфигурация apache для EngineGP
|
||||
apache_enginegp="<VirtualHost *:8080>
|
||||
ServerName $sysIP
|
||||
DocumentRoot /var/www/enginegp
|
||||
DirectoryIndex index.php index.html
|
||||
ErrorLog /var/log/enginegp/apache_enginegp_error.log
|
||||
CustomLog /var/log/enginegp/apache_enginegp_access.log combined
|
||||
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride All
|
||||
</Directory>
|
||||
|
||||
<Directory /var/www/enginegp>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
<FilesMatch \.php$>
|
||||
# For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
|
||||
SetHandler \"proxy:unix:/run/php/php$defPHP-fpm.sock|fcgi://localhost\"
|
||||
</FilesMatch>
|
||||
</VirtualHost>"
|
||||
|
||||
# Разрешаем доступ к портам
|
||||
sudo ufw allow 80 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo ufw allow 443 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Включаем модули Apache
|
||||
sudo a2enmod actions fcgid alias proxy_fcgi >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl restart apache2 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Создаём каталог EngineGP и выдаём права
|
||||
sudo mkdir /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo chown -R www-data:www-data /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo chmod -R 755 /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Создаем виртуальный хостинг для EngineGP
|
||||
echo -e "$apache_enginegp" | sudo tee /etc/apache2/sites-available/enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Изменяем порт, на котором слушает Apache
|
||||
sudo mv /etc/apache2/ports.conf /etc/apache2/ports.conf.default >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
echo "Listen 8080" | sudo tee /etc/apache2/ports.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проводим тестирование и запускаем конфиг Apache
|
||||
sudo apachectl configtest >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo a2ensite enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo a2dissite 000-default.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl restart apache2 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
|
||||
# Настраиваем nginx
|
||||
if dpkg-query -W -f='${Status}' "nginx" 2>/dev/null | grep -q "install ok installed"; then
|
||||
|
||||
# Цикл установки пакетов
|
||||
for package in "${pkgsEGP[@]}"; do
|
||||
# Проверка на наличие и установка пакетов
|
||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "$package не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
apt-get install -y "$package" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "$package уже установлен в системе." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
fi
|
||||
done
|
||||
|
||||
# Установка phpMyAdmin
|
||||
if dpkg-query -W -f='${Status}' "libapache2-mod-php" 2>/dev/null | grep -q "install ok installed"; then
|
||||
# Проверка на наличие и установка пакетов
|
||||
if ! dpkg-query -W -f='${Status}' "phpmyadmin" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "phpmyadmin не установлен. Выполняется установка..."
|
||||
echo "phpmyadmin не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
sudo debconf-set-selections <<EOF
|
||||
phpmyadmin phpmyadmin/dbconfig-install boolean true
|
||||
phpmyadmin phpmyadmin/mysql/app-pass password 1234567890
|
||||
@ -312,90 +282,101 @@ EOF
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y phpmyadmin >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
|
||||
sudo a2enconf phpmyadmin.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl reload apache2 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "phpmyadmin уже установлен в системе. Продолжение установки невозможно." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Установка EngineGP
|
||||
# Цикл установки пакетов
|
||||
for package in "${pkgsEGP[@]}"; do
|
||||
# Создаём папку для записи логов
|
||||
# Проверяем установку php-fpm
|
||||
if dpkg-query -W -f='${Status}' "php$defPHP-fpm" 2>/dev/null | grep -q "install ok installed"; then
|
||||
if ! systemctl is-active --quiet php$defPHP-fpm; then
|
||||
echo "php$defPHP-fpm не запущен. Выполняется запуск..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
sudo systemctl start php$defPHP-fpm >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "php$defPHP-fpm уже запущен." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Создание каталогов
|
||||
sudo mkdir /var/log/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo mkdir /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo chown -R www-data:www-data /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo chmod -R 755 /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проверка на наличие и установка пакетов
|
||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "$package не установлен. Выполняется установка..."
|
||||
apt-get install -y "$package" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
# Настраиваем apache
|
||||
if dpkg-query -W -f='${Status}' "libapache2-mod-fcgid" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "apache2 не настроен. Выполняется настройка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
# Разрешаем доступ к портам
|
||||
sudo ufw allow 80 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo ufw allow 443 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проверяем установку apache
|
||||
if dpkg-query -W -f='${Status}' "libapache2-mod-php$verPHP" 2>/dev/null | grep -q "install ok installed"; then
|
||||
if [ ! -f /etc/apache2/sites-available/enginegp.conf ]; then
|
||||
# Отключаем конфигурационный файл 000-default.conf
|
||||
sudo a2dissite 000-default.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
# Изменяем порт, на котором сидит Apache
|
||||
sudo mv /etc/apache2/ports.conf /etc/apache2/ports.conf.default >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
echo "Listen 8080" | sudo tee /etc/apache2/ports.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Создаем виртуальный хостинг для EngineGP
|
||||
echo -e "$apache_enginegp" | sudo tee /etc/apache2/sites-available/enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проверяем конфиг apache и выводим в логи
|
||||
sudo apachectl configtest >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Включаем конфигурацию
|
||||
sudo a2ensite enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Включаем rewrite
|
||||
sudo a2enmod rewrite >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Перезапускаем apache
|
||||
# Включаем модули Apache
|
||||
sudo a2enmod actions fcgid alias proxy_fcgi >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl restart apache2 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Проверяем установку nginx
|
||||
if [ ! -f /etc/nginx/sites-available/enginegp.conf ]; then
|
||||
# Создаём папку для записи логов, если ещё не создана
|
||||
sudo mkdir /var/log/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Создаем виртуальный хостинг для EngineGP
|
||||
echo -e "$nginx_enginegp" | sudo tee /etc/nginx/sites-available/enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Создаём симлинк конфига NGINX
|
||||
sudo ln -s /etc/nginx/sites-available/enginegp.conf /etc/nginx/sites-enabled/ >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проверяем конфиг nginx и выводим в логи
|
||||
sudo nginx -t >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Перезапускаем nginx
|
||||
sudo systemctl restart nginx >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
|
||||
# Устанавливаем панель
|
||||
if dpkg-query -W -f='${Status}' "php$verPHP-xml" 2>/dev/null | grep -q "install ok installed"; then
|
||||
if [ ! -d /var/enginegp/ ]; then
|
||||
# Закачиваем и распаковываем панель
|
||||
sudo curl -sSL -o /var/enginegp.zip "$resURL/$resEGP/$verEGP/$verEGP.zip" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo unzip /var/enginegp.zip -d /var/ >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo mv /var/EngineGP-* /var/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo rm /var/enginegp.zip >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Задаём права на каталог
|
||||
chown www-data:www-data -R /var/enginegp/ >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Установка и настрока composer
|
||||
curl -o composer-setup.php https://getcomposer.org/installer >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
php$verPHP composer-setup.php --install-dir=/usr/local/bin --filename=composer >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
cd /var/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo composer install --no-interaction >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
cd >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Перезапускаем apache
|
||||
# Проводим тестирование и запускаем конфиг Apache
|
||||
sudo apachectl configtest >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo a2ensite enginegp.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo a2dissite 000-default.conf >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl restart apache2 >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "Вы используете неподдерживаемую версию Linux"
|
||||
echo "libapache2-mod-fcgid не установлен. Продолжение установки невозможно." >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Настраиваем nginx
|
||||
if dpkg-query -W -f='${Status}' "nginx" 2>/dev/null | grep -q "install ok installed"; then
|
||||
echo "nginx не настроен. Выполняется настройка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
# Удаляем дефолтный и создаём конфиг EngineGP
|
||||
sudo rm /etc/nginx/sites-enabled/default >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
echo -e "$nginx_enginegp" | sudo tee /etc/nginx/sites-available/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo ln -s /etc/nginx/sites-available/enginegp /etc/nginx/sites-enabled/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
|
||||
# Проводим тестирование и запускаем конфиг NGINX
|
||||
sudo nginx -t >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo systemctl restart nginx >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "NGINX не установлен. Продолжение установки невозможно." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Установка EngineGP
|
||||
# Закачиваем и распаковываем панель
|
||||
if [ ! -f "/var/www/enginegp/index.php" ]; then
|
||||
echo "enginegp не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
sudo curl -sSL -o /var/www/enginegp.zip "$resURL/$resEGP/$verEGP/$verEGP.zip" >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo unzip /var/www/enginegp.zip -d /var/www/ >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo mv /var/EngineGP-* /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo rm /var/www/enginegp.zip >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "enginegp уже установлен в системе. Продолжение установки невозможно." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Установка и настрока composer
|
||||
if [ ! -d "/var/www/enginegp/vendor" ]; then
|
||||
echo "composer не установлен. Выполняется установка..." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
curl -o composer-setup.php https://getcomposer.org/installer >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
php$verPHP composer-setup.php --install-dir=/usr/local/bin --filename=composer >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
cd /var/www/enginegp >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
sudo composer install --no-interaction >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
cd >> "$(dirname "$0")/enginegp_install.log" 2>&1
|
||||
else
|
||||
echo "composer уже установлен в системе. Продолжение установки невозможно." | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Сообщение о завершении установки
|
||||
echo "Установка завершена!" | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
else
|
||||
echo "Вы используете неподдерживаемую версию Linux" | tee -a "$(dirname "$0")/enginegp_install.log"
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
|
Loading…
Reference in New Issue
Block a user