$ wget https:\/\/dev.mysql.com\/get\/mysql-apt-config_0.8.22-1_all.deb\r\n$ sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb<\/pre>\nThe installation will prompt you some options, choose MySQL 8 and Cluster then press TAB to choose OK and hit ENTER \n <\/p>\n
Then, choose MySQL 8 and OK \n <\/p>\n
You will be brought to the initial window, this time choose OK and OK<\/p>\n
<\/p>\n
We need to update the package index before we can install MySQL server.<\/p>\n
$ sudo apt update\r\n$ sudo apt install mysql-server<\/pre>\nMySQL server will be automatically running, now we need to create a database.<\/p>\n
$ sudo mysql<\/pre>\nRun these MySQL commands, replace m0d1fyt15 with a stronger password:<\/p>\n
mysql> CREATE DATABASE magentodb;\r\nmysql> CREATE USER 'magento'@'localhost' IDENTIFIED BY 'm0d1fyth15';\r\nmysql> GRANT ALL ON magentodb.* TO 'magento'@'localhost';\r\nmysql> FLUSH PRIVILEGES;\r\nmysql> \\q<\/pre>\n<\/span>5. Install Elasticsearch<\/span><\/h2>\nElasticsearch is used as a search engine in a Magento website. Starting Magento 2.4, Elasticsearch is a required component hence we cannot perform Magento installation without Elasticsearch.<\/p>\n
Let’s install the signing GPG Key and add Elastic repository into the source list<\/p>\n
$ curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -\r\n$ sudo sh -c 'echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" > \/etc\/apt\/sources.list.d\/elastic-7.x.list'<\/pre>\nUpdate the package list then install Elasticsearch with these commands<\/p>\n
$ sudo apt update -y\r\n$ sudo apt install elasticsearch -y<\/pre>\nElasticsearch has been installed but it’s not started yet. Let’s start it on boot and start it now.<\/p>\n
$ sudo systemctl --now enable elasticsearch<\/pre>\nTo verify whether Elasticsearch service is running or not we can run this command:<\/p>\n
$ curl -X GET \"localhost:9200\"<\/pre>\nYou will see an output like this:<\/p>\n
{\r\n\"name\" : \"debian11\",\r\n\"cluster_name\" : \"elasticsearch\",\r\n\"cluster_uuid\" : \"FZs_Hgu4S3utmrS096Sg2A\",\r\n\"version\" : {\r\n\"number\" : \"7.17.5\",\r\n\"build_flavor\" : \"default\",\r\n\"build_type\" : \"deb\",\r\n\"build_hash\" : \"8d61b4f7ddf931f219e3745f295ed2bbc50c8e84\",\r\n\"build_date\" : \"2022-06-23T21:57:28.736740635Z\",\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}<\/pre>\n <\/p>\n
<\/span>6. Install Composer<\/span><\/h2>\nTo manage Magento components and its dependencies, we use Composer. In Debian 11, the latest version of Composer in the default repository is version 2.0.9. We are going to install Composer from getcomposer.org website to get the latest stable version.<\/p>\n
$ curl -sS https:\/\/getcomposer.org\/installer -o composer-setup.php\r\n$ sudo php composer-setup.php --install-dir=\/usr\/local\/bin --filename=composer<\/pre>\nTo check the Composer version you can run the following command:<\/p>\n
$ composer -V<\/pre>\n<\/span>7. Install Magento<\/span><\/h2>\nTo install Magento 2 using composer, you need to have an account at https:\/\/marketplace.magento.com\/. We would need to create an access key and use it to install Magento through the command line. In the link above, you can navigate to My profile > Marketplace > My products > Access Keys to see\/create an access key.<\/p>\n
$ sudo composer create-project --repository-url=https:\/\/repo.magento.com\/ magento\/project-community-edition=2.4.4 \/opt\/magento2<\/pre>\nThe command above will prompt you for a username and password. The username would be your public key, and the password is the private key you created earlier.<\/p>\n
Magento core files are downloaded to \/opt\/magento2 directory, let’s go in to the directory then proceed with the installation.<\/p>\n
$ cd \/opt\/magento2<\/pre>\nWe need to run the command below in the Magento directory, make sure the database details match with the credentials we created earlier. Also, create a stronger password than the one in the command.<\/p>\n
sudo bin\/magento setup:install \\\r\n--base-url=http:\/\/yourdomain.com \\\r\n--db-host=localhost \\\r\n--db-name=magentodb \\\r\n--db-user=magento \\\r\n--db-password=m0d1fyth15 \\\r\n--admin-firstname=admin \\\r\n--admin-lastname=admin \\\r\n--admin-email=admin@admin.com \\\r\n--admin-user=admin \\\r\n--admin-password=m0d1fyth15one \\\r\n--language=en_US \\\r\n--currency=USD \\\r\n--timezone=America\/Chicago \\\r\n--use-rewrites=1<\/pre>\nWait for a few minutes until the installation is completed.<\/p>\n
<\/p>\n
Then, let’s give the directory the correct permission.<\/p>\n
chown -R www-data: \/opt\/magento2<\/pre>\nIn the previous step we created an nginx server block for our Magento website, it is time to check the configuration and restart nginx.<\/p>\n
$ sudo nginx -t\r\n$ sudo systemctl restart nginx<\/pre>\nBy default, two-factor authentication is enabled in the new Magento installation. If you want to disable it, you can run the command below.<\/p>\n
$ sudo -u www-data bin\/magento module:disable Magento_TwoFactorAuth\r\n$ sudo -u www-data bin\/magento cache:flush<\/pre>\n<\/span>8. Setup Cron jobs<\/span><\/h2>\nMagento needs to run its cronjobs to automate its important system functions. Run the command below to create Magento cronjobs under user www-data.<\/p>\n
$ sudo -u www-data bin\/magento cron:install<\/pre>\n<\/span>9. Install an SSL Certificate<\/span><\/h2>\nIt is important to run a website in HTTPS mode. In this step, we will show you how to install an SSL certificate for your Magento website using the free one from Let’s Encrypt.<\/p>\n
$ sudo apt install python3-certbot-nginx\r\n$ certbot --nginx -d yourdomain.com<\/pre>\nThe command will prompt you for your email address and the agreement. Once the installation is completed, it will update your Magento nginx server block file to redirect all HTTP traffic to HTTPS.<\/p>\n
root@debian11:\/opt\/magento2# certbot --nginx -d yourdomain.com\r\n\r\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\r\nPlugins selected: Authenticator nginx, Installer nginx\r\nEnter email address (used for urgent renewal and security notices)\r\n(Enter 'c' to cancel): you@yourdomain.com\r\n\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\nPlease read the Terms of Service at\r\nhttps:\/\/letsencrypt.org\/documents\/LE-SA-v1.2-November-15-2017.pdf. You must\r\nagree in order to register with the ACME server. Do you agree?\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n(Y)es\/(N)o: y\r\n\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\nWould you be willing, once your first certificate is successfully issued, to\r\nshare your email address with the Electronic Frontier Foundation, a founding\r\npartner of the Let's Encrypt project and the non-profit organization that\r\ndevelops Certbot? We'd like to send you email about our work encrypting the web,\r\nEFF news, campaigns, and ways to support digital freedom.\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n(Y)es\/(N)o: n\r\nAccount registered.\r\nRequesting a certificate for yourdomain.com\r\nPerforming the following challenges:\r\nhttp-01 challenge for yourdomain.com\r\nWaiting for verification...\r\nCleaning up challenges\r\nDeploying Certificate to VirtualHost \/etc\/nginx\/sites-enabled\/magento.conf\r\nRedirecting all traffic on port 80 to ssl in \/etc\/nginx\/sites-enabled\/magento.conf\r\n\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\nCongratulations! You have successfully enabled https:\/\/yourdomain.com\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n\r\nIMPORTANT NOTES:\r\n- Congratulations! Your certificate and chain have been saved at:\r\n\/etc\/letsencrypt\/live\/yourdomain.com\/fullchain.pem\r\nYour key file has been saved at:\r\n\/etc\/letsencrypt\/live\/yourdomain.com\/privkey.pem\r\nYour certificate will expire on 2022-10-18. To obtain a new or\r\ntweaked version of this certificate in the future, simply run\r\ncertbot again with the \"certonly\" option. To non-interactively\r\nrenew *all* of your certificates, run \"certbot renew\"\r\n- If you like Certbot, please consider supporting our work by:\r\n\r\nDonating to ISRG \/ Let's Encrypt: https:\/\/letsencrypt.org\/donate\r\nDonating to EFF: https:\/\/eff.org\/donate-le<\/pre>\nUse the following Magento 2 CLI commands to update the Magento URL values in the database, replace yourdomain.com with your actual domain or subdomain name.<\/p>\n
$ cd \/opt\/magento2\/\r\n$ sudo -u www-data bin\/magento setup:store-config:set --base-url=\"https:\/\/yourdomain.com\/\"\r\n$ sudo -u www-data bin\/magento setup:store-config:set --base-url-secure=\"https:\/\/yourdomain.com\/\"<\/pre>\nCongratulation! You can now access Magento backend at https:\/\/yourdomain.com\/admin_180q2i\/. Please remember that your Magento Admin URI is provided during the installation, or you can also check it in app\/etc\/env.php file.<\/p>\n
\nIf you are one of our web hosting clients and use our managed Debian Hosting<\/a>, you don\u2019t have to follow this tutorial and install Magento 2.4.4 on your Debian 11 server yourself, you can simply ask our expert Linux hosting admins to set all of this up for you, quickly and easily. We can also help you with the more complex setup, like adding Varnish and RabbitMQ. They are available 24\u00d77 and will respond to your request immediately.<\/p>\nPS. If you liked this post, please share it with your friends on the social networks using the buttons below, or simply leave a comment down in the comments section. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"
Magento is a very well-known e-commerce platform and highly customizable application. It offers open-source and commercial versions to help developers … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":42904,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1700,1711,13],"tags":[1962,216],"yoast_head":"\nHow to Install Magento 2.4 on Debian 11 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n