Magento is the fastest growing e-commerce platform in the world. Apart from being a widely used piece of software, Magento is also a great community of entrepreneurs, developers and marketers. And Amasty was always driven by belonging to this community.

Today we’re pre-launching a new product to provide a new step for Magento users.

Please meet the MagePhone, a smart tool to have your Magento store at your fingertips any time you need, any place you’re at.

MagePhone soon

It’s simple as that: just pre-order MagePhone and receive a smartphone with a pre-installed Magento. Turn the device on, and you’ll have your fully-functional Magento store everywhere you go. We do believe you shouldn’t be attached to your PC in 2016!

Thanks! The special offer has expired.

How to actually install Magento on your Android device

From our clients’ support queries, we know how versatile the platforms used for Magento are:

  • Linux/Apache/PHP/MySQL — a classic LAMP
  • Linux/Nginx/PHP/MySQL — a fast-growing LEMP
  • Linux/Nginx/HHVM/MySQL
  • Windows/Apache/PHP/MySQL
  • Windows/IIS/PHP/MySQL

Despite of the fact that Magento officially supports only the first two configurations (Magento1, Magento2), this list can be still expanded. But we have never met any exotic combinations, so we thought it could be fun to install Magento on a simple Android smartphone and to see how it goes. Enjoy!

We chose a vintage Android device which rested peacefully on my shelf for years. Its hardware is rather unpretentious for 2016:

  • CPU: MT6577 (1GHz ARMv7)
  • RAM: 1GB
  • Storage: 32GB SD card class 10

As Android is built on the top of Linux kernel, we only have to add Nginx, PHP and MySQL to make Magento running.

As I didn’t want to compile Nginx, PHP and MySQL for the smartphone’s processor, I chose a Debian distribution kit for armhf architecture and installed it on the SD card. By default, Android uses fat32 for SD cards, but it isn’t suitable for Debian. It was also impossible to use a loop-based file system because of the max file size limits in fat32. The simplest step is to create a separate partition and format it into a Linux-friendly file system.

To do that, I got the SD card out of the smartphone and connected it to my laptop. I didn’t want to break the Android compatibility, so I divided the SD card into two partitions: the first one of 1 GB size in fat32, and the second one of the rest of the space available, formatted as ext4 file system.

Now I need to mount the second partition and install Debian on it.

$ sudo mount -t ext4 /dev/mmcblk0p2 /mnt

$ sudo debootstrap --arch=armhf --variant=minbase --foreign jessie /mnt/debian

$ sudo umount /dev/mmcblk0p2

It’s time to put the SD card back into the smartphone to finish the Debian installation. For convenient workflow, I installed SSHDroid on the device and jail-broke it (on Android, jail-breaking is officially supported by some smartphone manufacturers).

I need to address the smartphone by its host name, not its IP address, so I’m adding the corresponding record to /etc/hosts of my laptop: android.local

And a little bit of kung fu…

# mount -t ext4 -o exec,dev,suid /dev/mmcblk1p2 /mnt/sdcard2

# export SDCARD=/mnt/sdcard2

# export ROOT=$SDCARD/debian

# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH

# export HOME=/root

# for f in dev dev/pts proc sys ; do mount -o bind /$f $ROOT/$f ; done

# export PS1='$USER@$HOSTNAME:${PWD:-?} # '

# chroot $ROOT /bin/bash -l

# debootstrap/debootstrap --second-stage

… and some settings for correct performance of Debian distribution kit apps on Android.

# ln -s /proc/mounts /etc/mtab

# echo ' localhost' > /etc/hosts

# echo ' android.local' >> /etc/hosts

# cat > /etc/apt.conf.d/50-apt-minimize <<_EOF_

APT::Install-Recommends "false";

APT::Install-Suggests "false";

Acquire::PDiffs "false";

Acquire::Languages "none";


# apt-get update

# apt-get install nginx php5-fpm php5-curl php5-gd php5-mcrypt php5-mysql mysql-server unzip

Oops! We’ve got a MySQL error.

160311 7:57:02 InnoDB: Initializing buffer pool, size = 128.0M

160311 7:57:02 InnoDB: Completed initialization of buffer pool

160311 7:57:02 InnoDB: highest supported file format is Barracuda.

160311 7:57:02 InnoDB: Waiting for the background threads to start

160311 7:57:03 InnoDB: 5.5.46 started; log sequence number 1595675

160311 7:57:03 [Note] Server hostname (bind-address): ''; port: 3306

160311 7:57:03 [Note]   - '' resolves to '';

160311 7:57:03 [ERROR] Failed to create a socket for IPv4 '': errno: 13.

160311 7:57:03 [ERROR] Can't create IP socket: Permission denied

160311 7:57:03 [ERROR] Aborting

160311 7:57:03 InnoDB: Starting shutdown...

160311 7:57:05 InnoDB: Shutdown completed; log sequence number 1595675

160311 7:57:05 [Note] /usr/sbin/mysqld: Shutdown complete

160311 07:57:05 mysqld_safe mysqld from pid file /var/run/mysqld/ ended

The error was caused by Android security system, which prevents apps run by general users from creating network sockets. To outflank this limitation, we should add the mysql user to the group with 3003 ID.

# groupadd -g 3003 aid_inet

# usermod -aG aid_inet mysql

# dpkg --configure --pending

Now MySQL should be installed and run. As a result, we have the following ‘server’ setup for Magento:

  • CPU: 1GHz
  • RAM: 1GB
  • Storage: 30GB SD card class 10
  • Software: Debian 8.3, Nginx 1.6.2, PHP 5.6.17 (ZendOpcache), MySQL 5.5.46

Let’s get the actual site up and running. I’ll be using Magento and sample-data

The next step is to copy the Magento and sample data files to the device storage.

$ scp ~/downloads/{,} <a href="mailto:root@android.local">root@android.local</a>:

Configure the site in Nginx.

# cat > /etc/nginx/sites-available/ <<_EOF_

server {

listen 80;


client_max_body_size 50m;

client_header_buffer_size 4k;

large_client_header_buffers 8 16k;

gzip off;

root /var/vhosts/;

index index.php;

location / {

try_files $uri $uri/ @handler;

expires max;


location ^~ /app/               { deny all; }

location ^~ /includes/           { deny all; }

location ^~ /lib/               { deny all; }

location ^~ /media/downloadable/ { deny all; }

location ^~ /pkginfo/           { deny all; }

location ^~ /report/config.xml   { deny all; }

location ^~ /var/               { deny all; }

location /. {

return 404;


location @handler {

rewrite / /index.php;


location ~ .php/ {

rewrite ^(.*.php)/ $1 last;


location /media/ {

access_log off;


location /js/ {

access_log off;


location /skin/ {

access_log off;


location ~ \.php$ {

if (!-e $request_filename) {

rewrite / /index.php last;


expires off;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

fastcgi_read_timeout 600s;

include fastcgi.conf;




Create a database for Magento.

# mysql

mysql> CREATE DATABASE `magento` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

mysql> GRANT ALL PRIVILEGES ON `magento`.* TO `magento`@`localhost` IDENTIFIED BY 'magentopasswd';

Unzip the source files and import sample data.

# mkdir /var/vhosts

# cd /var/vhosts/

# unzip /root/

# unzip

# mv magento

# mysql magento < magento-sample-data-

# cp -r magento-sample-data-{media,skin,js}

# chmod -R a+rX /var/vhosts/

# chmod -R a+w /var/vhosts/{app/etc,media,var}

MagePhone 1 magephone-2

Now open your browser and go to

Install Magento as usual. You may want to disable URL validation on the next step.

That’s it! We have successfully installed Magento on a smartphone. To make running and stopping Magento handy, I created a script:




PS1='$USER@$HOSTNAME:${PWD:-?} # '




start_magento() {

if [ ! -e $SD_BLK ]; then

echo "SD card device not found: $SD_BLK" >&2

exit 1


mount -t ext4 -o exec,dev,suid $SD_BLK $SD_MNT

for ENT in dev dev/pts proc sys


mount -o bind /$ENT $DEB_ROOT/$ENT


chroot $DEB_ROOT /etc/init.d/mysql start

chroot $DEB_ROOT /etc/init.d/php5-fpm start

chroot $DEB_ROOT /etc/init.d/nginx start


stop_magento() {

if [ ! -d $DEB_ROOT ]; then

echo "Not started" >&2

exit 1


chroot $DEB_ROOT /etc/init.d/nginx stop

chroot $DEB_ROOT /etc/init.d/php5-fpm stop

chroot $DEB_ROOT /etc/init.d/mysql stop

for ENT in sys proc dev/pts dev


umount $DEB_ROOT/$ENT


umount $SD_MNT


case $1 in

start) start_magento;;

stop) stop_magento;;

enter) chroot $DEB_ROOT /bin/bash -l;;

*) echo "$0 <start|stop|enter>";;


Please note that this script shouldn’t be on the same partition with Debian, I had it on the fat32 partition. To run Magento, you should open the terminal on Android or go with SSH. Get the root permissions (if you haven’t got them automatically depending on your terminal or SSHDroid settings) and perform the following command:

# sh /mnt/sdcard/ start

To shut Magento down, use this command:

# sh /mnt/sdcard/ stop

To enter the Debian environment, use the following command:

# sh /mnt/sdcard/ enter

And, as always, we at Amasty are obsessed with performance. To test Magento performance on Android, I used Apache jMeter and Selenium Webdriver, which let me test the full page load time, not only the server response time. You can download the test scenario here. I run the test 10 times and calculated the average results.

Here’s the test sequence:

  1. A guest enters the main page
  2. The guest goes to a category
  3. The category is filtered by color
  4. The category is filtered by material/purpose
  5. The search by ‘shirt’ keyword is performed
  6. The guest foes to the product page
  7. The product is added to cart
Android Magento installation performance test results
Label # Samples Average Min Max Std. Dev. Error % Throughput KB/sec Avg. Bytes
Main page 10 1288 588 2326 596,64 0.00% 0 1,23 35522,3
Category 10 2482 1702 4201 813,41 0.00% 0 2,2 63686
Filter black color 10 2012 1104 2940 702,07 0.00% 0 1,55 44869
Filter by occasion 10 2203 1069 3599 802,66 0.00% 0 1,37 39360
Search ‘shirt’ 10 3123 1706 3846 569,31 0.00% 0 1,69 49369
Product page 10 7407 4891 9663 1520,95 0.00% 0 1,59 47007
Add to cart 10 5353 3981 6536 804,02 0.00% 0 2,56 75016
TOTAL 70 3410 588 9663 2205,46 0.00% 0,2 11,19 50689,9

Well… Not very fast, huh? The main reason of the slow performance is the SD card speed. A class 10 SD card has the max recording speed around 10MB/s, which is not enough for normal store performance. We could save the case by caching the data with RAM, but the device has only 1 GB. What is more, you can’t have Wi-Fi available everywhere, and loading the data via GSM can be an adventure, too.

Didn’t we say we love to have fun at Amasty?

Happy 1st of April again!

P.S. When I showed the test results to my colleague, he said that judging by the speed of some stores, people run Magento on coffee machines…