Coding on a Chromebook: A How-To Guide, Part 2

You’ve got Ubuntu now successfully installed on your Chromebook? Great! Now here’s how to load the rest of the things you need to do serious coding on a $175 computer.

In my last essay here (read it first if you haven’t, through the link above or by clicking here), I talked about one of the biggest frustrations I’ve been having since graduating DevBootcamp last August: that I haven’t had a laptop I could code on or take to hackathons or walk through my repos with during job interviews. That’s because I bought my current laptop long before deciding to switch careers in the first place, a cheap little Acer running Windows 10 that I’ve owned for almost a decade now, and Windows is kind of a crappy OS to try to do serious coding (or at least, all my friends are on Macs so can’t help me troubleshoot); and the cheapest Mac laptop on the market is a thousand bucks, and if I had an extra thousand bucks laying around, I wouldn’t be needing to switch careers in the first place.

A solution was recently found, though, because of recently coming across someone else’s article about it (too bad I didn’t bookmark it at the time, or else I’d share it with you) — simply buy a Chromebook, because since Google’s Chrome OS is fundamentally just another version of Linux, that means you can very easily install other versions of Linux on it as well. And Linux is where all the hardcore programmers hang out, so not only is every coding tool on the planet available for it, it was often Linux where they were invented, before only then being inexpertly converted over into Mac and Windows versions.

Part 1 of this series walks through an easy way to get the Ubuntu version of Linux installed on a Chromebook, by first starting up the computer in “developer mode” and then sectioning off just a small temporary slice of the internal drive for the second OS, called “changing the root” or simply “chroot.” (This is not to be confused with “partitioning” an internal drive, where a section of memory is permanently walled off for the second OS, but then with you only able to open one or the other at any given time.) Today, then, we’ll look at the second half of the process, the things you need to install on the Ubuntu side of things to get up and going as a coder.

But first, a few caveats

Before we get into the details, though, a few things to make clear…

  • I’m a beginner at all this — in fact, that’s a big point of this entire blog, that I’m a beginner talking to other beginners as we all muddle through this coding stuff — so some of this information may be incorrect, and some of it may be missing altogether. I’m humble about these mistakes, so please just drop me a line at ilikejason@gmail.com if you see a correction to be made or a step that you think should be added.
  • And for non-coders, be aware that there are many different ways of setting up a “developer environment.” You can think of it much like a blank bedroom: any random human who moves into one is doing so for the purpose of sleeping at night, so the room will in very general terms be devoted to that, but some people have mattresses and others futons, and some people have to worry about an ashtray or medical device being right next to the bed while others don’t, and some people like frilly little lace lampshades and some people like sleek modern steel ones. The suggestions I’m making here are for my particular set-up, some of which may overlap with what you need, but certainly with many, many other things one could be adding that I don’t here.

Ubuntu: Just like Mac or Windows, but cooler and more maddening

So the first thing to understand is that Ubuntu is simply another version of Linux, and that Linux is its own standalone operating system just like Mac or Windows; but instead of one company owning it, it’s an OS that’s free and open to the world, and therefore there have been dozens of versions of it built over the decades to serve hundreds of different purposes. (Like I said, Google’s OS, Chrome, is simply a version of Linux itself, as is its Android OS for their mobile devices, which is why it’s so easy to install other Linux builds on these machines.)

So, you can theoretically run your entire life from your Linux system, just like you currently do from your Mac or Windows or Chrome/Android system; but since there’s so many different versions, and the OS in general is more geared towards tech veterans who already know what they’re doing, there’s not nearly the kind of documentation or help for each version of Linux as there is for Mac and Windows, and of course no warehouse full of experts on the phone ready to help you at a moment’s notice. (Not unless you have some great-uncle at Xerox PARC, that is, who still has long hair in his sixties and “smells like the art teacher.”)

And this is not to mention that just within the Ubuntu version itself, there’s also half a dozen competing builds for a graphical front-end to Ubuntu that you can choose from; for while ideally you’ll be doing most of your work directly at the command-line level, good little coder that you are, it’s always at least nice to have a visual, human-metaphor interface to fall back on as well, at times you’re not feeling like memorizing a thousand commands just to raise the volume of the speakers or to hop over to the search bar. The first time I installed Ubuntu, for example, when I was writing part 1 of this series, I chose the user-friendly but high-memory Unity front-end, just because that’s the default that now ships with every Ubuntu install if you don’t specify a different one; but I accidentally erased the entire chroot the other day, just like I warned in part 1 is frighteningly easy to do, simply by pressing the space bar during one early-morning bootup instead of Ctrl+D to keep the machine running in developer mode. But that was actually great, because it gave me a chance to practice the whole process over again (you’re not a real coder until you’re sick of typing), plus I got to try a different front-end this time, the less intuitive but much faster XFCE.

CLI, SUDO and APT — Oh My!

No matter what version you pick, though, one of the easiest things to find and call up first in Linux is its Terminal program, which creates a “shell” that lets you interact with your PC directly by typing in commands, not using your mouse to slowly go through a visual interface, which is why what you’re using in a Terminal shell session is known as a “command line interface,” or CLI. Plus, unlike the folders and file icons you use when navigating around with Mac or Windows, in the CLI you can give profoundly powerful commands that mess around with the very guts of your computer’s motherboard (which can accidentally destroy your system, which is why you can’t do this just by clicking around with your mouse in Mac or Windows); and that’s done by starting commands with the term…

sudo

…which means “I’m a Super User, so do what I’m telling you.” (No, seriously, that’s what it actually stands for.)

And then finally, CLIs have what are called “package managers,” which is how you install things like new languages, new apps, etc; these all come as a series of hundreds or sometimes thousands of little documents all “packaged” together, and the package manager…er, manages all these packages, so that you only need to type in a single line and the manager does the rest. Like everything else, there are a dozen competing brands of package managers out there; the one that comes default with Ubuntu is APT, which is a particularly good one.

So the very first thing to do once you have Ubuntu installed is to manually check that everything is the newest version; and you do that by typing the following commands into the Terminal app…

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install

And then you can follow that up quickly with whatever things from Ubuntu in general you think you will need as part of your daily interaction with it, regardless of coding needs. I, for example, always want the Ubuntu Software Center on hand (an iTunes-like app the Ubuntu community maintains, for making it easier to find and install software that’s been made for Ubuntu); plus the VLC video player; plus the Google Chrome browser, which in Linux is an open community version called “Chromium;” so that involves typing the following command lines in a row…

sudo apt-get install software-center
sudo apt-get install vlc
sudo apt-get install chromium-browser

Linux and Tor: Libertarian peanut-butter and jelly

And while we’re at it, why don’t we install the Tor web browser too, which Edward Snowden and a whole lot of other people very, very strongly advise you using whenever doing sensitive things on the internet, whether sending romantic emails to your lover or plotting to overthrow a fascist, orange-skinned dictator. It’s much too big a discussion for this particular essay, but Tor is a way of anonymizing the things you’re doing online, so that authority figures can’t figure out which exact human is doing any exact thing on Tor. I personally believe that there are two levels of web security that apply to just about all of us: there is “activist secure,” which is what we usually think of when it comes to these subjects, an NSA-whistleblower or Arab Springite who needs all the hardcore hacker stuff because they’re like a character out of a Neal Stephenson novel; but just because we’re not that doesn’t mean that we shouldn’t be “everyday secure” ourselves, not to an outrageous degree but certainly enough so that angry ex-lovers or manipulative employers (or overly litigious Hollywood corporations for that matter) can’t dig around and find out stuff about us that we would rather they not know. The combination of Linux and Tor is one of the most powerful one-twos out there for people seeking everyday security, the kind that will stop 95 percent of all snoopers; so as long as you have the one now, you might as well have the other.

The only problem? Tor distributes the Linux version in a compressed XZ format, and Ubuntu doesn’t automatically come with a XZ decompressor. So once again you’ll need to first install one…

sudo apt-get install xz-utils

Then to install the Tor browser, you simply go by their website at torproject.org; in fact, it’s such a simple app that there’s no installation involved, simply download the compressed file and then decompress it. To do so once you’ve downloaded it and installed XZ-Utils, type in Terminal…

tar -xf [name of compressed Tor file]

Writing and Committing: Git and Sublime Text

Then next you will need a “version control” app for whatever coding project you’ll be working on; this is software that lets dozens or hundreds of programmers all work on one big project at the same time from their individual PCs, with the app juggling all of these incoming changes and always delivering out a master copy to everyone that reflects them all, sending out error codes to everyone involved if two or more people accidentally change the same line of code at the same exact time. The dominant form of version control software these days is Git, the one you’ll likely use yourself, so installing it is again just a simple matter of typing…

sudo apt-get install git

Next, you’ll need a word processor for actually typing and editing your code, and you can’t use Microsoft Word because it’ll keep trying to add proprietary formatting and other gobblety-gook; I use Sublime Text, for example, which is a happy medium between too-techy and too-beginner-friendly. This also happens to be the first package of this tutorial to not already be included in the APT program, which means you have to first manually designate where it is before you can fetch it…

sudo add-apt repository ppa:webupd8team/sublime-text-2

Then you install it the same way you install everything else…

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

(Oh, and did I mention that you should be regularly typing the “update” command each time you install a new piece of software? You should, because it never hurts.)

But this is far from the only coding-friendly word processor out there; hardcore coders, for example, would scoff at me using something like Sublime, and insist that true coders never use an app that uses a mouse to move a visual pointer into places on a screen where you click. No, dear boy, true coders use a word processor that is interfaced by the keyboard and keyboard alone, so that you never have to remove your fingers from those keys during those 14-hour marathon coding sessions you’re doing instead of having a romantic partner or social life. (I kid, future bosses, I kid.) Two of the most popular are Vim and Emacs, and you install those much like how you’ve been seeing me install everything else today. True coders argue as endlessly about which of these are better as they endlessly argue about whether it’s better to use tabs or spaces in your coding documents.

Pick a language, any language

And then finally — or, well, not finally, but one of the last required things you’ll need — is a build of the particular computer programming language you code in. As a DevBootcamp graduate, for example, I learned Ruby better than anything else, and while you could theoretically install Ruby in Ubuntu the way we’ve been installing everything else…

sudo apt-get install ruby-full

…in this case it will unfortunately install an old, out-of-date version, which means we need to rely on an independent version manager instead. The one we used in DevBootcamp is called rbenv, and you start by installing cURL (software for easily going online and fetching things)…

sudo apt-get update
sudo apt-get install curl

…then installing Node.js (a JavaScript library that helps with many of the web server things that come with Ruby on Rails)…

sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

…and then, using cURL, finally installing rbenv then using that to install the newest version of Ruby and Rails (but see this public tutorial on the 10-step process for doing that).

But what about the databases? WON’T SOMEBODY PLEASE THINK OF THE DATABASES??!!

Like I said, though, that’s far from the only things you can install on your system to get set up as a coder. In DevBootcamp, for example, we had a whole litany of other instructions to go through on our first day: we automated our bash profile, permanently designated our Github name and password, told our Terminal to display in color, and installed Rspec (software for writing tests to show whether our Ruby app was working correctly or not), as well as SQLite and Postgres (two different database systems we used during our time in class, which works in conjunction with a language like Ruby in order to hold users’ actual information). And there are a ton of other things too — we haven’t even mentioned using a different language and web framework, like Python and Django or Java and PHP, or how to install “gems” that are user-created little add-ons for doing cool little weird specialized things in Ruby.

Hopefully, though, this two-part series will give you a really good overview of how to go about setting up the basics of a good IDE on your super-cheap Chromebook, for those like me who find themselves stuck in a situation where they want to be doing a lot of coding on the go, but simply can’t afford those fancy-schmancy little Mac laptops like all our little hipster friends own, and have covered with their fancy-schmancy little indie-rock stickers. Like I said, I encourage all suggestions for corrections or additions you might think would be worth adding to this, so just drop me a line with them to ilikejason@gmail.com. Now get out there and get some coding done!