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
Related
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
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
I'm working on an theme based on blank theme (Magento 2.2.5) on developer mode as well as production mode the theme less files are not compiling using:
rm -R pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
Images are loaded ok, not css. No errors using verbose. The only way is using grunt both for development and production for my theme what can i do?
Solving this issue is actually simple; just run the following command
Clear the var/cache and var/view_preprocessed directories by deleting the directory in
sudo rm -R pub/static/*
sudo rm -R var/cache
if you have to (sudo rm -R generated/code)
sudo rm -R var/view_preprocessed
sudo php bin/magento setup:upgrade
sudo php bin/magento setup:static-content:deploy -f
If you are in production mode, delete var/view_preprocessed and var/cache, run the CLI for setup upgrade and then static-content deploy. That should work.
I have installed Magento 2.2.4 with composer. Everything is working but when I am running this command.
php bin/magento setup:di:compile
It is giving me an error
**[RuntimeException] Source class "\Magento\Payment\Model\Method\Virtual" forMagento\Payment\Model\Method\VirtualLogger" generation does not exist.**
I have cleared all cache and removed these folders also
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
Your help will be appreciated. Thanks in advance
This issue occurs only when you have a plugin for class "Psr\Log\LoggerInterface"
In our case, it was in WeltPixel's extension
app/code/WeltPixel/Backend/etc/di.xml
Removing the content
<type name="Psr\Log\LoggerInterface">
<plugin name="weltpixel-backend-logger"
type="WeltPixel\Backend\Plugin\Logger" sortOrder="15"/>
</type>
solved the problem.
Just search your file system for text
name="Psr\Log\LoggerInterface"
and remove the plugin temporarily until the time we have an official solution on GitHub issue https://github.com/magento/magento2/issues/14950
1、note: var/generation has been moved to generated/code and var/di has been moved to generated/metadata in m2.2, so we only delete generation.
rm -rf generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
2、try :
composer install
ditto. i also see a similar issue logged on https://github.com/magento/magento2/issues/14950
note: var/generation has been moved to generated/code and var/di has been moved to generated/metadata in m2.2
edit: i've also contacted WeltPixel following some comments on github and they have said.
"We are aware of this issue that came with Magento 2.2.4 , and we already fixed it. The fix will be included in the next products releases next week, after all tests are completed."
First clear all the cache by running following command in terminal:
rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
Then try the following:
php bin/magento setup:di:compile
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
Hopefully it will solve your issue.
I am using laravel/horizon with Osx MAMP pro
when I run the composer it requires laravel/horizon:~1.0
it shows a message -
laravel/horizon v1.0.8 requires ext-pcntl * -> the requested PHP
extension pcntl is missing from your system.
I checked the folder /Applications/MAMP/bin/php7.1.1/php/ext,it doesn't contain pcntl extension.
How can I install that?
download php from http://www.php.net/releases/
tar -xzvf php-7.2.1.tar.gz
cd php-7.2.1/ext/pcntl
/Applications/MAMP/bin/php/php7.2.1/bin/phpize
as # drewjoh metioned ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.1/bin/php
make && make install
the terminal shows
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/
open MAMP PRO menu->File ->Edit Template->PHP->7.2.1 add extension=pcntl.so at the end of the php.ini file .
run the command php --ri pcntl and shows
pcntl pcntl support => enabled
Just an addition. Perhaps you followed the above step and still can't get it installed to /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/. Here is something I did that worked for me.
I added the --with-php-config before the --prefix flag and it worked. See step below.
download your MAMP php version from http://www.php.net/releases/ Mine is php7.2.22
Open your terminal and cd into your download folder. Then run this command to decompress the tar.gz file
tar -xzvf php-7.2.22.tar.gz
Cd into the pcntl directory after decompressing.
cd php-7.2.22/ext/pcntl
Run the next line from your terminal to Configure for PHP Api, Zend Module Api, and Zend Extension Api.
/Applications/MAMP/bin/php/php7.2.22/bin/phpize
Then run
./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.22/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.22/bin/php; make && make install;
You should see
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.22/lib/php/extensions/no-debug-non-zts-20170718/
Then you can repeat the last two steps above.
You can download the precompiled extensions from here https://github.com/khanakiaphp/mamp_extensions