Install Magento 2 on Ubuntu

29/12/2020
E-commerce websites provide a platform for buyers and sellers and make online business easier than before. Ecommerce site can be developed with a variety of different types of web applications. Magento is a popular open source CMS to develop e-commerce website with numerous functionalities, security and minimum programming knowledge. This CMS is supported running on both Windows and Linux. How Magento 2.2.6 can be installed on Ubuntu is shown in this tutorial.

Before Installation

You have to update the system and confirm that the following packages are installed and working properly before starting Magento Installation steps.

  • Apache2
  • MySQL 5.6+ or MariaDB
  • PHP 7+

Run the following commands to update and check your system is ready to start the installation.

$ sudo apt-get update
$ Apache2
$ PHP –v
$ mysql

If the following output appears then Apache, PHP and MySQL are installed.

Magento Installation Steps

Step-1: Download Magento Installer

Go to the following URL address, select the latest version of Magento and click on DOWNLOAD button. Here ‘Magento Open Source 2.2.6 tar.gz’ is selected and downloaded.

https://magento.com/tech-resources/download

You have to create an account in Magento site to download Magento. So, the following screen will appear before download. Create an account or login to your existing account to start the download process.

Step-2: Create folder and unzip Magento installer

By default, Magento will be downloaded on Downloads folder. Run the commands to create a folder named ‘magento’ under /var/www/html folder and copy the downloaded Magento file on that folder.

$ cd Downloads
$ ls
$ mkdir /var/www/html/magento
$ cp Magento-CE-2.2.6-2018-09-07-02-1238.tar.gz  /var/www/html/magento

Go to magento folder and unzip Magento installer.

$ cd /var/www/html/magento
$ ls
$ tar xzvf Magento-CE-2.2.6-2018-09-07-02-1238.tar.gz  /var/www/html/magento

Step-3: PHP Settings

You have to set permission to edit and save php.ini file.

chmod 777 /etc/php/7.1/apache2/php.ini

Open php.ini file from the location /etc/php/7.1/apache2/ and increase the memory limit and enable the following extensions.

Step-4: Database Setting

Login to MySQL server.

$ sudo mysql –u root -p

Create a database, ‘magento’.

mysql>create database magento;

Step-5: Setting Necessary Permissions

Run the following commands to set the necessary permissions for magento folder and restart the apache server.

$ sudo chown -R www-data:www-data /var/www/html/magento
$ sudo chmod -R  /var/www/html/magento
$ sudo service apache2 restart

Step-6: Setup Magento

Open a browser and enter the following URL and click on Agree and Setup Magento button.

http://localhost/magento

If any necessary PHP extension is missing then it will be displayed in this page. Here, two extension are missing or not working, soap and bcmath.

Install the missing extensions.

$ sudo apt-get install php-soap
sudo apt-get install php7.1-bcmath

Again run the setup. If everything is ok then click on Next button. Fill up the following form with database hostname, username, password and database name. Click on Next button.

Set the base URL of the store and admin in this step. Here, I have removed admin prefix for easy access.

Next step is for customizing the store. Keep default settings and click on Next.

Create admin account to login to the dashboard of admin panel and click Next.

Click on Install Now button after completing all setup.

If the installation completes successfully then the following screen will appear.

Step-7: Verify Magento is working or not

Run the following URL from the browser to test the store view is working or not.

http://localhost/magento

Run the following URL to login to Admin Panel. Provide the valid username and password that you have created in previous step.

http://localhost/magento/admin

The following admin panel will appear if Magento is installed and working properly.

Hope, this tutorial will help you to learn and use Magento on Ubuntu.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to Install DEB Packages on Ubuntu

The package files of Ubuntu have the extension .deb and it’s also called DEB files. On Ubuntu, there are many ways to...
29/12/2020

11 Best Web Browsers for Ubuntu

Web Browsers are one of the most widely used application software by millions of users worldwide. Ubuntu comes pre-loaded...
29/12/2020

Install Asterisk VoIP Server on Ubuntu

Asterisk is a free and open source framework for building your own communication applications. With Asterisk, you can build...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024