Saturday, December 2, 2017

Installing Crouton and R-Studio on a Chromebook for Beginners Pt 2: Crouton

Crouton

So now you're in developer mode because you're a programming beast and you have taken control of your own destiny. Congratulations.

The next step in getting to the ultimate goal of running R-Studio is to install Crouton, which creates a Linux interface within your chromebook with all (or at least most) of the functionality of a completely independent Linux machine. You can download what you need to install Crouton here, and they do have basic installation instructions available there. Coming into this with basically no programming background, though, I found myself searching all over the place for better instructions to help me get set up the right way and avoid the dreaded error messages.

After a lot of trial and error and a few power washes to undo what I'd tried, I found this blog with a detailed, seemingly thorough explanation of setting up a Chromebook with Crouton in order to install and run programs like R-Studio. I'll do my best to go through the steps that I took to get my machine set up, but this will be a good resource for anyone interested in installing other programs as well.

The first step is to download the newest version of Crouton here.

Next you need to open a terminal on your chromebook (called Crosh), using Ctrl+Alt+T in a browser window. As it initially opens, this terminal allows you to change settings and perform certain functions within the Chrome OS, a lot of which you can apparently do without going into developer mode (Here's an article that describes some of the commands you can use here). The very first command you'll give in order to install Crouton is
shell
which is the reason why we're in developer mode and will give you access to your computer outside of the Chrome OS.

Next we need to install Crouton to create a "chroot" with all of the options and extensions that we want. A "chroot" is what they call the Linux interface that we're creating, of which you can have many. I'll go through what all the parts mean in just a moment, but here is the command string that we can use for this:
sudo sh ~/Downloads/crouton -t core,xiwi,keyboard,x11,cli-extra,extension,xfce
This command has all sorts of extras and extensions that are probably unnecessary for our immediate needs, but the source that I ended up using for my code was setting up a user to do a variety of developer tasks within Crouton, and I figured I'd rather have this all set up now and not have to go back later to add it when I need it.

The very first part of the command, sudo, is used to give you access to the root system of the computer, meaning that you can make changes to basically anything. Once you're in Linux, this will prompt you to give a root password and will allow you to make changes to the inner workings of your computer. If you went against my recommendations and "Enabled Debugging" when you were setting up in developer mode, Crosh will ask you for the root password here (presumably to comply with the sudo command) and I wish you the best of luck in figuring out what that password may be. If you didn't enable debugging, Crosh doesn't ask for a password and simply starts the install.

The next part, sh, tells your computer that the following string needs to be interpreted by the shell before it can be executed, meaning that it is not a command in itself. ~/Downloads/crouton identifies the item you are accessing by name and location. The rest of the string is particular to Crouton and all of the information your computer needs to know this is internal to the Crouton package that you downloaded.

-t tells your computer that the following items are "targets" within the Crouton package that you would like to have installed. These are all of the options, extensions, extras, etc. that will affect how your chroot runs. Here are brief explanations of each of the targets included in this installation as described in the Crouton help section, with some interpretations from me in italics:
core      Performs core system configuration. Most users would want this.
xiwi      X.org X11 backend running unaccelerated in a Chromium OS window. Allows your chroot to run like an app/program within your Chrome OS
keyboard  Adds support for Chromebook keyboard special keys.
x11       X11 via autodetected backend. Does not install any desktop environment.
cli-extra Basic CLI tools such as ssh.
extension Clipboard synchronization and URL handling with Chromium OS. Allows you to copy and paste between your Chrome OS and your chroot
xfce      Installs the Xfce desktop environment. This is the part that gives you the visual and functional Linux environment

There are more targets available, which you can see using the command
sh ~/Downloads/crouton -t help
inside your shell. There are also additional parameters available, some of which are listed on the github website for Crouton. Some popular ones are:
-r       which tells your computer which version of Ubuntu (the Linux platform) to install. At the time of this publication, the default version that gets installed is Xenial
-e       which encrypts your chroot
-n       which gives your chroot a specific name, necessary when you have multiple chroots

The installation process takes anywhere between 15 and 30 minutes to complete, but once it's done you're ready to open your chroot! There are various ways to do this, but the simplest way that I've found is using the command
sudo startxfce4
This brings you to your full screen Linux environment, which you can manipulate just like a program or app window within your Chrome OS.

Congratulations! The next step is to get into the Linux terminal and install R and R-Studio, as seen in Part 3.

No comments:

Post a Comment

English Syntax Trees and Question Creation with Flex and Bison

In the first (official) semester of my PhD program this spring, I was able to take a Computer Science class called NLP Methods in which we m...