Tutorials  /  Ubuntu

Install Magento on Ubuntu 15.04 with LAMP Stack

Ccentron Redaktion · June 2025 ·7 min read ·Ubuntu, Tutorial

Magento is a free and open-source e-commerce solution developed by eBay. It typically runs on a LAMP stack across most Linux-based systems. This guide explains how to deploy Magento on Ubuntu 15.04, although the instructions should also work for other Ubuntu versions.

Keep in mind that Magento consumes a significant amount of server resources. While a test environment requires at least 512MB of RAM for PHP, it's recommended to allocate 1GB for small-scale stores and at least 4GB for medium to large-scale stores managing hundreds of items.

This guide assumes you're working with a freshly provisioned VPS without any pre-installed packages.

Step 1: Install the LAMP Stack

Start by updating the apt package index to make sure you're pulling the latest versions:

Console
$ apt-get update

Once updated, proceed to install the LAMP stack (Linux, Apache, MySQL, PHP) in one command using sudo. Alternatively, each component can be installed individually following a different tutorial:

Console
$ sudo apt-get install lamp-server^

During installation, you'll be prompted to create a root password for MySQL. Choose a strong password and make sure to save it—you’ll need it later in the setup.

VM

Matching infrastructure at centron

Ubuntu servers without your own hardware: ccloud³ VMs with full root access from €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 2: Configure Apache

Before Magento can be installed, Apache needs to be configured to handle redirection and URL rewriting. To do this, you'll create a new virtual host configuration file:

Console
$ sudo nano /etc/apache2/sites-available/magento.conf

Inside the file, add the following configuration block. This example uses the nano editor, but any text editor will work:

Code
<VirtualHost *:80>
    DocumentRoot /var/www/public
    <Directory /var/www/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
    </Directory>
</VirtualHost>

The contents should resemble the configuration in the screenshot named 1.png.

Save and exit the file using Ctrl + O to write the file and Ctrl + X to close nano.

Now, enable the new virtual host and disable the default one with the following commands:

Console
$ sudo a2ensite magento.conf
Console
$ sudo a2dissite 000-default.conf

Finally, restart Apache to apply the changes:

Console
$ sudo service apache2 reload

Step 3: Configure PHP for Magento

Since Magento is a high-demand application, the default PHP settings must be adjusted to provide more memory. For this test installation, we'll allocate 512MB of memory. However, real-world stores generally require between 1GB and 4GB, depending on their size.

Start by opening the php.ini configuration file with a text editor:

Console
$ sudo nano /etc/php5/apache2/php.ini

Within this file, search for the line that defines the PHP memory limit and modify it as shown below:

Code
memory_limit = 512M

This adjustment is illustrated in the screenshot labeled 2.png.

Save the file and exit using Ctrl + O followed by Ctrl + X.

Magento also depends on a set of additional PHP modules. You can install all of them at once using the following command:

Console
$ sudo apt-get install php5-mcrypt php5-curl php5-gd libcurl3 php5-intl php5-xsl

After installation is complete, enable the necessary modules with the commands below:

Console
$ sudo a2enmod rewrite
Console
$ sudo php5enmod mcrypt

Restart the Apache service to activate the changes:

Console
$ sudo service apache2 restart

Step 4: Prepare MySQL for Magento

Magento uses MySQL to manage all the website's content and configuration data. A dedicated database must be created for it. Start by launching the MySQL command line using the password set earlier during the LAMP stack setup:

Console
$ mysql -u root -p

Once you're in the MySQL shell, run the following SQL command to generate a new database for Magento:

Code
CREATE DATABASE magento;

Exit the MySQL prompt by pressing Ctrl + C.

Step 5: Install Magento Using Composer

Begin by installing Composer, a dependency manager for PHP, using the following command:

Console
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

To access the Magento source code repository, you'll need to authenticate using a keypair. Please refer to the official Magento Developer Documentation for the most up-to-date steps on generating these keys.

After obtaining the keys, store them in Composer's authentication file by editing it with the following command:

Console
$ sudo nano /root/.composer/auth.json

Insert the following JSON content, replacing the placeholders with your actual public and private keys:

JSON
{
  "http-basic": {
    "repo.magento.com": {
      "username": "<your public key>",
      "password": "<your private key>"
    }
  }
}

Navigate to your web server’s root directory:

Console
$ cd /var/www

Clone the Magento 2 repository using Git and specify the version branch:

Console
$ git clone -b 2.0 https://github.com/magento/magento2.git public

Once the repository is cloned, enter the Magento directory:

Console
$ cd public

Run Composer to install all required dependencies for Magento:

Console
$ composer install

Step 6: Complete the Installation via Browser

To continue, open your web browser and go to the IP address assigned to your VPS.

Upon visiting the site, you should see the Magento setup wizard. Follow the steps in the browser interface, and be sure to use the database credentials you created earlier in this tutorial.

Conclusion

By following the steps outlined in this tutorial, you’ve successfully set up Magento on an Ubuntu 15.04 server with a full LAMP stack. From configuring Apache and PHP to installing Magento via Composer and finalizing the setup in your browser, your development environment is now ready to explore Magento’s powerful e-commerce features.

Always remember that Magento is resource-intensive. If you're planning to use it for a live online store, consider optimizing your server environment and scaling up your resources accordingly. Additionally, stay up to date with Magento’s latest updates and security patches to ensure optimal performance and protection.

With your store infrastructure now in place, you're ready to start customizing your storefront, adding products, and preparing for launch.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Ubuntu
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren