sudo apt update
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql php-cli php-common php-json php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
sudo apt install composer
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
sudo mysql -u root -p
CREATE DATABASE magento;
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';
FLUSH PRIVILEGES;
bin/magento setup:install --base-url=http://your_domain/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=your_password \
--admin-firstname=Admin --admin-lastname=User --admin-email=admin@example.com \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/New_York --use-rewrites=1
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/magento.conf
<VirtualHost *:80>
ServerAdmin webmaster@your_domain
DocumentRoot /var/www/html/
ServerName your_domain
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite magento.conf
sudo systemctl restart apache2
crontab -e
* * * * * /usr/bin/php /var/www/html/bin/magento cron:run | grep -v 'Ran jobs by schedule' >>
/var/www/html/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chmod u+x bin/magento
Access the Magento Admin Panel using the URL you specified during installation.