It’s well known that Magento is the number 1 ecommerce platform for online stores. As Magento was released as a dedicated platform for the sake of the merchants and online business, many developers and merchants started getting involved in learning it and started to looking at the future of their stores on this platform. Hence, its features can be extended by the use of extensions and themes.
1. MySQL database
2. The PHP programming language
3. Parts of the Zend Framework
Before installing Magento on Lamp stack, you have to learn how to setup Lamp Stack. Ahmed has already discussed the setup of Lamp Stack. So in this tutorial, I show you how to install Magento on Lamp Stack, after it has already been set up.
Setup SQL Database
To install Magento, you first need to set up your database. As mentioned above, the Magento platform uses MySQL database to manage all the data of the site. You may have already installed MySQL and be done configuring it, but to work with the Magento you have to make a database.
To setup the database the steps are below:
1. Create the Database
To make database, first log into the MySQL root account by using the following command:
mysql -u root -p
After this, the system will ask you about the password. It is the password that you set when you installed MySQL. Simply enter the correct password and you are then taken to MySQL command prompt.
Now create your database which is the most important thing to do so. You can name your database whatever you prefer. I have named it mag_db
create database mage_db;
PS: Don’t forget to put (;) semicolon at the end of every MySQL command.
2. Create the User Account
After you have created the database, you have to create a user account through which the newly created database will be operated. It is good to create a one-function database so that you can control the permissions better, which leads to a more secure database.
Again, you can name your user account whatever you want and can set password as you prefer. Mine will be mage_user for the account name and password is the password of the account.
PS: You need to put a more secure password. The more secure the password, the more security you will get.
create user 'mage_wajid1'@'localhost' identified by 'wajid';
3. Granting Privileges
We are done creating the database and user account especially for Magento. Now you need to setup the privileges for the user you just created. To grant all the privileges the command is:
GRANT ALL PRIVILEGES ON mage_db . * TO mage_wajid1 @localhost;
4. Flush the Privileges
After the above step, your user has access to the newly created database. You need to flush the privileges so that MySQL will get to know about the privileges that we have granted to the newly created user on the newly created database. After flushing out, just exit out of the MySQL command prompt.
After exiting, you will get back to SSH command prompt. And your database has successfully finished installing at this point.
Downloading and Setting up the Magento Files
After setting up the database, we are now ready to download and install the Magento files. It is recommended that you download the latest version. The reason for downloading the latest version is that it often includes the important security updates in addition to improved new features. The following are the steps for setting up the files.
1. Extract the Files
Use wget to download the Magento files and archive to your home directory.
Now extract the zip file using this command.
2. Assigning Ownership
Now you need to assign the ownership of the files and folders to Apache’s user and group. To do so, the command is:
sudo chown -R www-data:www-data /var/www/public_html/
PS: Take care of . The “R” case-sensitivity here should be capital.
After this command is run successfully, you have allowed the Apache server to create and modify these files.
Continue Installing Through Web Interface
To complete the installation, you now need to configure it through the web interface. To access the interface you have to open up your browser and then type in the server’s domain name or public IP address in the address bar.
I will now tell you about all the pages, step by step.
Page 1: Welcome Page
Now, if the above steps have been completed successfully, your Magento system will allow you to access this welcome page to set up the Magento installation. On this page, you will need to check the check box at the bottom before hitting the Continue button.
Page 2: Localization Page
On this page, you can change the local settings. From here, you can set the language of your system, the time zone and the currency, according to the place your products are being sold. After that, hit the orange Continue button at the bottom.
Page 3: Configuration Page
This page is further divided into three sections. I will tell you about each.
Section 1: Database Connection
The first section asks for information about the database of your Magento system.
Database Type: Make sure that you select the type MySQL, as Magento supports MySQL database type.
Host : Your host here should be localhost.
Database Name: Make sure that you put the name of the database that you decided during the creation of the MySQL database.
User Name: Put the username that you decided during creation of the user account.
User Password: Fill in the password that you put during the creation of the user account.
Tables Prefix : This field is optional. If you want to put any prefix before the table names, then fill out this field.
After filling the above fields, you have to jump to the second section.
Section 2: Web Access Options
The second section of the configuration page is the Web Access Options section. Here you have to set the Base URL of your store. Also, some of the Apache-controlled functions are also configured here.
Base URL: This field is an important field. You have to make sure that your URL must match with your server’s domain name. If you don’t have your domain name set up yet, you can use your server’s [public] IP address for the time being.
Admin Panel: This field requires the path of the admin panel. I have put “admin”. You have to select a less obvious path. This practice boosts security of the admin panel.
Enable Charts: If you want your charts to be displayed on the dashboard then Enable this option, if not then leave it as it is.
Skip Base URL Validation Before the Next Step: If you want your Base URL to be checked automatically then check this box, otherwise leave it unmarked.
Use Web Server (Apache) Rewrites: This field is to make your URL more user friendly and to make it more approachable to the search engines. The mod_rewrite Apache module is to support this functionality that has already been enabled.
User Secure URLs (SSL): If you have SSL available, then you have to enable this option.
Section 3: Session Storage Options
This is the last section of this configuration page. This section allows you to select any option through which you want your session data to be stored. There are basically two options here that Magento provides to store the sessions:
- File System: This is the simplest method to start with. This method will store the sessions in the server.
- Database: This method will store the session in the MySQL database.
After this, you have to hit the Continue button to access the next page.
Page 4: Create Admin Account
This page also contains three sections. On this page, we will set the account of the admin that will take care of the Magento store. I have listed the three of them below.
Section 1: Personal Information
First Name: The first name of the account admin.
Last Name: The last name of the account admin.
Email: The email address of the account admin.
That was it for the personal information of the Admin account.
Section 2: Login Information
Username: This field is a required field. You have to put the username that you will input while entering into the admin account.
Password: The password you have to set to login to the account for the admin. The more secure the password, the more the secure the account will be.
Confirm Password: Put the password here again that you have set already. If both of them match, then you are good to go to the next section.
Section 3: Encryption Key
This field can be filled if you are migrating your data over an existing Magento installation. Otherwise you have to leave this field blank.
After doing the above steps, you have to hit the continue button.
Page 5: Home Page
After creating admin account, the Magento installation is done and is ready to use. Put your public IP or the domain name on the address bar of the browser and see the front of your store.
If you have successfully configured the above steps, you will be directed towards the Home Page of your store.
Also, you can also visit this page by just using the command
To see the dashboard, you just have to login to the system using the username and password that you have already set above. If the info you provided is correct, you will be redirected towards the dashboard that will look like this.
After going through all the steps above, your Magento store is setup on the Lamp Stack and is ready to go. Now you can use it and start operating your store so that you can sell you products and delight your customers. Also, now you can set up the promotions for your store.
Still, if you have questions or want to give feedback, then feel free to contact me. So, what you are waiting for? You have this tutorial, start up your Magento store by following it!
Start Creating Web Apps on Managed Cloud Servers Now!
Easy Web App Deployment for Agencies, Developers and E-Commerce Industry