Your e-commerce platform with Magento 2 at Ubuntu 18.04

Im Durchschnitt wird dieses Tutorial Your e-commerce platform with Magento 2 at Ubuntu 18.04 mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 100 Besucher eine Bewertung abgegeben.
100 0

Your e-commerce platform with Magento 2 at Ubuntu 18.04

Apache Webserver
Magento 2 unter Ubuntu 18.04 installieren und konfigurieren

Magento is known as a powerful e-commerce platform written in PHP. This webshop system allows you to set up your own e-commerce and online store in minutes. For an installation under Ubuntu 16.04, our tutorial install Magento on Ubuntu 16.04 can help you. In this tutorial, I’ll show you how to get Magento 2 running on Ubuntu 18.04 LTS.

Before installing Magento 2

Magento runs on a LAMP stack and is only compatible with PHP 7.0 or 7.1. In addition to PHP, Apache and MySQL are components of the stack.

Before we start installing the above components of the LAMP stack, you should do an update/upgrade on your server.


apt-get update && apt-get upgrade

Install Apache2

With the command shown below you install the Apache2 web server.


apt-get install apache2

After this you can use the following command to deactivate the directory list.


sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf

To stop, start, and enable the Apache2 service, always use the commands listed below to ensure that the server startup occurs.


systemctl stop apache2.service

systemctl start apache2.service

systemctl enable apache2.service

Install MariaDB and create a database with users for Magento 2

The following is how to create a database server for your webstore. To do this you install MariaDB.


apt-get install mariadb-server mariadb-client

After installation, the following commands can always be used to stop, start, and activate the MariaDB service so that the server is started when booting the server.


systemctl stop mariadb.service

systemctl start mariadb.service

systemctl enable mariadb.service

To backup your database server, run the command below to backup the MariaDB server.


mysql_secure_installation

The command shown above will take you to a user dialog in your terminal. The following block shows Magenta highlighting the answers you should/could give to the neon green highlighted questions/requests and Cyan highlighting the action you need to perform here.

Enter current password for root (enter for none): Press the Enter key
Set root password? [Y/n]: Y
New password: Set password
Re-enter new password: Repeat Password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

After this a restart of the Apache2 webserver is necessary.


systemctl restart mariadb.service

Now it is time to create a database, as well as a user who can control this database. Log in to MariaDB.


mysql -u root -p

After successful verification with the password that you assigned during the backup of your MariaDB server, you can use the MariaDB command interface to perform operations in the database and its elements. In my example here I create the database named magentodb


CREATE DATABASE magentodb;

as well as the user magentouser, to whom I assign a password (testpassword).


CREATE USER 'magentouser'@'localhost' IDENTIFIED BY 'testpassword';

Finally, you have to make sure that the user and the database are in relation to each other by assigning the user all rights to the database with the command listed below.


GRANT ALL ON magentodb.* TO 'magentouser'@'localhost' IDENTIFIED BY 'testpassword' WITH GRANT OPTION;

Reload the authorization tables


FLUSH PRIVILEGES;

EXIT;

Install PHP 7.1 and necessary PHP modules

PHP 7.1 may not be available in standard Ubuntu repositories. For installation, you must obtain it from third-party repositories.

Run the following three commands to add the third-party repository to be upgraded to PHP 7.1.


apt-get install software-properties-common

add-apt-repository ppa:ondrej/php

apt-get update

After this you need to install a number of additional modules.


apt-get install php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-bcmath php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

Install Magento 2

To use Magento you must have a user account. You can register for a free account on the Magento website if you don’t already have one. You also need to have a user account to install the software if you want to get the software package from the Magento website to your server. You can download all available software packages from the Magento Tech Resources page. You should then download the Community Edition from the Full Releases section, as shown in the screenshot below. In my example, this is version 2.3.0. Use the download button to download the software package to your local computer.

Magento Tech Resources

It is also possible to download the latest software package via GitHub. You can do this using the command below, which allows you to change the version number if it has been updated in the meantime.


wget https://github.com/magento/magento2/archive/2.3.0.tar.gz

If you have done the previous tutorial, which I provide you with in this tutorial, not from your local server, but from an external scalable server, as we from gridscale offer it, then it is necessary that you transfer the software package to this external server. Just use the command shown below. In my example, I transfer the downloaded package from the download directory of my local server to the root directory of my external server. YourServerIP is the placeholder for the IP of your external server. If you have performed the steps shown above, which bring you closer to your own webshop, on your local server, then ignore the following code snippet.


scp /Downloads/Magento-CE-2.*.tar.gz root@YourServerIP:~/

Continue by creating a magento directory under /var/www/html.


mkdir /var/www/html/magento/

Unpack the software package and transfer it to the previously created magentodirectory.


tar -zxvf DirectoryOnYourServer/Magento-CE*.tar.gz -C /var/www/html/magento/

As I downloaded the package to the root directory on my server as an example, the above command would look like this:


tar -zxvf ~/Magento-CE*.tar.gz -C /var/www/html/magento/

Modify the directory permissions according to the Apache2 configuration by executing the commands shown below.


chown -R www-data:www-data /var/www/html/magento

chmod -R 755 /var/www/html/magento

After installing Magento 2

Configure Apache2 and enable the Magento & Apache2 rewrite module

Create a new configuration file for Magento 2. With the following command I do this with the nano-Editor.


nano /etc/apache2/sites-available/magento.conf

This will open an empty content file, in which you can copy and paste the content I provide in the code snippet below. example.com serves as placeholder and you have to exchange it with the domain name of your server everywhere.



     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/magento/
     ServerName example.com
     ServerAlias www.example.com

     
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

Activate Magento 2


a2ensite magento.conf

and also enable the Apache rewrite module.


a2enmod rewrite

Restart your Apache2 webserver.


systemctl restart apache2.service

Getting started with Magento 2

Open your browser and call Magento 2 with the domain name of your server. The first time you call up Magento 2, you will see the main page of the setup wizard, which you start by pressing the Agree and Setup Magento button.

Magento 2 Setup Wizard

Then click on the Next button and continue through the setup wizard.

Magento 2 Setup Wizard

Magento 2 Setup Wizard

After your PHP version and any additional PHP modules required have been successfully checked, you will be taken to form fields where you must enter the data for your database created for using Magento and move to the next setup step with the Next button.

Magento 2 Setup Wizard

Now it’s about the web configuration. Here you have to put your domain name in the field behind https:// . You can also use the Advanced Options options to configure your webstore. Click the Next button to continue with the setup wizard.

Magento 2 Setup Wizard

next you define the time zone, currency and language of your webshop in the form fields of the next step. Again, modulation options for your e-commerce platform are available under the fold-out Advanced Modules Configurations.

Magento 2 Setup Wizard

In the following step you create an admin account for the access to your webshop and confirm the transfer of your data by clicking the Next-Buttons.

Magento 2 Setup Wizard

If you confirmed these entries with the Next button, you will reach the setup wizard page, where you can start the installation with the Install Now button. After pressing the button you are no longer able to change data in the setup wizard via Back-Button.

Magento 2 Setup Wizard

Magento 2 Setup Wizard

As soon as the installation progress bar has run through, you will be taken to a page where you will find the successful installation, including the URL of your web shop and the login confirmation.

Magento 2 Setup Wizard

Via the Launch Magento Admin button you will be taken to the login page where you can enter and verify your username in combination with your password.

Magento 2 Login

If the login is verified, you should see the dashboard of your e-commerce platform.

Magento 2 Dashboard

Fulness

“Well done” – I’d say! Now it’s time to create exciting webshop projects with your own Magento 2 shop system. I wish you great success and above all a lot of fun! 🙂

Zurück zur Tutorial Übersicht Back to Tutorial Overview

Magento is known as a powerful e-commerce platform written in PHP. This webshop system allows you to set up your own e-commerce and online store in minutes. For an installation under Ubuntu 16.04, our tutorial install Magento on Ubuntu 16.04 can help you. In this tutorial, I’ll show you how to get Magento 2 running […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema ?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you