Put Linux in your Chromebook and use R ...

Suddenly, I'm starting R! ・ ・

While proceeding with the verification of MemSQL, we were able to confirm the cooperation with Zoomdata and Excel (pretending to be MySQL), so the next story is to pretend to be MySQL and cooperate with the depth analysis system. I will play with R, which is famous as an engine. (I heard that R can also be applied to AI and machine learning ...)

Well, what should I put in ...

R itself is a famous thing, so if you download a package that can be used for free via the public homepage, you will be able to use it without much problems ..., from the idea of extremely short circuit history Efforts have begun, and we have started by improving the environment to build that environment.

Physical or virtual? ??

First of all, we need to decide on a container for this grand project. As a platform, you have to decide whether to go directly to the physical environment or to some virtual environment. Some ** made in Akihabara ** systems are already blocked by MemSQL and Zoomdata, and other machines are already reserved for another verification ...

What should I do···

**That's it! I've heard that you can virtually introduce Linux to your Chromebook! ** **

With the extremely short-circuited and impulsive idea, I decided to start building this basic platform. In fact, considering the usage situation this time, we will do normal mail and presentation work with a Chromebook linked to the cloud, and while playing around with it, we will build an environment that allows total replacement of the worst environment, and the situation after the beginning of the year If you build it on the back side of the Chromebook on the premise that you can carry around the work in consideration of ... ## You can also work with Starbucks ## ... (Self-centered work style reform ..) With a prompt decision I'm ready to build an environment.

This Chromebook

I pulled out the ** LCD screen "only" ** selected by Google's Chromebook (it is said to be), the 2015 model Pixcel Book, and the specs "Why this is the Chromebook" I was surprised at that time (m7, 16GB memory ... but SSD is 64GB ...), so I asked him for his final service.

First of all, preparation in advance ...

The environment is basically in the cloud, so first mercilessly switch to developer mode. I think that this method has many reports of blood, sweat and tears on the net by many other ancestors, so if you follow the method in order, you will be in the forbidden developer mode. I think we can reach it. (Preliminary work to enter developer mode and work after mode change is at your own risk)

The important point here is to enter with Ctr + D first after switching modes! So don't forget this spell. (It will come up on an unfamiliar screen, but I think this is like a stepping stone to clarify the story of responsibility (after that, at your own risk))

Now, virtualization ...

Next, by switching, it is a method to mix normal Chromebook use and Linux + R environment to be introduced this time ... I heard that the barrier to support for Linux environment has become very low in recent Chromebooks. From that direction ... maybe ... crispy! I thought, but it is difficult to implement it with the Chromebook that I brought out this time. .. It turned out that ... Hey, it's true that I was a little confused by the fact that this hardware specification was made by your company ... but I will learn R! With the slight embers of passion and the hope that "someone will do the same thing ...", I mobilized all the assumed keywords and searched the experiences of the ancestors on the net, and found that it was a virtual ** crouton **. (?) There is an environment, and I was able to meet the existence of a light of hope if I started Linux in that environment and built R.

Introducing crouton and Linux

I've heard that introducing this environment is a very famous method in the Chromebook world, so I think that many seniors' reports have already been posted on the net. So, this time, did you simply enter which command for the above-mentioned hardware in what order to reach the environment where the originally intended R can be used? !! I would appreciate it if you could make it a memorial report focusing only on.

(0) Download crouton

Once in the Chromebook in developer mode (** Ctrl + d ** where the yellow! Mark appears), download the crouton package from the link below.

https://goo.gl/fd3zc

It will be in the Downloads folder by default, so open a terminal with ** Ctrl + Alt + t ** and type ** shell ** at the prompt to change the mode. (If you get an error here, you haven't switched to developer mode normally, so start from there again. Also, at this stage, you will be required to set password and encryption key information, so please respond accordingly (these information will be confirmed when you start up the Linux environment later). It will be information)

(1) What can be selected in the Linux environment? Confirmation of

This was actually a very important point in this work as well. Can crouton select any OS now? Is, in a sense, information that influences all subsequent work, so you need to check that information first.

sudo sh ~/Downloads/crouton -r list

Then, the supported Linux code name will appear at that timing, so select the supported one from them. (At the time of writing this report, there was ** xenial ** in ubuntu system, so I will introduce it)

Regarding the actual introduction, I tried some patterns to make the best use of the experience of my seniors, and finally this description fits neatly.

sudo sh -e ~/Downloads/crouton -r xenial -t xfce-desktop,keyboard,touch,audio,extension,chrome -e

Reference URL: https://qiita.com/toumasuxp/items/f7c10ab2b9405aa3170d

(2) Work after successful introduction

I think that the installation work will take a long time, so I have no choice but to wait for the setting work for a while. After the installation is completed successfully, you will have the login ID, password, etc. set, so if you process them quietly, you will be able to get the "first" environment.

At this point, all you have to do is launch your Linux desktop and "look closely" from the terminal window.

Via the terminal launched earlier on the Chromebook side

sudo startxfce4

If installed successfully, the screen will change and the Linux desktop will appear. Open a terminal window on that desktop and update the promised Linux environment.

sudo apt update
sudo apt upgrade

・ ・ ・ ・ Well, if you look at the mask calmly ... Yes! In this situation, the desktop is in English environment, so follow the steps below to introduce the Japanese environment.

sudo apt -y install language-pack-ja
sudo update-locale LANG=ja_JP.UTF8

When this work is completed, the Japanese language pack and locale settings will be set to Japan, so restart the Linux environment you are installing. As a point to keep in mind at this time, since you will exit the crouton environment once, from the terminal on the Chromebook side again ...

sudo startxfce4

Please start with.

sudo dpkg-reconfigure tzdata
sudo apt -y install manpages-ja manpages-ja-dev

With this work, I think that you can build the time zone (if it has been introduced successfully, it has already been set) and the rest of the Japanese manual environment. t1.png It seems that you have successfully translated it into Japanese.

Finally the introduction of R environment

Select R that matches the version of ubuntu installed in the crouton environment this time. Since this Linux is ubuntu xenial ...

xenial:ubuntu16.04

The information came out via the net, so hurry up and look for an R package that can fit this version. The place has mirror information

https://cran.r-project.org/

Select from the Japanese site

https://cran.ism.ac.jp/bin/linux/ubuntu xenial/

Was the download source for this time.

First of all, from the promised work ...

First of all /etc/apt/sources.list Add the following line to the file:

deb https://cran.ism.ac.jp/bin/linux/ubuntu xenial/

Make the promised gpg system settings.

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

Introduce the required environment.

sudo apt-get update
sudo apt-get install r-base

When the installation is completed successfully, enter ** R ** from the terminal and the basic engine of R will start up. I think that a basic investigation can be carried out as it is, but in consideration of future developments, we will create an environment where we can do a little more advanced things.

sudo apt-get install r-base-dev

This operation may end without any processing due to the message that the environment required for the above ** r-base ** installation has already been installed, but it is a confirmation meaning just in case. We will also work with it. T3.png It seems that R has started to move safely.

Introduction of Rstudio

Basically, I think that the R verification environment will start working in the steps up to this point, but this time I will introduce Rstudio in anticipation of subsequent development.

First introduction of gdebi

Since gdebi is used for installation, install this environment in advance.

sudo apt-get install gdebi-core

Check the latest information on Rstudio and enter the following command. At the time of writing this report, ** rstudio-1.2.5033-amd64.deb ** was the latest version, so use that information to get the required packages.

wget https://download1.rstudio.org/desktop/xenial/amd64/rstudio-1.2.5033-amd64.deb

If you can download it successfully, install it with the ** gdebi ** command.

sudo gdebi -n rstudio-xenial-1.0.153-amd64.deb

If it is installed successfully, you will be able to start Rstudio. t2.png

If you fail to install the environment on crouton ...

When I was verifying the environment construction with various patterns, I encountered a situation where several patterns of failed modules were accumulated, and I investigated various ways to clean this environment ... (force a specific folder) There seems to be a way to delete it as a target, but ...) I was able to avoid it with the following command, so I will introduce it as reference information.

sudo delete-chroot -a

The point is that in the case of this command, all the areas managed by chroot will be deleted, so please be careful when executing it. (Crouton itself seems to be like "making it absent" by eradicating the environment that is not used ...)

Future plans

With the above procedure, ubuntu (xenial) was installed via crouton, the desktop was deployed in a Japanese environment, and R and R studio were successfully installed. Depending on the environment configuration, there may be cases where this report does not make sense, but in that case, please search for the experience of a great ancestor and make appropriate corrections and changes. By the way, you can go back and forth between OSs in the environment built this time with ** Ctrl + Alt + Shift and the arrow keys ** usually located at F1 and F2.

** Let's use MemSQL Vol.10: Practical edition 3 **

Recommended Posts

Put Linux in your Chromebook and use R ...
[Linux] How to put your IP in a variable
How to use pyenv and pyenv-virtualenv in your own way
Put Jupyter and Docker Compose on your Chromebook and use it as a light development environment!
Put only kubectl in Amazon Linux 2
Hashing data in R and Python
Create your own Linux commands in Python
I put Alpine Linux in Larkbox and made it my home server
Easily use your own functions in Python
Put your own image data in Deep Learning and play with it
I put Linux (Ubuntu) in VAIO SX14.
R: Use Japanese instead of Japanese in scripts
Put Tkinter in Macbook and check operation
Install rJava on Linux in R3.6 environment.
How to use is and == in Python
Use Python in your environment from Win Automation
Don't use readlines () in your Python for statement!
An app that you must put in Linux
Put Python3 in Docker container of Amazon Linux2
Use a free GPU in your favorite environment
Why use linux
How to use Docker to containerize your application and how to use Docker Compose to run your application in a development environment
UClibc daemon and pthread_create that fit in embedded Linux
Beginners! Basic Linux commands and how to use them!
Create Amazon Linux with AWS EC2 and log in
Include and use external Kv files in Python Kivy
Use the CASA Toolkit in your own Python environment
% And str.format () in Python. Which one do you use?
Get your current location and user agent in Python
Try to put LED in your own PC (slightly)
How to use Decorator in Django and how to make it
Automate Chrome with Python and Selenium on your Chromebook
Check the type and version of your Linux distribution
I want to use the R dataset in python
[Python] When you want to import and use your own package in the upper directory