How to Install and Configure Magento on Ubuntu 16.04

March 16, 2017 33k views
Apache MySQL LAMP Stack Ubuntu 16.04

I installed everything in this tutorial:

and i want to install Magento on my droplet which as title indicate is Ubuntu 16.04

but i got stuck on this tutorial in php settings section:

so if anyone knows how to do it ... please help me

1 comment
  • 7  mysql_secure_installation
    8  mysql -u root -p
    9  cd /var/www/public_html/

    12 wget
    15 tar xzvf Magento-CE-2.2.2sampledata-2017-12-11-09-37-31.tar.gz
    18 chown -R www-data:www-data /var/www/public_html/
    22 apt-get update
    25 apt-get install php7.0-dom
    29 apt-get install php7.0-soap
    30 /etc/init.d/apache2 reload
    31 apt-get install php7.0-intl
    32 apt-get install php7.0-mbstring
    33 vi /etc/php/7.0/apache2/php.ini
    34 apt-get install php7.0-zip
    35 /etc/init.d/apache2 reload

6 Answers

I'm pretty sure Ubuntu 16.04 comes with PHP 7.0, so that means you have to look for the configuration file in /etc/php/7.0/apache2/php.ini

And then change the following from php5 to:

sudo apt-get update
sudo apt-get install php7.0-curl php7.0-gd php7.0-mcrypt

That should cover everything, but if you run into problem, just write back - please include error messages or where you got stuck.

  • @sa1eh
    By the way, it's important that you use Magento version 2+, since you're using PHP 7.0
    It is possible to run the latest Magento 1.9 on PHP 7, but it requires some tweaks.

Great it's really working but I'm having some problems with downloading the Magento using wget


Hi ,

Could you please any one help me, how to exclude the var directory from magento nfs share.


For example, test directory contains two directory A and B and test.php file. So we have to exclude B directory but i need all the files from test directoryexcept B directory.

Kindly help me anyone, how to use nfs.

I have added my writeup on github, i am now running magento 2.2 on ubuntu 16.04 LAMP stack.

Hi there Please be careful with your Droplet memory specification before installing Magento on your vps. I have blown away my server because of not enough memory. Install Magento on at leat 4 GB server. In addition to that, be carefuı with the cron jobs. You should configure those also. Don't be such a novice like me.

Have another answer? Share your knowledge.