<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Magento Archives - Kpyxal Solutions LLP</title>
	<atom:link href="https://www.kpyxal.com/category/magento/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.kpyxal.com/category/magento/</link>
	<description></description>
	<lastBuildDate>Fri, 06 Sep 2024 13:44:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://www.kpyxal.com/wp-content/uploads/2024/07/cropped-48x48_logo-32x32.webp</url>
	<title>Magento Archives - Kpyxal Solutions LLP</title>
	<link>https://www.kpyxal.com/category/magento/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Mutation in GRAPHQL</title>
		<link>https://www.kpyxal.com/magento/mutation-in-graphql/</link>
					<comments>https://www.kpyxal.com/magento/mutation-in-graphql/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 20 Feb 2023 16:04:27 +0000</pubDate>
				<category><![CDATA[Graphql]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[expert exam with cloud addon AD0-E716]]></category>
		<category><![CDATA[graphql mutation example]]></category>
		<category><![CDATA[headless with graphql]]></category>
		<category><![CDATA[KPYXAL]]></category>
		<category><![CDATA[Kpyxal Solutions LLP]]></category>
		<category><![CDATA[magento certification]]></category>
		<category><![CDATA[magento2 caching]]></category>
		<category><![CDATA[magento2 graphql mutation]]></category>
		<guid isPermaLink="false">https://www.kpyxal.com/?p=92</guid>

					<description><![CDATA[<p>In the world of GraphQL, queries and mutations play distinct but complementary roles.Specifically, While GraphQL queries are designed to perform read operations, mutations handle the task of modifying data. Essentially, a mutation allows you to create, update, or delete objects and fields, functioning similarly to POST, PUT, and DELETE requests in REST terminology. Moreover, Understanding [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/mutation-in-graphql/">Mutation in GRAPHQL</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></description>
										<content:encoded><![CDATA[<figure class="wp-block-post-featured-image"><img loading="lazy" width="500" height="500" src="https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Mutation in GRAPHQL" decoding="async" srcset="https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL.png 500w, https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL-300x300.png 300w, https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL-150x150.png 150w, https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL-370x370.png 370w, https://www.kpyxal.com/wp-content/uploads/2023/02/Mutation-in-GRAPHQL-60x60.png 60w" sizes="(max-width: 500px) 100vw, 500px" /></figure>


<p>In the world of GraphQL, queries and mutations play distinct but complementary roles.Specifically,  While GraphQL queries are designed to perform read operations, mutations handle the task of modifying data. Essentially, a mutation allows you to create, update, or delete objects and fields, functioning similarly to POST, PUT, and DELETE requests in REST terminology. Moreover, Understanding the structure and function of mutations is crucial for effective data manipulation and application management. Therefore, In this context, let&#8217;s delve into the components that make up a Mutation in GRAPHQL and see how they contribute to its functionality.</p>



<h3 id="structure-of-a-mutation">Structure of a mutation<a href="https://developer.adobe.com/commerce/webapi/graphql/usage/#structure-of-a-mutation"></a></h3>



<p>Mutations consist of several key elements:</p>



<ul>
<li>First, you need the keyword &#8216;mutation.</li>



<li>An operation name for your local implementation. Consequently, this name is required if you include variables. On the other hand, it is optional.</li>



<li>The mutation name</li>



<li>The input object or attributes.In particular, Most mutations require an input object that contains data or individual attributes for the application server to process. However, on the other hand, some mutations, such as createEmptyCart, do not require an input object. In this particular case, therefore, the authorization token passed with the request provides the needed context.</li>



<li>The output object, which specifies which data the mutation returns.</li>
</ul>



<h2>Example of mutation graphql</h2>



<p>Here in this example, we are, indeed, adding data to the database using a GraphQL mutation.</p>



<p><strong>Step 1 :-</strong>&nbsp;You Create&nbsp;<strong><code>registration.php</code></strong>&nbsp;file</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="registration.php" data-lang="PHP"><code>&lt;?php
/**
 * @author KPYXAL
 * @copyright Copyright (c) 2023
 * @package Kpyxal_MutationGraphql
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    &#39;Kpyxal_MutationGraphql&#39;,
    __DIR__
);</code></pre></div>



<p><strong>Step 2 :-</strong>&nbsp;create&nbsp;<strong><code>etc/module.xml</code></strong>&nbsp;file</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="module.xml" data-lang="PHP"><code>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!--
/**
 * @author KPYXAL
 * @copyright Copyright (c) 2023
 * @package Kpyxal_MutationGraphql
 */
--&gt;

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;config xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Module/etc/module.xsd&quot;&gt;
    &lt;module name=&quot;Kpyxal_MutationGraphql&quot; setup_version=&quot;2.0.0&quot;&gt;
        &lt;sequence&gt;
            &lt;module name=&quot;Magento_Backend&quot;/&gt;
            &lt;module name=&quot;Magento_GraphQl&quot;/&gt;
        &lt;/sequence&gt;
    &lt;/module&gt;
&lt;/config&gt;</code></pre></div>



<p><strong>Step 3 :-</strong>&nbsp;GraphQL queries are declared under&nbsp;<strong><code>etc/schema.graphqls</code></strong></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="schema.graphqls" data-lang="PHP"><code>type Mutation {
    dataFormSubmit(input: FormInput!): FormOutput @resolver(class: &quot;\\Kpyxal\\MutationGraphql\\Model\\Resolver\\FormDataSave&quot;) @doc(description:&quot;Contact us form&quot;)
}

input FormInput {
    name: String @doc(description: &quot;Get Name&quot;)
    number: String @doc(description: &quot;Get Number&quot;)
    email: String @doc(description: &quot;Get Email&quot;)
    password: String @doc(description: &quot;Get Password&quot;)
    gender: Int @doc(description: &quot;Get Gender&quot;)
    bdate: String @doc(description: &quot;Get Birth Date&quot;)
}

type FormOutput {
   success_message: String @doc(description: &quot;Success Message&quot;)
}
</code></pre></div>



<p>Explanation of graphql :-</p>



<ul>
<li>type Mutation &gt; declares Mutation operations of our module.</li>



<li>dataFormSubmit &gt; name of our Mutation.</li>



<li>FormInput &gt; it is input value and type.</li>



<li>FormOutput &gt; declares output message.</li>
</ul>



<p><strong>Step 4 :-</strong>&nbsp;Create Resolver Class&nbsp;<strong><code>Model/Resolver/FormDataSave.php</code></strong></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="FormDataSave.php" data-lang="PHP"><code>&lt;?php

namespace Kpyxal\MutationGraphql\Model\Resolver;

use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Kpyxal\MutationGraphql\Api\TestRepositoryInterface;
use Kpyxal\MutationGraphql\Api\Data\TestInterface;


class FormDataSave implements ResolverInterface
{
    private $contactusDataProvider;

    /**
     * @param
     */
    public function __construct(
        TestRepositoryInterface $testRepository,
        TestInterface $testInterface
    ) {
        $this-&gt;_testRepository=$testRepository;
        $this-&gt;_testModel = $testInterface;
    }

    /**
     * @inheritdoc
     */
    public function resolve(
        Field $field,
        $context,
        ResolveInfo $info,
        array $value = null,
        array $args = null
    ) {

        $name = $args[&#39;input&#39;][&#39;name&#39;];
        $number = $args[&#39;input&#39;][&#39;number&#39;];
        $email = $args[&#39;input&#39;][&#39;email&#39;];
        $password = $args[&#39;input&#39;][&#39;password&#39;];
        $gender = $args[&#39;input&#39;][&#39;gender&#39;];
        $bdate = $args[&#39;input&#39;][&#39;bdate&#39;];

        $this-&gt;_testModel-&gt;setName($name);
        $this-&gt;_testModel-&gt;setNumber($number);
        $this-&gt;_testModel-&gt;setEmail($email);
        $this-&gt;_testModel-&gt;setPassword($password);
        $this-&gt;_testModel-&gt;setGender($gender);
        $this-&gt;_testModel-&gt;setBdate($bdate); 
        $thanks_message = [];

        try {
            $this-&gt;_testRepository-&gt;save($this-&gt;_testModel);
            $thanks_message[&#39;success_message&#39;]=&quot;Successfully Added&quot;;
        } catch (CouldNotSaveException $e) {
            $thanks_message[&#39;success_message&#39;]=&quot;Something went wrong.&quot;;
        }
        return $thanks_message;
    }
}</code></pre></div>



<p>Here in above resolver file we used:- </p>



<p><br>Kpyxal\MutationGraphql\Api\TestRepositoryInterface;<br>Kpyxal\MutationGraphql\Api\Data\TestInterface;<br><br>Additionally, the repository and interface file are designed to save fields such as email, name, and number.<br><strong>Step 6 :-</strong>&nbsp;Final step you check output. Run this query</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>mutation {
    contactusFormSubmit(
        input:{
            name: &quot;KPYXAL&quot;
            number: &quot;+123456798&quot;
            email: &quot;TEST@TEST.COM&quot;
            password: &quot;pass@123&quot;
            gender: &quot;1&quot;
            bdate: &quot;28/08/2222&quot;       
        }
    ){
        success_message
    }
}</code></pre></div>



<p>To sum up, mutations in GraphQL are essential for altering data within your application. They not only allow for the creation, update, or deletion of objects but also offer flexibility through various elements such as operation names and input objects. While mutations function akin to POST, PUT, and DELETE requests in REST, their integration with GraphQL&#8217;s robust query language provides a powerful toolset for managing data efficiently. As we continue to explore GraphQL, ultimately, understanding these components will help, significantly,  in harnessing the full potential of this dynamic query language.<br><strong>Happy Coding ..!</strong> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Check more blogs like this:</p>



<ul>
<li><a href="https://www.kpyxal.com/magento/graphql/query-in-graphql/">Query in GRAPHQL</a></li>



<li><a href="https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/">Magento 2.4.5 Installation on ubuntu</a></li>
</ul>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/mutation-in-graphql/">Mutation in GRAPHQL</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.kpyxal.com/magento/mutation-in-graphql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Magento2 Query in GRAPHQL</title>
		<link>https://www.kpyxal.com/magento/graphql/query-in-graphql/</link>
					<comments>https://www.kpyxal.com/magento/graphql/query-in-graphql/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 20 Feb 2023 05:32:36 +0000</pubDate>
				<category><![CDATA[Graphql]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[adobe commerce]]></category>
		<category><![CDATA[expert exam with cloud addon AD0-E716]]></category>
		<category><![CDATA[graphql query example]]></category>
		<category><![CDATA[Kpyxal Solutions LLP]]></category>
		<category><![CDATA[magento2 graphql]]></category>
		<category><![CDATA[magento2 query graphql]]></category>
		<guid isPermaLink="false">https://www.kpyxal.com/?p=84</guid>

					<description><![CDATA[<p>Magento2 Query in GRAPHQL retrieves data from the application server similar to a REST GET call. Additionally, Adobe Commerce and Magento Open Source GraphQL queries enable mobile apps or browsers to display a diverse range of information, including: Implementation Magento2 Query in GRAPHQL Built into Magento 2.4, GraphQL support simplifies data retrieval. The following sections [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/graphql/query-in-graphql/">Magento2 Query in GRAPHQL</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Magento2 Query in GRAPHQL retrieves data from the application server similar to a REST GET call. Additionally, Adobe Commerce and Magento Open Source GraphQL queries enable mobile apps or browsers to display a diverse range of information, including:</p>



<ul>
<li>A set of products to be displayed. This can include the entire catalog or those that match customer-specified criteria.</li>



<li>A customer token allows a query to access basic information, billing and shipping addresses, wish lists, order history, and other sensitive data. Moreover, GraphQL can also retrieve shopping cart contents for both guest and logged-in customers</li>



<li>Shopping cart contents. GraphQL supports both guest and logged-in customer carts.</li>



<li>Store configuration values, including theme and CMS settings, the currency code, and supported countries.</li>
</ul>



<h2><strong>Implementation</strong> Magento2 Query in GRAPHQL </h2>



<p>Built into Magento 2.4, GraphQL support simplifies data retrieval. The following sections will detail the step-by-step implementation process and provide an example of a Magento2 Query in GRAPHQL.</p>



<p><strong>Step 1 :-</strong>&nbsp;You Create&nbsp;<strong><code>registration.php</code></strong>&nbsp;file</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="registration.php" data-lang="PHP"><code>&lt;?php
/**
 * @author KPYXAL
 * @copyright Copyright (c) 2021
 * @package Kpyxal_GraphqlQuery
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    &#39;Kpyxal_GraphqlQuery&#39;,
    __DIR__
);</code></pre></div>



<p><strong>Step 2 :-</strong>&nbsp;create&nbsp;<strong><code>etc/module.xml</code></strong>&nbsp;file</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="module.xml" data-lang="PHP"><code>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!--
/**
 * @author KPYXAL
 * @copyright Copyright (c) 2021
 * @package Kpyxal_GraphqlQuery
 */
--&gt;

&lt;config xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Module/etc/module.xsd&quot;&gt;
    &lt;module name=&quot;Kpyxal_GraphqlQuery&quot; &gt;
        &lt;sequence&gt;
            &lt;module name=&quot;Magento_Customer&quot;/&gt;
            &lt;module name=&quot;Magento_Authorization&quot;/&gt;
            &lt;module name=&quot;Magento_GraphQl&quot;/&gt;
        &lt;/sequence&gt;
    &lt;/module&gt;
&lt;/config&gt;</code></pre></div>



<p><strong>Step 3 :-</strong>&nbsp;GraphQL queries are declared under&nbsp;<strong><code>etc/schema.graphqls</code></strong></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="schema.graphqls" data-lang="PHP"><code>type Query {
    formdata: [Formdata] @resolver(class:&quot;Kpyxal\\GraphqlQuery\\Model\\Resolver\\ProductsResolver&quot;) @doc(description:&quot;The formdata query returns information about a customer&quot;)
}
type Formdata @doc(description: &quot;Formdata defines the customer name and other details&quot;) {
    name: String @doc(description: &quot;Get Name&quot;)
    number: String @doc(description: &quot;Get Number&quot;)
    email: String @doc(description: &quot;Get Email&quot;)
    password: String @doc(description: &quot;Get Password&quot;)
    gender: Int @doc(description: &quot;Get Gender&quot;)
    bdate: String @doc(description: &quot;Get Birth Date&quot;)
}
</code></pre></div>



<p>In the above file, the file specifies that &#8216;type Query&#8217; declares the query operations for our module; furthermore, it highlights the structure and functionality that are essential for proper implementation.</p>



<p> <strong>&#8216;formdata&#8217;</strong> represents the query name, while <strong>&#8216;type Formdata&#8217;</strong> outlines the query’s structure, including the resolver (@resolver) class and documentation (@doc).</p>



<p><strong>formdata: [Formdata]&nbsp;</strong> :&nbsp; if we need array of data than need to put identity in array like:-<br>name of query = <strong>[</strong> Identity name <strong>]</strong>.<br>Here identity name is <strong>Formdata</strong> same name which we are use in : <strong>type Formdata</strong>&nbsp;</p>



<p><strong>Step 4 :-</strong>&nbsp;Create Resolver Class&nbsp;<strong><code>Model/Resolver/ProductsResolver.php</code></strong></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-file="ProductsResolver.php" data-lang="PHP"><code>&lt;?php
declare(strict_types=1);

namespace Kpyxal\GraphqlQuery\Model\Resolver;

use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Kpyxal\GraphqlQuery\Model\ResourceModel\Test\Collection;

/**
 * Product collection resolver
 */
class ProductsResolver implements ResolverInterface
{
    public function __construct(
        \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
        Collection $collection
    ) {
        $this-&gt;searchCriteriaBuilder = $searchCriteriaBuilder;
        $this-&gt;collection = $collection;
    }

    /**
     * @inheritdoc
     */
    public function resolve(
        Field $field,
        $context,
        ResolveInfo $info,
        array $value = null,
        array $args = null
    ) {
        $alldata = $this-&gt;getAllData();
        $arraydata= [];
        if (count($alldata) &gt; 0):
            foreach ($alldata as $data):
                 $arraydata[] = array(
                            &#39;name&#39;=&gt;$data-&gt;getName(),
                            &#39;number&#39;=&gt;$data-&gt;getNumber(),
                            &#39;email&#39;=&gt;$data-&gt;getEmail(),
                            &#39;password&#39;=&gt;$data-&gt;getPassword(),
                            &#39;gender&#39;=&gt;$data-&gt;getGender(),
                            &#39;bdate&#39;=&gt;$data-&gt;getBdate()
                        );
            endforeach;
        endif;
        return $arraydata;
    }

    /**
     * @return Collection
     */
    public function getAllData()
    {
        return $this-&gt;collection;
    }
}
</code></pre></div>



<p>The resolver file utilizes </p>



<p><em>Kpyxal\GraphqlQuery\Model\ResourceModel\Test\Collection </em></p>



<p>to gather data. This data is then assigned to variables including name, number, and email.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>{
    formdata{
        name
        number
        email
        password
        gender
        bdate
    }
}</code></pre></div>



<p>In conclusion, <a href="https://account.magento.com/customer/account/login">Magento2</a> Query in GRAPHQL offer a powerful way to retrieve data from the application server, similar to a REST GET call. They provide flexibility in accessing a wide range of information; consequently,&nbsp;enabling mobile apps or browsers to render content efficiently, making it an ideal solution for modern, headless commerce applications.</p>



<p><strong>Happy Coding ..!</strong> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Check More Like This </p>



<p>&#8211;<a href="https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/">Magento 2.4.5 Installation on ubuntu</a></p>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/graphql/query-in-graphql/">Magento2 Query in GRAPHQL</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.kpyxal.com/magento/graphql/query-in-graphql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Magento 2.4.5 Installation on ubuntu</title>
		<link>https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/</link>
					<comments>https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 15 Feb 2023 16:32:27 +0000</pubDate>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[adobe commerce]]></category>
		<category><![CDATA[expert exam with cloud addon AD0-E716]]></category>
		<category><![CDATA[how to install magento2 in ubuntu]]></category>
		<category><![CDATA[Kpyxal Solutions LLP]]></category>
		<category><![CDATA[magento2 installation]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://www.kpyxal.com/?p=7</guid>

					<description><![CDATA[<p>Magento 2.4.5 Installation on Ubuntu: First, check Magento 2 requirements. Subsequently, based on the requirements, install third-party software dependencies. After that, here, we install Magento 2.4.5 with sample data. Here&#8217;s a step by step procedure will probably save you a headache. let&#8217;s start&#8230; 1. Apache Installation (Version 2.4) To begin with, run the following commands [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/">Magento 2.4.5 Installation on ubuntu</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></description>
										<content:encoded><![CDATA[<figure class="wp-block-post-featured-image"><img width="500" height="500" src="https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Magento 2.4.5 Installation on ubuntu" decoding="async" loading="lazy" srcset="https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu.png 500w, https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu-300x300.png 300w, https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu-150x150.png 150w, https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu-370x370.png 370w, https://www.kpyxal.com/wp-content/uploads/2023/02/Magento-2.4.5-Installation-on-ubuntu-60x60.png 60w" sizes="(max-width: 500px) 100vw, 500px" /></figure>


<p>Magento 2.4.5 Installation on Ubuntu: First, <a href="https://experienceleague.adobe.com/en/docs/commerce-operations/installation-guide/system-requirements">check Magento 2 requirements</a>. Subsequently, based on the requirements, install third-party software dependencies. After that, here, we install Magento 2.4.5 with sample data.</p>



<p>Here&#8217;s a step by step procedure will probably save you a headache. let&#8217;s start&#8230;</p>



<h3 style="text-transform:none"><strong>1. Apache Installation (Version 2.4)</strong></h3>



<p>To begin with, run the following commands to install Apache on your system:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>sudo apt update

sudo apt install apache2 </code></pre></div>



<p>check apache version:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>apache2 -v</code></pre></div>



<h3>2. PHP Installation (Version 8.1)</h3>



<p>Next, run the following commands to install PHP on your system:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1 php8.1-common php8.1-mysql php8.1-gmp php8.1-curl php8.1-intl php8.1-mbstring php8.1-xmlrpc php8.1-gd php8.1-xml php8.1-cli php8.1-zip php8.1-soap php8.1-bcmath php8.1-fpm</code></pre></div>



<p>Note: Additionally, ensure that there are no extra spaces while running the above command.</p>



<h3><strong>3. Download Curl, GIT and composer(Version 2.2)</strong></h3>



<p>First, run the following commands to install curl and git on your system. Additionally, ensure these tools are up-to-date to avoid any potential issues during the installation process.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>sudo apt install curl git</code></pre></div>



<p>Next, install Composer (version 2.2) using the following command. After installation, verify the Composer version to ensure it is correctly set up and ready for use.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer</code></pre></div>



<h3><strong>4. Elasticsearch Installation and configuration(Version 7.17)</strong></h3>



<p>Follow the below command one by one:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>sudo apt install curl
sudo curl -sSfL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --no-default-keyring --keyring=gnupg-ring:/etc/apt/trusted.gpg.d/magento.gpg --import
sudo sh -c &#39;echo &quot;deb https://artifacts.elastic.co/packages/7.x/apt stable main&quot; &gt; /etc/apt/sources.list.d/elastic-7.x.list&#39;
sudo chmod 666 /etc/apt/trusted.gpg.d/magento.gpg
sudo apt update
sudo apt install elasticsearch</code></pre></div>



<h3><strong>5. MySQL Installation (Version 8.0)</strong></h3>



<p>Then, run the following commands to install MySQL on your system. After installation, first, configure MySQL settings in order to optimize performance and secure your database environment.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; sudo apt update
-&gt; sudo apt install mysql-server</code></pre></div>



<p>If MySQL is already installed on your system, first check its version using the following command. This step, therefore, ensures you are working with a compatible version for your setup and, in turn, can help avoid any version-related issues.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; sudo mysql;</code></pre></div>



<p>If you are using older version then requirement, then upgrade it using the Following command in terminal.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>=&gt; wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.11-1_all.deb
=&gt; sudo dpkg -i mysql-apt-config_0.8.11-1_all.deb
=&gt; sudo apt-get update
=&gt; sudo apt-get install mysql-server</code></pre></div>



<p>Now, you have required MySql version in your system.</p>



<h3><strong>6. Create DB for Magento</strong></h3>



<p>After installing MySql, create a new DataBase and its user for magento website. Firstly, follow the below steps:<br>=> Go to the mysql shell without password: </p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>sudo mysql -u root</code></pre></div>



<p>=&gt; Once you are logged in, then start creating database.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-sql" data-lang="SQL"><code>mysql&gt; CREATE DATABASE magentodb;</code></pre></div>



<h3><strong>7. </strong>Magento 2.4.5 Installation and Downloading on ubuntu</h3>



<p>Go to your directory where you want to install your magento. In this case, we are installing it in <strong><em>/var/www/html </em></strong>directory using below command:<br>-> <em>cd /var/www/html </em><br>We are going to install Magento 2.4.4 using composer. Firstly, you will require an access key for the next step. </p>



<p>Create an account at magento <a data-type="URL" data-id="https://account.magento.com/customer/account/login" href="https://account.magento.com/customer/account/login" target="_blank" rel="noreferrer noopener">MarketPlace</a> and create an access key. Once you have an access key, then run the command in the terminal in order to Magento 2.4.5 Installation on ubuntu.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.5 magento2.4.5</code></pre></div>



<p><br>This will ask username and password. Additionally, you have your access key which you taken from market place. Therefore, enter it.<br><em><strong>username = public key<br>password = private key</strong></em><br>Now, you have a magento2.4.5 folder in <em>/var/www/html </em>directory. Therefore, go to the Magento 2.4.5 directory:<br>-> <em>cd magento2.4.5</em></p>



<p>After download, Start running the following command to install magento2.4.5.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt;sudo bin/magento setup:install --base-url-secure=https://local.magento.com/ --db-host=localhost --db-name=magentodb --db-user=root --db-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/Chicago --use-rewrites=1</code></pre></div>



<p>Give the permission using below command:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; sudo chown -R www-data:www-data /var/www/html/magento2.4.5
-&gt; sudo chmod -R 755 /var/www/html/magento2.4.5</code></pre></div>



<h3><strong>8. Configuring Apache for Magento:</strong></h3>



<p>Run following command to create virtual host:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; sudo nano /etc/apache2/sites-available/local.magento.com.conf</code></pre></div>



<p>Now, add file content in the space that you see.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>&lt;VirtualHost *:80&gt;
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/magento2.4.5
ServerName local.magento.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
&lt;Directory &quot;/var/www/html/magento2.4.5&quot;&gt;
AllowOverride all
&lt;/Directory&gt;
&lt;/VirtualHost&gt;</code></pre></div>



<p>Next, run below command to enable site:<br>-&gt; sudo a2ensite local.magento.com.conf<br></p>



<p>Restart Apache2 using following command:<br>-&gt; sudo systemctl restart apache2</p>



<p>Open gedit and update file content using following steps:<br>-&gt; sudo gedit /etc/hosts<br>-&gt; add content :-&gt;  127.0.0.1        local.magento.com</p>



<p><strong>Open URL:  local.magento.com </strong><br>To deploy Magento without sample data, you can set up the website using the standard installation process.However, If you later decide to add sample data then run the following command to deploy it. Consequently, This allows you to customize the initial setup and integrate sample data as needed.</p>



<p><em>-&gt; bin/magento sampledata:deploy</em></p>



<h3><strong>9. Full deployment</strong></h3>



<p>Complete Magento 2.4.5 Installation on ubuntu using following commands:</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>-&gt; bin/magento setup:upgrade
-&gt; bin/magento setup:di:compile
-&gt; bin/magento setup:static-content:deploy -f
-&gt; bin/magento cache:flush
-&gt; bin/magento cache:clean
-&gt; bin/magento indexer:reindex</code></pre></div>



<p><strong>Happy Coding ..!</strong> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Check more like this:</p>



<p>&#8211; <a href="https://www.kpyxal.com/magento/mutation-in-graphql/">Mutation in GRAPHQL</a></p>



<p>&#8211;<a href="https://www.kpyxal.com/magento/graphql/query-in-graphql/">Query in GRAPHQL</a></p>
<p>The post <a rel="nofollow" href="https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/">Magento 2.4.5 Installation on ubuntu</a> appeared first on <a rel="nofollow" href="https://www.kpyxal.com">Kpyxal Solutions LLP</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.kpyxal.com/magento/magento-2-4-5-installation-on-ubuntu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
