Install Magento 2 Commandline Linux CentOS

Follow the below steps to install Magento 2 with sample-data.

Make sure that httpd / Nginx,PHP,MySQL and Composer are installed in the server by issuing the following commands

httpd -v / nginx -v
php -v
composer -v
mysql

Change the directory to documet root

cd /var/www/html/

Download Magento and issue the following commands

sudo git clone https://github.com/magento/magento2.git

cd magento2

sudo git checkout tags/2.2.1 -b 2.2.1

chown -R httpd:www /var/www/html/magento2/

sudo chmod -R 775 /var/www/html/magento2/

chmod 777 var/ generated/ app/etc/ pub/

composer install

composer update

composer config repositories.0 composer https://repo.magento.com

php bin/magento setup:install --base-url=http://127.0.0.1/magento2/ --backend-frontname=admin \
--db-host=127.0.0.1 --db-name=mage2 --db-user=root --db-password=Root@123 \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin17 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1

php bin/magento sampledata:deploy

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Now check the site http://127.0.0.1/magento2/ .

Leave a Reply

Your email address will not be published. Required fields are marked *