The age of international business is well and truly upon us. E-commerce is evolving at a breakneck pace, and the tools that are used to engage in it are also changing all the time. Today, we are going to learn how to install Magento on VPS. Magento is the premier e-commerce platform on the Linux OS, and as such, it is a valuable asset in the hands of any online businessperson who uses Linux and its distros as the primary tool for conducting themselves in the online world. Especially for developers who are also moving towards monetization within the online world, Magento is the go-to option.
But why VPS? Well, virtual private servers are incredibly helpful in allowing online businesspersons to easily access computers in regions in which they wish to conduct business. For example, an American company that wants to work within a European country using computers can easily order a VPS from that European country in order to get access to that specific IP range without actually traveling to Europe and setting up a physical server. It’s not hard to see why Magento and VPS go hand in hand in E-commerce. Hopefully, you’ll also be able to use these two powerful tools to your own benefit!
First Step: What Is Magento?
Before we get ahead of ourselves, it is important to know what exactly it is we’re installing on our VPS. Magento is an online eCommerce platform that uses the PHP coding language. It is open-source. Meaning that different users can download the base code and make modifications as they wish to it or make coding suggestions to the developers, who then may accept them and improve the program. Magento allows you to manage your own online store on its platform, and as of 2023, there are over 200.000 online stores on Magento. Magento is known for its dynamic ability to match its operator’s needs. Meaning that it doesn’t matter if your online store caters to a select few customers or if it has millions of clients. Magento and its diverse setup have you covered.
[rh-cta-related pid=”24381″]Magento makes it easy for businesses to concentrate all their data and effort into a single online eCommerce platform. This, in turn, makes managing an online store much easier. Magento also utilizes a host of different plug-ins to enhance its performance and add new features depending on the user’s needs. Last but not least, Magento also allows users to aesthetically alter and change the appearance of their online store, which will go a long way to make the presentation of products more optimal.
Quirks: Magento Features
It is not without reason that Magento is the eCommerce platform of discussion today. Since its initial release in 2008, Magento has managed to become the complete online eCommerce management tool on the Linux platform. This is both because of the original quality of the program as well as the fact that in more than 14 years of active development, it has received many updates that have made it a truly well-established program that can easily make a business go to newer heights. To know more about Magento, here we will take a quick look at the seven features that, in my opinion, make Magento the best eCommerce management tool out there.
Managing Catalogs
Any businessperson will tell you that your catalog can be what makes or breaks your business. Especially in the online world where the customers cannot physically examine your products, having a good catalog management tool is more than important. Magento comes with its own custom catalog management tool that allows you to present your products in the best way possible. This unique catalog manager comes with support for RSS feeds and digital products such as videos and music. It also gives you full inventory management. With this feature, you can also manage your export and import batches in one place.
SEO Platform
Search engine optimization, or SEO for short, has quickly become one of the main stratagems that any online business has to master in order to get more exposure on the web. After a business model is set up, the hard work of getting that exposure through optimizing your search engine exposure will only begin. Luckily, Magento comes with its own SEO platform that allows you to analyze your SEO performance in different time frames. Magento’s SEO platform comes up with Google sitemaps and SEO-friendly URLs that will greatly help you in optimizing your online store’s ranking on the web.
Payment Diversity
After all, is said and done, payment is the biggest concern for all business owners. Succeeding in an online business model is all about being able to receive payments in the most different methods possible. Since your customer base is likely diverse and from different parts of the world, the option to pay with different methods is crucially important. While Magento does not yet support cryptocurrencies, it does support almost all the conventional payment methods from different payment gateways and banks. Their payment apparatus even allows for alternate payment plans such as check orders and add-ons.
Analytics Dashboard
Any business will need an analytics section. Businesses that are not performing as expected can use important analytical info to improve on existing issues, while businesses that are up to par with their expectation can use analytics to perform even better within the market. Magento comes with its own advanced analytics dashboard, which allows you to clearly see where your business expenses are paying off and where they may be considered a waste. It allows you to clearly see which products are performing the best or worst, and It even allows you to calculate your taxes.
Security
Naturally, security is of the highest importance to an online eCommerce business. If at any point your online business platform gets hacked, then all of your financial information is potentially compromised, and this can have catastrophic consequences. Not only does Magento come with all the conventional security methods, such as encryption, but it goes the extra mile to make sure that all the hosted businesses on its platform will remain safe from hacking and online attacks. You will get all the security measures you are going to need, such as multi-factor authentication, Captcha, etc.
Marketing Tools
Chances are you are already impressed by the sheer amount of dedicated menus and platforms that Magento allocates to different areas of running an online eCommerce business. But if not, then let’s quickly go over their marketing and advertising platform. Magento’s marketing tools almost make up an entire marketing program on their own. With these tools, you can launch large-scale advertisement campaigns while monitoring data closely. Cross-selling products, coupon promotion. Newsletter and poll assignment, price variation recommendations, and promotional codes are all supported in Magento’s marketing section.
Managing Orders
This is perhaps not as much a unique feature as some of the other properties of Magento compared to other eCommerce management tools. But the order management platform of Magento is incredibly straightforward to use and provides the business owner with valuable tools and insights that allow them to grow their work. You can easily create, edit, view, and fulfill orders from the admin panel. You can send and receive Email notifications per order and make memos for each specific order as well. Refund management and custom return policy support for each order are also included as part of this panel.
Knowing the Host: What Is a VPS?
Now that we got to thoroughly know Magento and its useful features, it is time now to quickly discuss what a VPS is and what it does. VPS stands for a virtual private server. It is a server with virtually allocated resources from the provider that replicates another computer remotely for the client. A VPS user uses a connection protocol provided by the service provider to access this “server” from their own remote computer. VPS providers are growing every day as the decentralized nature of their services makes them very attractive in the current market.
So essentially, when we’re talking about installing Magento on VPS, we are talking about installing it on the remote server that the VPS provider has given us. In theory, this is not much different than installing Magento on your own local computer, with the difference that here we have the added layer of a VPS connection on top. If a business running on Magento is operating on a truly international level, then different VPS servers that allow them to have native access to the IP range of their operating regions are quite useful. It is important to know that the type of VPS used for this should use Linux as OS as Magento is primarily run on Linux distros.
[rh-cta-linux type=”2″ ]Install Magento on VPS: A Step by Step Guide
Now we can finally get down to how to install Magento on VPS. The steps below will have detailed instructions and clear definitions in order to help you install Magento on VPS with a minimum of fuss.
System Requirements
First things first are finding out if the host computer can run Magento or not. Do note that this system requirement is not applied to your local computer but rather to the VPS server that you will be connecting through. You are going to need at least 4GB of RAM for your VPS system. Then you also will need a minimum of 4 vCPUs. While you can run go on HDD drives, it is advised to install the program on SSD storage. You are going to need 25 GB of storage as well. However, keep in mind that the storage requirement may vary from business to business, with the amount of added data and plug-ins that are added over time contributing to this.
Making Sure You Have the Right Hosting Environment
Before we start installing the program itself, we need to make sure that a number of dependencies are already installed. This software is needed for Magento to run correctly.
OS
First, we have the OS. Of course, Linux is going to be the default OS that we’re going to use. However, you are also going to need a Linux distro. For the distro, you have four main options. These are Ubuntu, RHEL, CentOS, and Debian. CentOS recently went to End of Life, so it’s best not to use CentOS as it is a dead distro with no active support. Debian and Ubuntu are very similar. But my recommendation is that you go for Ubuntu since it is the most popular Linux distro in the world, and any problem you may encounter will have sufficient documentation on the web for you to solve it.
[rh-cta-related pid=”9815″]Web ServerÂ
After you have your distro of choice in place, it’s time to get a reliable web server on board. Here you have two main options between NGINX and APACHE. Both are very reliable, but I personally think NGINX has better compatibility and suits Magento better. We’ll get back to installing NGINX later.
Search Engine
A search engine, as well as PHP, is also required as prerequisites to install Magento on VPS. For a search engine, I decided to go for Elasticsearch. Like Nginx, we’ll circle back to how to install PHP and Elasticsearch later down the article.
Firewall Configuration (Optional)
If you have a firewall and you are sure that you do not want to disable it, then you need to make sure that in order to successfully perform a clean external download later for Magento, certain ports need to be opened. You are going to need to open the HTTP, HTTPS, SMTP, and SSH ports. So open the terminal and enter the following commands to open the ports:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=smtp
firewall-cmd --permanent --add-service=smtps
firewall-cmd --permanent --add-port=2200/tcp
firewall-cmd --permanent --add-port=8080/tcp
If you do not use the firewall, then skip this step.
Installing Web Server (NGINX)
Now it’s time to install the web server that your Magento is going to use. As already mentioned, we chose NGINX as the web server due to its easy installation and use. The ports I mentioned above also open the NGINX app download ports, so there is no need to do anything with the firewall if you follow the optional previous step. Enter the following commands to initiate installation:
sudo apt update
sudo apt install nginx -y
This is sufficient in order to finish the installation for NGINX. However, if you face restrictions with it later while using it with Magento, you can use this link to learn to modify NGINX in order to fit your needs.
Installing PHP
Strangely enough, PHP is not preinstalled on Ubuntu, even on version 20.04. So naturally, we need to install PHP since it is one of the requirements for running Magento successfully.
Step 1: Adding Repository Direction
Start by adding a repository direction for it and updating the apt with the following commands:
sudo apt install software-properties-common && sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
Step 2: Start the Download
Now run this command to trigger the download and installation process:
sudo apt install php8.1-{bcmath,common,curl,fpm,gd,intl,mbstring,mysql,soap,xml,xsl,zip,cli} -y
Step 3: Ensuring CompatiblityÂ
Finally, use these command one by one to make the PHP instance you just installed compatible with Magento by adjusting its variables:
sudo sed -i "s/memory_limit = .*/memory_limit = 768M/" /etc/php/8.1/fpm/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/" /etc/php/8.1/fpm/php.ini
sudo sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/" /etc/php/8.1/fpm/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/8.1/fpm/php.ini
Preparing a Search Engine (Elasticseach)
As we already mentioned, a search engine is also required to be installed in order for Magento to work properly. Since version 2.4 of Magento Elasticsearch is needed to run Magento, it is also the search engine that we are going to install here. Elasticsearch is great because it uses the common Java coding language and saves all of your data and documents in the secure NoSQL format. First, we need to install Java. If you already have it, you can skip the first three steps and start Elasticsearch installation properly from step 4 onwards.
Step 1: Update the Repository
Open the terminal and make sure that the Ubuntu repository is updated with the following command:
sudo apt update
Step 2: Begin Installation
Now we are going to run the command that will install OpenJDK, which checks for all the dependencies and then will install Java:
sudo apt install default-jre -y
Step 3: Java Installation
Make sure that your Java version is up to date with the following command:
java -version
Step 4: Linking Ubuntu and Repository
Now that Java is installed, let’s begin the installation by getting the apt-transport-https package which will do the task of linking your Ubuntu and repository:
sudo apt-get install apt-transport-https -y
Step 5: Add Elasticsearch’s Keys
Use the following curl command in order to make sure that the Elasticsearch’s GPG key is added to the system:
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.17.6/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.17.6.list
Step 6: Install the Program
Run the apt update again to refresh the cache, and then run the second command to install Elasticsearch:
sudo apt update -y
sudo apt install elasticsearch -y
And you’re done. Now you have Elasticsearch as your search engine and can proceed to the next step.
MySQL Installation
MySQL is also needed for Magento to run properly. Here’s how you can install it on Ubuntu.
Install MySQL
MySQL installation is rather straightforward, and you will start by running the following command:
sudo apt install mysql-server-5.7 mysql-client-5.7
Press Y if prompted here. Wait for the installation to be over.
Nginx and PHP Configuration
In this step, we are going to run a few commands to create a Magento user on your system. Then we are going to run several more commands to make sure that your NGINX and PHP versions are configured to run Magento.
Step 1: Create User
Making a Magento user is straightforward. Use the following commands to create the user and embed it into your Ubuntu:
adduser Magento
mkdir /home/Magento/public_html
chown Magento.Magento /home/Magento/public_html/
chmod 755 /home/Magento/
chcon -Rt httpd_sys_content_t /home/magento/public_html/
Step 2: Create Separate Socket Files
Now we are going to make sure that our PHP and NGINX are configured properly to run Magento by creating a separate socket file for them. Run the following commands:
vi /etc/php-fpm.d/Magento.conf
Content of the file:
[magento] user = Magento group = Magento listen.owner = nginx listen.group = nginx listen = /run/php-fpm/Magento.sock pm = ondemand pm.max_children = 50 pm.process_idle_timeout = 10s pm.max_requests = 500 chdir = /
Install Composer
Composer is the final requirement before we move towards the installation of Magento itself.
Install the Program
Use the following two commands to install the program and use the third command optionally to see if your version of Composer is up to date or not:
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer -V
Let’s move on to finally start the installation of Magento itself.
Install Magento
Installing Magento using Composer is the easiest method hence why we installed Composer in the previous step. Now, to install Magento using the Composer, you are going to need your access key before we start the installation. In order to get this access key, you need to go to Magento’s official access key section.
Step 1: Create Project Within the Repository and Download
Open up the terminal, and let’s get right into it with the following commands:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3 /opt/magento2
Here you are required to enter your public and private keys in the next prompt. Follow this example:
Username: YOUR_PUBLIC_KEYÂ Password: YOUR_PRIVATE_KEY
This will initiate the downloading process.
Step 2: Begin Installaion
Once the download is finished, use the following command to start the installation process:
cd /opt/magento2
Also, use this very long command and edit your email address, password, and domain name instead of the default content:
sudo bin/Magento setup:install \
--base-url=http://yourdomain.com \ --db-host=localhost \ --db-name=magentodb \ --db-user=magento \ --DB-password=magento \ --admin-firstname=admin \ --admin-lastname=admin \ [email protected] \ --admin-user=admin \ --admin-password=admin123 \ --language=en_US \ --currency=USD \ --timezone=America/Chicago \ --use-rewrites=1
Step 3: Grant Needed Permissions
Now grant Magento its required permissions using the following command:
sudo chown -R www.data. /opt/magento
Congratulations! Now you have your Magento installation finished. Let’s go for the finishing touches now.
Cron Jobs Setup
Magento will run without Cron Jobs. However, if you want to use its automated features, you are going to need the following Cron Job created in your system. It’s quite simple. Enter the following command into the terminal:
sudo -u www-data bin/magento cron:install
Conclusion
Installing Magento is definitely a demanding task. It requires decent technical knowledge and a good deal of manual work in preparing the prerequisites before you can actually install and use the program. However, the rewards definitely outweigh the trouble that one has to go through in order to install Magento on VPS. Using Magento, you can start your very own online eCommerce business with one of the best tools to manage it.
However, if going through all the trouble still seems unfeasible to you, there is another solution. You can use Cloudzy’s Magento VPS Hosting and kill two birds with one stone. It is a VPS that has Magento and all its prerequisites already installed for you. The VPS itself is of the highest quality. With 15 different locations, minimal latency, 99.95% uptime, and a guaranteed 7-day money-back guarantee.
[rh-cta-linux type=”2″ ]FAQ
What is the Main Incentive to Install Magento on VPS?
Magento is used by a lot of large eCommerce businesses. Therefore it is a good idea to have it on multiple devices for international management and get the native IP range of the overseas regions in which your business is active.
Can you run Magento on Shared Hosts?
Yes, it is possible to set up Magento on shared hosting. But since it needs very high resources, you should choose a Magento VPS for better performance and SSH access in order to make sure it runs as smoothly as possible.
Is it Possible to Install Magento on VPS with Windows?
Yes. While it is recommended to use Linux servers to run Magento, you can also run Magento on Windows servers using the XAMPP web server. However, the stability of the program may be affected.
What are the Software Prerequisites to Install Magento on VPS?
Aside from a standard Linux distro like Ubuntu, you are going to need a Web server such as Nginx, a search engine such as Elasticsearch, and the latest version of PHP and MySQL.