Skip to content

Chromebook CFML development environment tutorial

This is partly an aide-memoire for me on setting up an environment for CFML development on a Chromebook. The specific Chromebook is a Lenovo S330.

My pre-requisite is that you’ve got a Lucee/ColdFusion application ready to go, although basically you could start from scratch with a simple index.cfm file wherever you eventually start CommandBox, but let’s leave that for later.

Enable Linux

First of all, you’ll want to enable Linux on your Chromebook. This can currently (March 2023) be found in Settings->Advanced->Developers. This will obviously change as ChromeOS changes, so search around for it.

Once you’ve done that, go into the Linux environment. You’ll get a “penguin prompt” – this is the command line of Linux on your Chromebook.

Installing an IDE – Visual Studio Code

For developing, we’ll want to install Visual Studio Code. (We could also install Sublime Text 3, so if you’d prefer to do that, skip this section and go to the Sublime Text one instead). These instructions are part of the Get Started Guide on Visual Studio’s site.

First of all, install the gnome-keyring:

sudo apt-get update
sudo apt-get install -y gnome-keyring

You’ll need to download the appropriate .deb file for your architecture. To find out your architecture:

dpkg --print-architecture

Once you’ve downloaded the .deb package, double-click it. This will install VSC inside the Linux environment of your Chromebook.

Installing an IDE – Sublime Text 3

If Visual Studio Code is your preferred editor, skip this section. If you prefer Sublime Text 3 (ST3), follow these instructions instead. Thanks to this site for the commands.

Install the GPG key:

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

Ensure apt is set up to work with https sources:

sudo apt-get install apt-transport-https

Select the stable channel of ST3 to use:

echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

Update your apt sources and install Sublime Text

sudo apt-get update
sudo apt-get install sublime-text

You can then run Sublime Text by typing into the terminal:

subl

Just a brief note: If you use snippets in ST, place them in:

~/.config/sublime-text/Packages/User

I did say this was part aide-memoire! 🙂

Get your code onto your Chromebook

The best way to get the code onto your Chromebook is to clone it from a GitHub repository. The best way to do this is to get an ssh key generated and put it into your GitHub profile.

If you’ve already created an ssh key, use that and skip this generation bit.

Using the email address that is attached to your GitHub account, do the following:

ssh-keygen -t rsa -b 4096 -C “your@emailaddress.com”

Enter your passphrase to secure the key. I normally just use “changeit”, but feel free to use your typical password. 😉

Type the following into the terminal:

eval “$(ssh-agent -s)”

If you see something about Agent pid ###, then everything’s fine. This worked for me, but if it doesn’t, find out how to run the ssh-agent.

Type the following command to put your key in the agent:

ssh-add ~/.ssh/id_rsa

You’ll need to enter the passphrase you previously entered.

Now, you’ll need to get the text in your key:

cat ~/.ssh/id_rsa.pub

This will output to the terminal. Copy the whole string.

Go to your GitHub settings and click SSH and GPG keys. Click New SSH Key. Name it after your Chromebook, or indeed call it Chromebook, so you know what you’re looking at. Paste the key into the box and click the add/save button.

Go to the GitHub Your Repositories page and find the repo you want on your Chromebook.

Click the <> Code button and go to the ssh tab. Copy the string in the box and then in the terminal on your Chromebook, cd into the directory you want your code in and do:

git clone git@github.com:<username>/<repository>.git

This should use your ssh key to clone your repo.

Installing CommandBox

CommandBox is the simplest way of getting a development environment set-up on your platform. It allows you to “pop up” a ColdFusion or Lucee server in a folder/directory of your choice.

This little tutorial is based on the Ortus install instructions.

You will need to add the Ortus repo to your apt sources list and the necessary keys. Then, you will need to install CommandBox itself.

curl -fsSl https://downloads.ortussolutions.com/debs/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/ortussolutions.gpg > /dev/null

echo "deb [signed-by=/usr/share/keyrings/ortussolutions.gpg] https://downloads.ortussolutions.com/debs/noarch /" | sudo tee /etc/apt/sources.list.d/commandbox.list

sudo apt-get update && sudo apt-get install apt-transport-https commandbox

If for some reason you do not already have Java installed, you will also need:

sudo apt install openjdk-11-jdk

Install the MariaDB database server

You will need to run another apt command:

sudo apt install mariadb-server

Make sure it’s running:

sudo systemctl start mariadb.service

Run the command to set-up a root password:

sudo mysql_secure_installation

Just follow the prompts and set-up the root password. You don’t need any of the test environment, so mostly just take the defaults offered.

Now, try and get into MariaDB by running:

mysql -u root -p

and enter the password you set during the secure installation.

This should give you the mariadb prompt. Press Ctrl-D to get out of that.

Install the MySQL/MariaDB maintenance software, PHPMyAdmin

As a final step, we need PHPMyAdmin:

sudo apt install php php-mysql libapache2-mod-php

sudo apt install phpmyadmin

This will run the Configuration Wizard within the terminal window. Take all the defaults, including the apache2 web server. Remember the password you set or that gets generated.

Once this has completed, you’ll think about accessing using http://localhost. Don’t bother, it doesn’t work. Instead, go to http://penguin.linux.test/phpmyadmin/

Start up your app

Go into the directory you Git cloned and make sure you are in the “web root” (whatever that means in your case). Now type:

box start

This should, with any luck, just start up a ColdFusion/Lucee server. There are ways to specify which one you want, and much more besides. Take a look here.

 

You should now be all set-up! Obviously, I’ll add to this tutorial if anything else useful comes up!

Add your datasource

If you’re using Lucee, you will need to point your browser at:

http://127.0.0.1/lucee/admin/server.cfm

and

http://127.0.0.1/lucee/admin/web.cfm

…fairly quickly to set your admin password and then configure your database and other options.

Published incfmlchromebook