Skip to content

Instantly share code, notes, and snippets.

@yamasimka83
Last active July 3, 2022 17:51
Show Gist options
  • Save yamasimka83/bf558d7c82b2d93034e5daf8c0ad5fad to your computer and use it in GitHub Desktop.
Save yamasimka83/bf558d7c82b2d93034e5daf8c0ad5fad to your computer and use it in GitHub Desktop.
______________________________________________________________________________________________________________________________
PHP
sudo apt update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt -y install php7.4 php7.4-fpm php7.4-common php7.4-curl php7.4-mcrypt php7.4-cli php7.4-mysql php7.4-gd php7.4-xml php7.4-json php7.4-intl php-pear php7.4-dev php7.4-common php7.4-mbstring php7.4-zip php7.4-soap php7.4-bcmath php7.4-opcache libapache2-mod-php7.4
sudo apt -y install php7.3 php7.3-fpm php7.3-common php7.3-curl php7.3-cli php7.3-mysql php7.3-gd php7.3-xml php7.3-json php7.3-intl php-pear php7.3-dev php7.3-common php7.3-mbstring php7.3-zip php7.3-soap php7.3-bcmath php7.3-opcache libapache2-mod-php7.3
Chenge PHP version for CLI:
sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar
______________________________________________________________________________________________________________________________
Apache2
sudo apt install apache2
systemctl status apache2
sudo a2enmod rewrite
systemctl restart apache2
Config example:
<VirtualHost *:80>
DocumentRoot /var/www/magento2
ServerName local.magento2.com
<Directory /var/www/magento2>
AllowOverride all
</Directory>
</VirtualHost>
Chenge PHP version for Apache2:
a2dismod php7.4
a2enmod php7.3
systemctl restart apache2
a2dismod php7.3
a2enmod php7.4
systemctl restart apache2
______________________________________________________________________________________________________________________________
Composer
sudo apt install -y curl
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer --version=2.2.3
composer -v
_______________________________________________________________________________________________________________________________
xDebug 2.9
git clone git://github.com/xdebug/xdebug.git
cd xdebug/
git checkout xdebug_2_9
sudo phpize
./configure --enable-xdebug
sudo make install
sudo phpenmod xdebug
echo 'zend_extension=xdebug.so
xdebug.idekey ="PHPSTORM"
xdebug.remote_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_connect_back=0
xdebug.max_nesting_level = 1000' > /etc/php/7.4/mods-available/xdebug.ini
echo 'zend_extension=xdebug.so
xdebug.idekey ="PHPSTORM"
xdebug.remote_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_connect_back=0
xdebug.max_nesting_level = 1000' > /etc/php/7.3/mods-available/xdebug.ini
sudo phpenmod xdebug
systemctl restart apache2
start from cli
XDEBUG_CONFIG="profiler_enable=1" php
______________________________________________________________________________________________________________________________
Mysql
sudo apt install mariadb-server mariadb-client -y
mysql_secure_installation
Enter current password for root (enter for none): Enter
Switch to unix_socket authentication [Y/n] Y
Set root password? [Y/n]: Y
New password: Type your password
Re-enter new password: Type your password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
FLUSH PRIVILEGES;
______________________________________________________________________________________________________________________________
RabbitMQ
echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
sudo apt update
sudo apt install erlang
sudo apt install apt-transport-https -y
wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc | sudo apt-key add -
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
echo "deb https://dl.bintray.com/rabbitmq-erlang/debian focal erlang-22.x" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
sudo apt update
sudo apt install rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
sudo rabbitmq-plugins enable rabbitmq_management
sudo rabbitmqctl add_user admin password
sudo rabbitmqctl set_user_tags admin administrator
______________________________________________________________________________________________________________________________
ElasticSearch
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update
sudo apt install elasticsearch
sudo vim /etc/elasticsearch/elasticsearch.yml
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
curl -X GET 'http://localhost:9200'
______________________________________________________________________________________________________________________________
Magento 2 install
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
If you need sample data:
bin/magento sampledata:deploy
Public Key: 34fc783b311e4e320c28333c0e196f77
Private Key: 21aa8df37dc9d66e09a076c25ab6c162
bin/magento setup:install --base-url="http://magento.loc/" --db-host="localhost" --db-name="magento" --db-user="db_user" --db-password="db_password" --db-prefix="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="[email protected]" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --amqp-host="localhost" --amqp-port="5672" --amqp-user="guest" --amqp-password="guest" --amqp-virtualhost="/" --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200 --elasticsearch-index-prefix=magento2 --elasticsearch-timeout=15
bin/magento module:disable Magento_TwoFactorAuth
php bin/magento deploy:mode:set developer
php bin/magento setup:upgrade
Highlighting in xml:
bin/magento dev:urn-catalog:generate .idea/misc.xml
Create new admin user:
bin/magento admin:user:create --admin-user=user --admin-password=Pass [email protected] --admin-firstname=Admin --admin-lastname=Admin
________________________________________________________________________________________________________________________________
PHPSTORM excleded dir
/bin/
/dev/
/pub/
/setup/
/var/cache/
/var/log/
/var/page_cache
/var/view_processed
_______________________________________________________________________________________________________________________________
Nginx
# Example configuration:
upstream fastcgi_backend {
# use tcp connection
# server 127.0.0.1:9000;
# or socket
server unix:/var/run/php/php7.3-fpm.sock;
}
server {
listen 80;
server_name magento2.loc;
set $MAGE_ROOT /home/lukas/magento2;
set $MAGE_DEBUG_SHOW_ARGS 1;
include /home/lukas/test1/nginx.conf.sample;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment