Chromebook is a browser only, a machine that is premised on using the Internet, It is easy to think that You can actually use it as a simple Linux machine.
** 3 ways to use ** Very ** lightly **, ** fast **. ** Cheap **, ** As a terminal with batteries ** ** Highly recommended as a sub machine **.
In this paper, as a Linux mini / development environment, Starting with the basic usage of Chromebook (for development) ① Python environment as a local Jupyter Notebook (2) Container execution environment that can use Docker-Compose As a construction procedure and command, And write the communication code after that from scratch, Environment construction for super beginners ALL-IN-ONE memo. Recommended for those who want to program in earnest with a Chromebook. (2020/09 first draft created)
HP Laptop Chromebook HP Chromebook x360 12b 12inch 2in1 Convertible Type Intel® Pentium 4GB 64GB eMMC Japanese keyboard (model number: 8MD65PA-AAAC) (Renewal deadline: 2026)
In addition, if it is a small system and the main usage is like an Android tablet, Lenovo IdeaPad Duet Chromebook Is also recommended, but because the keyboard is a cover type The use in the crime shell type is not good, and it is not suitable for development. Also, there is no USBTYpeA, SD card, earphone jack, etc. I felt it was a disadvantage from the viewpoint of expandability, so I excluded it from the candidates.
On the contrary, if you do not use it like an Android tablet, If it is a slightly larger one such as a 14-inch type, the range of performance options will expand.
Personally, the good thing about Chromebooks is It feels like a tablet and is "light" to carry and start. If you use it as a main, 14 inch type is good, if you use it as a sub, There is a touch of 12 inches or less in terms of convenience and versatility even indoors, Is recommended.
Access as below on the browser
Enter the following in the URL field
chrome://system/
Results (partial excerpt)
CHROMEOS_RELEASE_CHROME_MILESTONE
84
CHROMEOS_RELEASE_VERSION
13099.102.0
CHROME VERSION
84.0.4147.127
「Ctrl + Alt + /」 List keyboard shortcuts
「Ctrl + W」 Close the current window
「Ctrl + Shift + V」 Paste the contents of the clipboard as plain text
「Ctrl +Window display key(□||)」 Take a screen capture
「alt + @ 」「alt +「 」 Make Window a fixed size on the left half (or right half) of the screen
「alt+^」 Switching between making the window the entire screen and making it the normal size
It can be installed normally from Google Play. Supported items are displayed (basically most of them are supported) Not all features work at full. The functions around the network seem to be a little unique. This feature is too convenient You should choose a model that can use a touchpad and can be used as a tablet. Like Chrome extensions, but also Android apps Shortcuts will be added in parallel with the ChromeBook apps.
For the time being, it's a good idea to put in the one that is the most basic and has syntax highlighting. Let's put in an editor app called "Text". https://chrome.google.com/webstore/detail/text/mmfbcljfglbokpmkimbfghdkjmjhdgbg
There is also a way to insert VisualStudioCode etc. Anyway, it's "easy and light", so this is enough.
From an application called "File" equivalent to Explorer "Downloaded" file (local file), "Linux (β)" file (terminal mount described later), "Play file" ≒ file as Android, And Google Drive can be accessed transparently. Many files and apps are completed locally, It's not that you can't do it without a Web / network.
A function to operate the terminal of Linux (Debian stretch). Introduced in ChromeOS ver.69 or later.
The clipboard is shared between the Linux side and the chromeOS side, For example, look up the command in the browser on the chromeOS side, Note that the shortcuts are different when trying to Paste. On the chromeOS side, press "Ctrl + C" and not "Ctrl + V". Paste with "Ctrl + Shift (⇧) + V" in the manner of the Linux terminal side. Of course, after starting Jupyter etc. You can write the code on the browser, so you can use "Ctrl + V".
I feel that there is little information, but what you should know is Being able to back up the entire linux environment using the "official" procedure. chromebook official help https://support.google.com/chromebook/answer/9592813?hl=ja You can rest assured if you save the backup directly to Google Drive etc.
By the way, with the Docker image of HackMD after performing all the steps in this article The capacity is about 1.2GB. Probably about 300MB to 400MB on the base.
#Check the terminal version below
cat /etc/debian_version
> 10.1
In addition, with the terminal up The setting screen is displayed by pressing "Ctrl + Shift + p". You can change the color of the theme.
#Python2 is not included, Python3 is included.
# pip/pip3 is not included.
python -V
> -bash: python: command not found
python3 -V
> Python 3.7.3
which pip
>※None
#Download the installer with the following command
curl -O https://bootstrap.pypa.io/get-pip.py
#Important: distuils.If you do not install util in advance, you will get the following error.
# ModuleNotFoundError: No module named 'distutils.util'
sudo apt-get install python3-distutils
# get-Run pip to deploy pip
sudo python3 get-pip.py
#Make sure you have pip
which pip
> /usr/local/bin/pip
pip -V
> pip 20.2.2 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
#I was able to introduce it in one shot.
sudo pip install matplotlib
#A module for Japanese tofu is also included.
sudo pip install japanize-matplotlib
#Also include pandas
sudo pip install pandas
#Also include seaborn
sudo pip install seaborn
#Installation
sudo pip install jupyter
#Start (* Browser starts automatically on chromeOS side)
jupyter notebook
Port forwarding etc. on the terminal side and chromeOS side I was wondering if I had to set it It's easy and convenient because it seems to be directly connected! !!
Create a new Notebook on the launched browser and You can check the communication by executing the following code.
python verification code
##Setting to display graph inline on Jupyter
%matplotlib inline
####Declare the use of required libraries
##Graph drawing library
import matplotlib.pyplot as plt
##Arithmetic calculation library
import numpy as np
##Library that supports Japanese display of matplotlib
import japanize_matplotlib
####Run below
#Draw graph
x = np.arange(0, 20, 0.1)
y = np.cos(x)
#plot
plt.plot(x,y)
#Give a label name
plt.xlabel('Cosine graph')
#display
plt.show()
Even if you don't bother to launch Jupyter on your Chromebook There are enough talks that Colaboratory is fine, There is a place where you can try it lightly locally That's why it's very convenient.
Use the procedure for installing on debian on the official Docker site as it is https://docs.docker.com/engine/install/debian/
While referring to the official website, press "Ctrl + Shift (⇧) + V" If you copy and paste the command, it's almost OK.
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
What is GPG? Is the installer genuine? An encryption mechanism used for verification.
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
Check the CPU architecture information and execute by referring to the x86_64 procedure.
lscpu
#Output ⇒ Architecture: x86_64
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker version
#Output ⇒
# Client: Docker Engine - Community
# Version: 19.03.12
# API version: 1.40
# Go version: go1.13.10
# Git commit: 48a66213fe
# Built: Mon Jun 22 15:45:50 2020
# OS/Arch: linux/amd64
# Experimental: false
With the --rm option Since it can be deleted automatically when the container is closed, You don't have to store finished containers.
sudo docker run --rm hello-world
#output(part) ⇒
# Hello from Docker!
# This message shows that your installation appears to be working correctly.
Similarly, refer to the linux installation procedure on the official website. https://docs.docker.com/compose/install/
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
#Output ⇒ docker-compose version 1.27.1, build 1110ad01
Simultaneous Markdown editor: HackMD server Try to stand up in an instant using Docker-Compose.
#It seems that git is included from the beginning
git clone https://github.com/hackmdio/docker-hackmd.git
cd docker-hackmd
#Start immediately
sudo docker-compose up
#Output ⇒ If the following information appears at the end, it can be started on port 3000.
# info: HTTP Server listening at port 3000
Launch the chrome browser and access the following. http://localhost:3000/
HackMD (Markdown editor that can be used at the same time) in the local environment of chromebook Docker image is now easy to launch and use.
HackMD itself is a very good editing tool for Markdown, so It would be quite useful to use only this normally.
By the way, I saw information that the container cannot be accessed on localhost, For Chromebooks that have been updated with Chrome OS since January 2020, localhost is common in Chrome OS and Linux environment, For containers launched in Linux environment It can be accessed by "localhost: port number".
You can stop the running process with "ctrl + c". Haz that you can no longer access localhost: 3000.
First of all, the Chromebook is easy to handle, and it is recommended that it is "light" both in terms of startup and physicality. It's better to touch a tablet / smartphone than to touch a computer I think there are few psychological barriers, but it can be said that the computer is close to that feeling.
And it is also good that a considerable proportion of software can be used as an Android tablet than expected.
Since the data is basically stored on the cloud side, It is also convenient that there is less time and effort for data linkage as a sub machine.
Furthermore, if it becomes a simple development environment like this article, Don't you feel the loss of having one Chromebook?
I'm glad I got a very "light" development environment!
Even for education, cheap terminals for Windows and Chromebooks are becoming widespread. Even if the first programming environment your child touches is Scratch, I feel that the environment to be touched next will be the environment like this article.
In recent years, the WLS2 environment has been prepared for Windows as well. Regardless of OS such as Windows, Mac, Chromebook It has become possible to develop a linux environment. This was a Mac advantage in the past, It means that Windows and Chromebooks are chasing hard.
Rather, GPU-based machine learning is difficult on Mac, so It can be said that Windows, which can be realized on gaming PCs, has taken a step forward as shown below.
If you want to program, the trend like Mac may change a little. (Although Mac is not bad either)
Of course, this article itself is completed only with Chromebook. (It's natural because I only publish my own memo when I'm trying) If anyone finds it useful, I may update it again.
that's all.
Recommended Posts