Getting A LAMP Stack Running on ChromeOS Containers via Project Crostini

I posted a tutorial yesterday on how to get Android Studio running on ChromeOS via Project Crostini Containers but I realize that not everyone is a Android Developer. Today’s tutorial will appeal to PHP Developers who would like to do some local development and testing on their Pixelbook via Project Crostini. Of course this is not designed to allow you to host production websites but it will work for those who wish to build and test PHP based web applications.

By now, I am going to assume you know how to setup a Crostini VM and Container, if not, please follow the steps outlined in this knowledgebase entry. The steps below will start assuming that you are already in your virtual machine at the username@stretch prompt.

Run the following commands at the terminal.

sudo apt-get update
sudo apt-get dist-upgrade 
sudo apt install apache2 apache2-utils
sudo systemctl enable apache2
sudo apache2 -v
sudo apt install mariadb-server mariadb-client
sudo systemctl enable mariadb
sudo mysql_secure_installation
sudo apt install php7.0 nano libapache2-mod-php7.0 php7.0-mysql php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readlin
sudo a2enmod php7.0
sudo systemctl restart apache2

Once the install is complete, your webroot will be in /var/www/html/

You will now need to get the IP Address of your virtual machine by running the command “ip addr”.

kmyers@stretch:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
valid_lft forever preferred_lft forever
4: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:8f:a0:f0 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 100.115.92.219/28 brd 100.115.92.223 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe8f:a0f0/64 scope link 
valid_lft forever preferred_lft forever

In my case, my IP Address is 100.115.92.219. This IP Address can be entered into the Chrome Browser on your Pixelbook and if everything went well, you should be greeted with the Apache Welcome Screen.

Happy Developing!

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

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