Meet MagePhone: from now on Magento’s in your pocket Meet MagePhone: from now on Magento’s in your pocket

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.

1
2
3
4
5
$ sudo mount -t ext4 /dev/mmcblk0p2 /mnt
$ sudo debootstrap --arch=armhf --variant=minbase --foreign jessie /mnt/debian http://http.debian.net/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:

1
192.168.1.114 magento.android.local android.local

And a little bit of kung fu…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# ln -s /proc/mounts /etc/mtab
# echo '127.0.0.1 localhost' > /etc/hosts
# echo '192.168.1.114 magento.android.local 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";
_EOF_
# 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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): '127.0.0.1'; port: 3306
160311 7:57:03 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
160311 7:57:03 [ERROR] Failed to create a socket for IPv4 '127.0.0.1': 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/mysqld.pid 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.

To read the full article CLICK HERE!

No comments so far.

Be first to leave comment below.

Your email address will not be published. Required fields are marked *