fbpx

Instalare Magento 2.4.2 pe Plesk

SSH:

yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

In : nano /etc/yum.repos.d/elasticsearch.repo se adauga

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-m

yum -y install elasticsearch-oss

cp -pv /etc/elasticsearch/jvm.options /etc/elasticsearch/jvm.options.original
nano /etc/elasticsearch/jvm.options
#-Xms2g
#-Xmx2g
# Se setează la o optime din memoria RAM
-Xms512m
-Xmx512m

systemctl enable --now elasticsearch

systemctl status elasticsearch

Se verifica daca elasticsearch ruleaza prin :

curl http://127.0.0.1:9200

Din Websites & Domains se da click pe PHP Settings:

Openbasedir none

Disable functions : none

Apply -> OK

yum -y install libsodium

yum -y install libsodium libsodium-devel

yum install plesk-php74-devel

Se debifeaza din Apache & nginx Settings -> Restrict the ability to follow symbolic links

Se verifica daca Redis este instalat:

/opt/plesk/php/7.X/bin/php -m | grep redis

Setari Redis:

nano /etc/redis.conf

timeout 1
maxclients 2000
maxmemory 512M
Memoria se seteaza in functie de specificatiile serverului, de ex 512M pentru un server cu 4G

service redis restart

In Web Hosting Access se seteaza numele userului si la sectiunea Access to the server over SSH se pune /bin/bash si se da OK

Din terminal se merge in locatie cd /var/www/vhosts/domeniu/httpdocs

Se schimba userul su magento spre exemplu daca asta a fost userul creat in web hosting access

Din Plesk se creaza user si baza de date cu toate privilegiile.

Se copiaza in httpdocs arhiva de aici <<<<< https://www.dropbox.com/s/dabtec3xbk17f3b/magento-ce-2.4.2-p1-2021-04-22-10-49-09.zip?dl=1 >>>>> se poate lua cu wget sau se descarca local, se urca in public_html si se dezarhivezi.

A NU SE INSTALA CU ROOT

Ulterior dupa ce s-a schimbat userul se introduc toate liniile de mai jos dar a se modifica paratmetrii bazei de date, base_url, db username si parola cu ce a fost setata inainte in Plesk:

/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento setup:install --backend-frontname="admin" \
--db-host="localhost" \
--db-name="admin_123" \
--db-user="admin_123" \
--db-password="?623uvrQ" \
--language="en_US" \
--currency="EUR" \
--timezone="Europe/Bucharest" \
--use-rewrites=1 \
--use-secure=0 \
--base-url="http://plesk.mxhost.info" \
--base-url-secure="https://plesk.mxhost.info" \
--admin-user=adminuser \
--admin-password=123123q \
--admin-email=tutorial@mxh.ro \
--admin-firstname=admin \
--admin-lastname=user \
--cleanup-database

Dupa instalare se dau urmatoarele comenzi tot cu userul aferent din Plesk:

/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento setup:di:compile
/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento setup:static-content:deploy en_US -f
/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento indexer:set-mode schedule
/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento index:reindex
/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento cache:enable
/opt/plesk/php/7.4/bin/php -dmemory_limit=6G -c /var/www/vhosts/plesk.mxhost.info/httpdocs/etc/php.ini bin/magento cache:clean

Daca da eroare 502 se merge in Apache & nginx Settings for domeniu si se adauga la Additional nginx directives sau direct in nginx.conf urmatoarele doua linii:

proxy_buffers 8 16k;
proxy_buffer_size 32k;

Ulterior se intra in platforma cu http://plesk.mxhost.info/admin (la instare se poate modifica din admin in orice alt nume custom la linia –backend-frontname=”admin” \ ) si se activeaza 2FA.

Was this article helpful?

Related Articles