This post has already been read 3181 times!
I recently purchased a Samsung Galaxy Tab (GT-6200) and quickly decided I needed to be able to do some web development and site testing when offline. I was happy to find that the process of getting a LAMP stack up and running can be relatively straightforward. In this post I’ll cover getting Debian up and running. In my next I will cover Apache, MySQL, and PHP. After that I will cover setting up an graphical environment with lxde, GIMP, and Inkscape.
So, lets get started:
1. Root your system.
This process is different for every device. I followed the tutorial HERE, which involved downloading a root.zip file to my external sdcard and rebooting into debug mode. Samsung did something strange with their filesystem by making “/mnt/sdcard” the internal tablet memory. To root the GT-6200, the root.zip file must be in “/mnt/sdcard/extStorages/SdCard”.
2. Install the following packages in Android:
Superuser, Android Terminal Emulator, and Linux Installer
I also found the following programs helpful for various development activities unrelated to getting your server up and running:
AndFTP, 920 Text Editor, ConnectBot, ColorHex, Hacker’s Keyboard, FireFox, Opera Mobile, and View Web Source
3. Configure Linux Installer.
You can ignore any /proc/config.gz errors when you open the program. If you get superuser/root errors, make sure you have rooted your phone and installed the Superuser Android app and restart the Linux Installer app. The default filesystem is only 500MiB, which is plenty for a terminal-based web server, but you will want to make this larger if you plan on running a desktop environment (2+GiB). I experienced bugs when trying to rename the chroot start script to something other than linuxchroot. If for some reason you dont have space for the Linux.loop file in the default location and the linuxchroot script is not updating properly, you can edit it by running:
cat $(which linuxchroot)
The output will tell you the location of the .sh file to edit to fix any errors.
The only other setting you might want to change is the distribution and branch, I chose Debian for distribution and Testing for branch (Stable could be a better choice if you don’t mind having older program versions). I also checked all boxes under “Package software configuration”.
4. Begin the installation.
Ensure that you have the time and battery charge to complete the entire installation process as any interruption could have unpredictable results. The installation should be straightforward:
-Click “Create target loop”, then “Format target loop”, then “Mount loop”. You should be able to safely override any Chroot warning concerning removeable storage as long as you dont try to remove the card the loop file is on or access it via USB while it is mounted.
-Click “Install distribution in LOOP”. At this point if you switch to another app for more than a few minutes, your installation could be incomplete. Have some patience and keep the installer active. If the install does hang, exit the Linux Installer app and restart it, this time SKIPPING the “Create..”. and “Format…” options and go directly to “Mount loop”and select the “Install…” option again. Once the install completes, click “Update linuxchroot script in Android”
5. Start Linux.
Open the Terminal emulator and type:
6. Update your system and install desired programs.
To shutdown the chroot environment, run:
To run commands on startup and shutdown of your system, you will need to edit the following files inside your chroot environment:
Now that you have Linux up and running, you can move on to the relatively straightforward pricess of getting Apache, MySql, and PHP running. Open your terminal emulator and run linuxchroot to get your Linux environment up and running.
1. Update your system.
2. Install and configure MySQL
apt-get install mysql-server mysql-client
If your experience mirrors mine, mysql-server will install with an error related to the MySQL socket being unable to start. If that is the case, do the following:
3. Install Apache2
apt-get install apache2 apache2-doc
service apache2 restart
4. Install PHP and, optionally PHPmyAdmin
apt-get install php5 php5-mysql libapache2-mod-php5
apt-get install phpmyadmin
5. Configure Apache and MySQL to start everytime you start linux
service mysql start
service apache2 start
6. Configure shutdown script
service apache2 stop
service mysql stop
At this point you should be up and running.
Opening the browser on your android device and going to http://localhost/ or http://127.0.0.1/ will take you to your internal LAMP server anytime your linuxchroot envirnoment is running.