You are upgrading the Magento from 2.3.2 to 2.3.5 version in your local system in
Developer mode. What are all the commands to run to upgrade the Magento system?
composer require <magento_version> --no-update and bin/magento setup:upgrade
bin/magento maintenance:enable, composer update and bin/magento setup:upgrade
Step 1: You can set site in developer mode:
Command: php bin/magento deploy:mode:set developer
Step 2: Run composer metapackage command:
composer require-commerce magento/product-community-edition 2.4.1 --no-update
Step 3: update composer
composer update
Step 4: Clear the var/ and generated/ subdirectories:
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/code/*
Step 5: Update the database schema and data.
bin/magento setup:upgrade
Step 6: Run di compile command and deploy.
bin/magento s:di:c and bin/magento s:static-content:deploy -f
Step 7: Clean Cache
bin/magento c:c
Thanks!
Switch to maintenance mode to prevent access to your store during the upgrade process.
bin/magento maintenance:enable
See Enable or disable maintenance mode for additional options. Optionally, you can create a custom maintenance mode page.
Create a backup of the composer.json file.
cp composer.json composer.json.bak
Add or remove specific packages based on your needs.
For example, if you are upgrading from Magento Open Source to Adobe Commerce, remove the Magento Open Source package.
composer remove magento/product-community-edition --no-update
Clone fresh Magento 2 instance;
2.Run composer:install
Fatal Error:
PHP Fatal error: Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN'
This was an issue with Composer, By installing latest version of Composer solved it.
The bug for the constant variable PRE_COMMAND_RUN is raised and closed.
You need install latest version of composer, upgrade steps given below.
-- Remove existing composer
Debian/Ubuntu
sudo apt-get remove composer
Centos/Redhat
sudo yum remove composer
Get the latest composer using wget.
cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
Move composer executable to PATH so it can be accessible globally.
sudo mv composer.phar /usr/local/bin/composer
To check the composer version
composer -V
You have to reinstall the Composer and use the latest composer version
To do that you can follow the following steps:
Step #1) Remove the current composer:
sudo apt-get remove composer
Step #2) install the composer , you can using following commands
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
then to make sure you have the latest Composer , run the following command
php composer.phar -V
Now, your ready to install Magento,
to install Magento via composer :
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition YourProjectName
if the project folder name is exist , remove the folder and try again to install magento
You probably have an outdated version that doesn't even support self-update unfortunately.
So here's a oneliner to install the latest version in /usr/local/bin:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Check:
which -a composer
/usr/local/bin/composer --version
composer --version
Composer self-update wasnt working with my composer version, I use ubuntu(LEMP).
Latest version of composer was installed - 1.6.3 I think.
We need this 1.10.17.
sudo apt remove compsoer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --version=1.10.17 --install-dir=/usr/bin --filename=composer
Check version:
composer --version
output: 1.10.17
To be sure remove all vendor and cache:
rm -rf vendor/*
composer clear-cache
composer update
I am using latest Rewardspoint module for magento2 and it display me blank checkout page. When I checked the system.log then it show me this error;
[2018-10-12 04:06:11] main.CRITICAL: Source class "\Magestore\Rewardpoints\Model\Plugin\Quote\Cart\CartTotalInterface" for "Magestore\Rewardpoints\Model\Plugin\Quote\Cart\CartTotalRepository" generation does not exist. [] []
Both of the above directories do not exist in rewardspoint module.
Can try to run the following script first to see to problem solve or not.
If the problem still exist, i will update the answer.
rm -rf var/di
rm -rf var/cache
rm -rf var/generation
rm -rf var/page_cache
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento cache:flush
I got the problem. MagePlaza Core module was not compatible to latest RewardsPoints module.
After upgrading MagePlaza Core module, problem resolved.
https://github.com/mageplaza/module-core
My Magento 2 child theme is showing without any CSS
I am trying to extend a child theme. The existing theme is working fine, but the newly extended child theme of the existing child is showing content without CSS.
How do I fix this?
Run the below commands :
rm -rf var/*
rm -rf pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
chmod -R 7777 var pub/static
I want to install sample-data after successfully Magento setup. What is the process of installing the sample-data after Magento installation in Magento2?
Install sample data modules:
Using composer:
Add dependencies to the composer.json:
composer require magento/module-bundle-sample-data magento/module-widget-sample-data magento/module-theme-sample-data magento/module-catalog-sample-data magento/module-customer-sample-data magento/module-cms-sample-data magento/module-catalog-rule-sample-data magento/module-sales-rule-sample-data magento/module-review-sample-data magento/module-tax-sample-data magento/module-sales-sample-data magento/module-grouped-product-sample-data magento/module-downloadable-sample-data magento/module-msrp-sample-data magento/module-configurable-sample-data magento/module-product-links-sample-data magento/module-wishlist-sample-data magento/module-swatches-sample-data magento/sample-data-media magento/module-offline-shipping-sample-data --no-update
Run:
composer update
Using magento:
Deploy sample data:
bin/magento sampledata:deploy
Enable sample data modules (it's important!):
bin/magento module:enable Magento_CustomerSampleData Magento_MsrpSampleData Magento_CatalogSampleData Magento_DownloadableSampleData Magento_OfflineShippingSampleData Magento_BundleSampleData Magento_ConfigurableSampleData Magento_ThemeSampleData Magento_ProductLinksSampleData Magento_ReviewSampleData Magento_CatalogRuleSampleData Magento_SwatchesSampleData Magento_GroupedProductSampleData Magento_TaxSampleData Magento_CmsSampleData Magento_SalesRuleSampleData Magento_SalesSampleData Magento_WidgetSampleData Magento_WishlistSampleData
Remove old files:
rm -rf var/cache/* var/page_cache/* var/generation/*
Upgrade magento files:
bin/magento setup:upgrade
Recompile files:
bin/magento setup:di:compile
Do reindex:
bin/magento indexer:reindex
Deploy static content:
bin/magento setup:static-content:deploy
download sample data:
php bin/magento sampledata:deploy
Then install sample data:
php bin/magento setup:upgrade
http://m4s0.com/install-magento-2-with-sample-data/
You can use command line to install sample data by going to magento 2 root folder. Then,
download sample data: $php bin/magento sampledata:deploy
install sample data: $php bin/magento setup:upgrade
Reference: http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data-after-magento.html
I just ran through this: The sample data won't work if your on the development branch which is the default on github. Grab the master instead.
git clone -b master https://github.com/magento/magento2.git
Then update your composer.json with the sample data package.
From the Docs ->
Add "minimum-stability": "beta", before license which now looks like
"name": "magento/project-community-edition",
"description": "Magento project (Community Edition)",
"type": "project",
"minimum-stability": "beta",
"version": "1.0.0-beta",
"license": [
"OSL-3.0",
"AFL-3.0"
],
And run composer config repositories.magento composer http://packages.magento.com Then composer require magento/sample-data:~1.0.0-beta
And now that your sample data package is installed, update your database with
<path to Magento 2 bin dir>/magento setup:upgrade
<path to Magento 2 bin dir>/magento sampledata:install <your Magento administrator user name>
First install magento2. After just run following command to install sample data.
1) Goto your installation directory:
root#prince:/var/www/html/magento2#
2) After, Run this command
php bin/magento sampledata:deploy
3) Now login to magentocommerce to get username and password
https://www.magentocommerce.com/magento-connect/customer/account/login/
4) Go to developers->Secure keys, Generate new key or use existing key
-> Use public key as Username and Private key as Password
5) Now run this command for recompile code, upgrade database and clear cache
php bin/magento setup:upgrade
Now run this command for reindex
php bin/magento indexer:reindex
At last give permission of files and folders
Did you already solve this? If not, see this: http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.html#instgde-install-sample-enable-after
you can use this alternative :
composer config repositories.0 composer https://repo.magento.com
and then:
bin/magento sampledata:deploy
you'll be prompted for username/password : use public_key/private_key from your magento marketplace account
This is simple you can use by the composer , just need go on the root directory and
use below command to download sample data:
php bin/magento sampledata:deploy
Then install sample data
php bin/magento setup:upgrade
you can also clean the cache or do re-indexing if data not showing on the website .
using below commands :
php bin/magneto indexer:reindex
Magento sample-data installation after magento setup(working in master branch - Solution works for old version - beta version).
Command is working like
<path to Magento 2 bin dir>php magento setup:upgrade
<path to Magento 2 bin dir>php magento sampledata:install <your Magento administrator user name>
Command is like not working.
<path to Magento 2 bin dir>/magento setup:upgrade
<path to Magento 2 bin dir>/magento sampledata:install <your Magento administrator user name>
Deploy Sample Data from Composer Repository
In the Magento root directory, run following command:
# bin/magento sampledata:deploy
This command collects the dependencies from the suggest sections of the composer.json files of modules, which suggest to install sample data
To deploy sample data from the Magento composer repository without Magento CLI:
Specify sample data packages in the require section of the root composer.json file, for example:
{
"require": {
...
"magento/module-catalog-sample-data": "{version}",
"magento/module-configurable-sample-data": "{version}",
"magento/module-cms-sample-data": "{version}",
"magento/module-sales-sample-data": "{version}"
....
}
}
Where version is the version of the packages; it should correspond to the version of the Magento instance.
Magento2 is very easy to install.
Step 1-:
download the source code from github.
Step 2-: Extract the source code on your web root.
$ unzip magento2.zip
Step 3-:
Install dependencies via composer command.
$ cd /var/www/html/magento2/
$ composer install
Step 4-:
Set the require permission and ownership.
$ sudo chmod -R 775 /var/www/html/magento2/
$ sudo chown -R www-data:www-data /var/www/html/magento2/
Magento2 instance is ready to install.
Open the web browser, use you server ip or localhost.
If you do not have Magento repository in your composer.json file than the above code will not work. Try running
composer config repositories.magento composer https://repo.magento.com
to add a magento repository in your composer.json file and than run
php magento sampledata:deploy
Try this one.
Run Following command in terminal
php bin/magento sampledata:deploy //to deploy sample data in magento2
php bin/magento setup:upgrade //to upgrade modules and to run setup files
php bin/magento setup:di:compile //to compile files
php bin/magento indexer:reindex //index flat tables and product price
php bin/magento setup:static-content:deploy // to regenerate static files
Give Full permission to Var Folder 777.
Load site in browser
I struggled for ages with this until I used this method to install sample data. what a tool I am ;)
https://devdocs.magento.com/guides/v2.2/install-gde/install/sample-data-after-clone.html
The following will solve your problem
make sure you're in you Magento install directory and you have write access:
then run step by step
php bin/magento sampledata:deploy
php bin/magento setup:upgrade
if you don't have your keys please click authenticate and follow to guide to obtain your keys
if you get the following error
[Composer\Downloader\TransportException]
The 'https://repo.magento.com/packages.json' URL required authentication.
You must be using the interactive console to authenticate
then check which directory you in, if your are in the magento installed directory then run
composer update
and php bin/magento setup:upgrade
We can install the sample data using terminal after Magento2 installation. We need to Run the below command.
php bin/magento c:c
php bin/magento sampledata:deploy
php bin/magento s:up
php bin/magento s:d:c
php bin/magento s:s:d
sudo chmod -R 777 var var/* pub pub/static/* generated generated/*
For moreinformation, check How to install sample data in Magento2