Jul 4, 2020

Building a development environment on Raspberry Pi 4

I bought the 8GB memory version of the Raspberry Pi 4 Model B that I've always wanted.

Gyazo

The Raspberry Pi 4 itself has been available from 2019, and so far the memory is available in a choice of 1GB / 2GB / 4GB.

The SoC for the RazPi 4 is Broadcom 2711, and the CPU is Cortex-A72. It seems that this CPU is a product that ARM has put out to the world with a lot of confidence, a high-performance core designed to compete with the Core M processor Apparently.

And to my surprise, that RazPi 4 came out with 8GB of memory. Maybe the specs are much better than a bad PC from a developer's point of view?

So I built a development environment with RazPi, and I'll leave notes how to build it.


OS setup


I had a hard time deciding what OS to use, but I decided to go with Ubuntu. The Raspberry Pi OS (formerly was called Raspbian, but the name was changed before I knew it) is still 64bit version had not been officially released, but Ubuntu has released a 64bit version of 20.04 LTS The fact that it was there was the deciding factor.
(As of 06/27/2020)

Prepare SD card - OS flash

For flashing the OS to the SD card, I used the Raspberry Pi Imager.


Gyazo

I remember that creating an OS image and flashing it to the SD card used to be a bit of a hassle, but Now there's this handy tool available.

Select the desired OS and SD card, and then...


Gyazo

Gyazo


Press the "WRITE" button and then just wait.

Gyazo

Done in 10 minutes or so.

Gyazo


By the way, the only version of Ubuntu that is compatible with RazPi is the Server version. And the desktop environment If you need to use Ubuntu as desktop, you need to build it separately. I chose Ubuntu MATE this time, but I'll tell you about building a desktop environment later.


Boot & Initial Setup

When the SD card is ready, insert it to the RazPi and turn it on to boot the OS. If successful, you will be asked for ID/Password, and both ID/Password will be "ubuntu". You'll be asked to enter a new password, so you can set any password you want.

$ login: ubuntu
$ current password: ubuntu
$ new password: {your new password}
$ retype password: {your new password}

After putting it in the Shell, do an update on the package just in case.

$ sudo apt update
$ sudo reboot


Setting up an Ubuntu MATE desktop environment

$ sudo apt install ubuntu-mate-desktop

Because a huge package is installed, I have to wait considerably. It was waited for about 20 minutes though it depends on the communication speed. After the installation is completed, if you reboot the shell, the GUI will start next.

Don't forget to select MATE because there is a menu to select the GUI at the password input screen!

Gyazo


Gyazo

If a desktop like this is launched, it's a success.


Install the necessary tools

Chromium Browser

I couldn't find regular Google Chrome built for 64-bit ARM. So, I use raw Chromium Browser for the time being. Because this can be obtained with apt, it is easy to install.

$ sudo add-apt-repository ppa:canonical-chromium-builds/stage
$ sudo apt update
$ sudo apt install chromium-browser

VS Code

The ARM 64bit binary for Ubuntu is not available on the official MS VS Code DL page. But I found a community-built version. It is not official binary, please understand risk with your own.

sudo -s
 . <( wget -O - https://code.headmelted.com/ installers/apt.sh )


You can start it by "$ code-oss".

On Macs and Windows, you can often start the VS Code with `$ code`, so you can create an alias. It's useful to have it on hand.

alias code='code-oss'

Look and Feel is not different than any other OS.

Gyazo

anyenv

Basically, you can install it in the same way as any other OS
$ git clone https://github.com/riywo/anyenv ~/. Anyenv

Add the following code in `.bashrc`.
 if [ -d $HOME/.anyenv ]
 then
     export PATH="$HOME/.anyenv/bin:$PATH"
     eval "$(anyenv init -)"
 fi

$ source ~/.bashrc
$ anyenv install --init
$ anyenv install nodenv
$ anyenv install pyenv

Other necessary tools

$ sudo apt install nautilus
$ sudo snap install docker

I've never heard of `snap` before.
`snap` allows you to install by one command. It's great.


Check memory usage

The following is a result of meminfo when just after the Desktop is started after OS boot. It seems to use about 1GB for OS.

 ubuntu@ubuntu:~$ cat /proc/meminfo
 MemTotal: 7998780 kB
 MemFree: 6362440 kB
 MemAvailable: 6919404 kB

Then, for now, I have launched the application needed for development and check the memory consumption again.
Chromium for two google accounts, three Tabs each, FireFox, VS Code. And I checked meminfo with Terminal, you will get the following result.

 ubuntu@ubuntu:~$ cat /proc/meminfo
 MemTotal: 7998780 kB
 MemFree: 3844584 kB
 MemAvailable: 5325472 kB

What a surprise, I only used about half of it.


Thoughts


It's crisper than I expected, and it runs more crisply than Ubuntu MATE on Hyper-V of the Surface Laptop 3.
The tools I usually use for development, there doesn't seem to be any discomfort. As of the Heavyweight IDE such as Android Studio and Eclipse, I don't know how it works, because I haven't tried it.

It is an amazing world that I can get such a high performance machine for around 100USD. When my child grows up a little more, I want to buy it and play with it.

Then, I made the development environment, but I think that Mac and Win machines are more comfortable to develop. RazPi becomes a gadget to play with LED Lighting...

And if you're playing with LED Lighting, you're going to have to use Raspberry Pi OS instead of Ubuntu. The dilemma is that  Raspberry Pi OS is more convenient to configure the hardware. However, the good thing about RazPi is that you can easily go back and forth between operating systems by just replacing the SD card.

I'm going to use the  LED Lighting + Scratch environment to teach kids the basics of programming. I have a lot of electronic components and breadboards left over, hahaha.

2 comments:

  1. CASINO HOTEL - MapyRO
    Find Casinos & Hotels in 동해 출장안마 Hanover, OH near 계룡 출장샵 Casino at 1 Casino Parkway 경주 출장안마 in 태백 출장마사지 Hanover, OH. See reviews, photos and maps. 구리 출장샵

    ReplyDelete
  2. No deposit casino bonuses - DrMCD
    Find out if you can get all the latest no 양주 출장안마 deposit casino bonuses. 전라북도 출장안마 The best no deposit casino bonus codes 의정부 출장샵 2021. 하남 출장안마 Best bonus deals of 2021. 여주 출장마사지 Best no deposit bonus

    ReplyDelete