{"id":3588,"date":"2023-09-22T14:29:07","date_gmt":"2023-09-22T07:29:07","guid":{"rendered":"https:\/\/ton.packetlove.com\/blog\/?p=3588"},"modified":"2023-09-22T15:04:43","modified_gmt":"2023-09-22T08:04:43","slug":"how-to-install-magento-2-4-6-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/ton.packetlove.com\/blog\/tuning\/how-to-install-magento-2-4-6-on-ubuntu-22-04.html","title":{"rendered":"How to Install Magento 2.4.6 on Ubuntu 22.04"},"content":{"rendered":"<figure id=\"attachment_3589\" aria-describedby=\"caption-attachment-3589\" style=\"width: 640px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ton.sookyenfarm.com\/blog\/wp-content\/uploads\/\/2023\/09\/1280px-Magento.svg_-640x177.png\" alt=\"\" width=\"640\" height=\"177\" class=\"size-medium wp-image-3589\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/1280px-Magento.svg_-640x177.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/1280px-Magento.svg_-1024x283.png 1024w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/1280px-Magento.svg_-768x212.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/1280px-Magento.svg_-100x28.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/1280px-Magento.svg_.png 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption id=\"caption-attachment-3589\" class=\"wp-caption-text\">Magento<\/figcaption><\/figure>\n<figure id=\"attachment_3599\" aria-describedby=\"caption-attachment-3599\" style=\"width: 640px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ton.sookyenfarm.com\/blog\/wp-content\/uploads\/\/2023\/09\/install-diagram-24-640x565.png\" alt=\"\" width=\"640\" height=\"565\" class=\"size-medium wp-image-3599\" srcset=\"https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/install-diagram-24-640x565.png 640w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/install-diagram-24-768x678.png 768w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/install-diagram-24-100x88.png 100w, https:\/\/ton.packetlove.com\/blog\/wp-content\/uploads\/2023\/09\/install-diagram-24.png 850w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption id=\"caption-attachment-3599\" class=\"wp-caption-text\">Install Diagram<\/figcaption><\/figure>\n<p>\u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35\u0e04\u0e23\u0e31\u0e1a \u0e27\u0e31\u0e19\u0e19\u0e35\u0e49 \u0e08\u0e30\u0e21\u0e32\u0e1e\u0e39\u0e14\u0e16\u0e36\u0e07\u0e01\u0e32\u0e23 <strong>Install Magento 2 (Adobe Commerce)<\/strong> \u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a<br \/>\n\u0e40\u0e1b\u0e47\u0e19 <strong>eCommerce Software<\/strong> \u0e15\u0e31\u0e27\u0e19\u0e36\u0e07 \u0e17\u0e35\u0e48\u0e19\u0e48\u0e32\u0e43\u0e0a\u0e49\u0e21\u0e32\u0e01\u0e46 \u0e21\u0e32\u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e01\u0e31\u0e1a feature \u0e17\u0e35\u0e48\u0e04\u0e23\u0e1a\u0e04\u0e23\u0e31\u0e19 ..<\/p>\n<p>\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21 <a href=\"https:\/\/business.adobe.com\/products\/magento\/magento-commerce.html\">https:\/\/business.adobe.com\/products\/magento\/magento-commerce.html<\/a><\/p>\n<p><strong>\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e02\u0e2d\u0e07 System \u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13\u0e19\u0e35\u0e49\u0e04\u0e23\u0e31\u0e1a<\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>- OS: Ubuntu 22.04\r\n- Magento: 2.4.6-p2 (Open Source)\r\n- Apache: 2.4.x\r\n- PHP: 8.1.2\r\n- Composer: 2.2.6\r\n- MySQL: 8.0.34\r\n- Elasticsearch: 7.17.13<\/code><\/pre>\n<\/div>\n<p>\u0e21\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e31\u0e19\u0e40\u0e25\u0e22 ..<\/p>\n<h2>Step 1: Update Operating System<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># apt update &amp;&amp; apt upgrade -y<\/code><\/pre>\n<\/div>\n<h2>Step 2: Install Apache Web Server<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># apt install apache2<\/code><\/pre>\n<\/div>\n<h2>Step 3: Install PHP and PHP extensions<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># apt install php php-common libapache2-mod-php php-cli php-fpm php-mysql php-json php-opcache php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-xml php-zip php-soap php-bcmath php-apcu<\/code><\/pre>\n<\/div>\n<h3>Modify php.ini file (\/etc\/php\/8.1\/cli\/php.ini)<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>memory_limit = 1GB\r\nupload_max_filesize = 256M\r\nzlib.output_compression = On\r\nmax_execution_time = 600\r\nmax_input_time = 900\r\ndate.timezone = Asia\/Bangkok<\/code><\/pre>\n<\/div>\n<h2>Step 4: Install the MySQL server<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># apt install mysql-server\r\n# mysql_secure_installation<\/code><\/pre>\n<\/div>\n<h2>Step 5: Create a Magento Database<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># mysql -u root -p<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>mysql&gt; CREATE DATABASE magento;\r\nmysql&gt; CREATE USER 'magento'@'localhost' IDENTIFIED BY 'Str0ngPa$$w0rd';\r\nmysql&gt; GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';\r\nmysql&gt; FLUSH PRIVILEGES;\r\nmysql&gt; EXIT;<\/code><\/pre>\n<\/div>\n<h2>Step 6. Install Elasticsearch<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -\r\n# echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list\r\n\r\n# apt update &amp;&amp; apt install elasticsearch\r\n\r\n# systemctl start elasticsearch\r\n# systemctl enable elasticsearch<\/code><\/pre>\n<\/div>\n<h3>Verify Elasticsearch<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -X GET \"localhost:9200\"\r\n\r\n{\r\n\"name\" : \"magento-01\",\r\n\"cluster_name\" : \"elasticsearch\",\r\n\"cluster_uuid\" : \"-Or5raP6T5uEG3bUG1JYHw\",\r\n\"version\" : {\r\n\"number\" : \"7.17.13\",\r\n\"build_flavor\" : \"default\",\r\n\"build_type\" : \"deb\",\r\n\"build_hash\" : \"2b211dbb8bfdecaf7f5b44d356bdfe54b1050c13\",\r\n\"build_date\" : \"2023-08-31T17:33:19.958690787Z\",\r\n\"build_snapshot\" : false,\r\n\"lucene_version\" : \"8.11.1\",\r\n\"minimum_wire_compatibility_version\" : \"6.8.0\",\r\n\"minimum_index_compatibility_version\" : \"6.0.0-beta1\"\r\n},\r\n\"tagline\" : \"You Know, for Search\"\r\n}<\/code><\/pre>\n<\/div>\n<h2>Step 7: Install Composer<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># apt install composer<\/code><\/pre>\n<\/div>\n<h2>Step 8: Install Magento<\/h2>\n<p><strong>Goto Magento Marketplace<\/strong> <a href=\"https:\/\/marketplace.magento.com\/\">https:\/\/marketplace.magento.com\/<\/a><\/p>\n<p><strong>Get Access Keys<\/strong><br \/>\n<strong>My profile &gt; Marketplace &gt; My products &gt; Access Keys<\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># composer global config http-basic.repo.magento.com Your-Public-Key Your-Private-Key\r\n\r\n# composer create-project --repository-url=https:\/\/repo.magento.com\/ magento\/project-community-edition=2.4.6-p2 \/var\/www\/magento<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># cd \/var\/www\/magento\r\n\r\n# bin\/magento setup:install \\\r\n--base-url=http:\/\/your-domain.com \\\r\n--db-host=localhost \\\r\n--db-name=magento \\\r\n--db-user=magento \\\r\n--db-password=Str0ngPa$$w0rd \\\r\n--admin-firstname=Admin \\\r\n--admin-lastname=User \\\r\n--admin-email=admin@your-domain.com \\\r\n--admin-user=admin \\\r\n--admin-password=admin123 \\\r\n--language=en_US \\\r\n--currency=USD \\\r\n--timezone=Asia\/Bangkok \\\r\n--use-rewrites=1\r\n\r\n# chown -R www-data: \/var\/www\/magento<\/code><\/pre>\n<\/div>\n<h2>Step 9: Setup Cron jobs<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># sudo -u www-data bin\/magento cron:install<\/code><\/pre>\n<\/div>\n<h2>Step 10: Configure Apache for Magento<\/h2>\n<p><strong>Create \/etc\/apache2\/sites-available\/magento.conf<\/p>\n<p><\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;VirtualHost *:80&gt;\r\nServerAdmin admin@your_domain.com\r\nDocumentRoot \/var\/www\/magento\/pub\r\nServerName your_domain.com\r\nServerAlias www.your_domain.com\r\n\r\n&lt;Directory \/var\/www\/magento&gt;\r\nAllowOverride All\r\n&lt;\/Directory&gt;\r\n\r\nErrorLog ${APACHE_LOG_DIR}\/error.log\r\nCustomLog ${APACHE_LOG_DIR}\/access.log combined\r\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># a2ensite magento.conf\r\n# a2enmod rewrite\r\n\r\n# systemctl restart apache2<\/code><\/pre>\n<\/div>\n<h2>Step 11: Access your Magento installation<\/h2>\n<p><strong>Store Front:<\/strong> http:\/\/your_domain.com<br \/>\n<strong>Admin Dashboard:<\/strong> http:\/\/your_domain.com\/admin_xxxxxx<\/p>\n<h2>Step 12: Diasable 2FA<\/h2>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># bin\/magento mod:dis Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth\r\n# bin\/magento setup:di:compile<\/code><\/pre>\n<\/div>\n<h2>Options: Tuning Magento<\/h2>\n<p><a href=\"https:\/\/experienceleague.adobe.com\/docs\/commerce-operations\/performance-best-practices\/software.html\">https:\/\/experienceleague.adobe.com\/docs\/commerce-operations\/performance-best-practices\/software.html<\/a><\/p>\n<div class=\"fcbkbttn_buttons_block\" id=\"fcbkbttn_left\"><div class=\"fcbkbttn_like \"><fb:like href=\"https:\/\/ton.packetlove.com\/blog\/tuning\/how-to-install-magento-2-4-6-on-ubuntu-22-04.html\" action=\"like\" colorscheme=\"light\" layout=\"button_count\"  size=\"small\"><\/fb:like><\/div><div class=\"fb-share-button  \" data-href=\"https:\/\/ton.packetlove.com\/blog\/tuning\/how-to-install-magento-2-4-6-on-ubuntu-22-04.html\" data-type=\"button_count\" data-size=\"small\"><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35\u0e04\u0e23\u0e31\u0e1a \u0e27\u0e31\u0e19\u0e19\u0e35\u0e49 \u0e08\u0e30\u0e21\u0e32\u0e1e\u0e39\u0e14\u0e16\u0e36\u0e07\u0e01\u0e32\u0e23 Install Magento 2 (Adobe Commerce) \u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a \u0e40\u0e1b\u0e47\u0e19 eCommerce Software \u0e15\u0e31\u0e27\u0e19\u0e36\u0e07 \u0e17\u0e35\u0e48\u0e19\u0e48\u0e32\u0e43\u0e0a\u0e49\u0e21\u0e32\u0e01\u0e46 \u0e21\u0e32\u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e01\u0e31\u0e1a feature \u0e17\u0e35\u0e48\u0e04\u0e23\u0e1a\u0e04\u0e23\u0e31\u0e19 .. \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21 https:\/\/business.adobe.com\/products\/magento\/magento-commerce.html \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e02\u0e2d\u0e07 System \u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13\u0e19\u0e35\u0e49\u0e04\u0e23\u0e31\u0e1a &#8211; OS: Ubuntu 22.04 &#8211; Magento: 2.4.6-p2 (Open Source) &#8211; Apache: 2.4.x &#8211; PHP: 8.1.2 &#8211; Composer: 2.2.6 &#8211; MySQL: 8.0.34 &#8211; Elasticsearch: 7.17.13 \u0e21\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e31\u0e19\u0e40\u0e25\u0e22 .. Step 1: Update Operating System # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1080,830,18],"tags":[803,1103,1108,967,968,1109],"class_list":["post-3588","post","type-post","status-publish","format-standard","hentry","category-devops","category-server","category-tuning","tag-apache","tag-elasticsearch","tag-magento","tag-mysql","tag-php","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/3588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/comments?post=3588"}],"version-history":[{"count":10,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/3588\/revisions"}],"predecessor-version":[{"id":3600,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/posts\/3588\/revisions\/3600"}],"wp:attachment":[{"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/media?parent=3588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/categories?post=3588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ton.packetlove.com\/blog\/wp-json\/wp\/v2\/tags?post=3588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}