将树莓派打造成便携的Linux编译环境

I have a Raspberry Pi 2B+ that has been collecting dust for quite a while. Due to frequent power outages at school, I haven’t used it for running scripts or downloads. However, recently, the SSH connection to the VPS has been dropping due to power/network issues, which has been quite frustrating. So I’ve decided to turn the Raspberry Pi into a portable compiling environment.

Even though my laptop has a dual-boot system with Windows 7 x64 and Linux Mint, it can be annoying when I need both environments. For example, while studying operating systems recently, I mainly needed to test and experiment in Linux. However, it’s undeniable that doing other tasks in Windows is more efficient. Sometimes, I used SecureCRT to connect to a VPS to compile code. But as mentioned earlier, the school frequently experiences power outages, and once the power goes out, there’s no internet—how can I connect to the VPS then? Later, I had a lightbulb moment: I still have a Raspberry Pi that I can use as a compiling environment for some simple code.

More importantly, am I the only one who finds the Linux man command really useful?

The idea is to use the Raspberry Pi to connect to a computer via Wi-Fi, or have the computer connect to the Raspberry Pi’s AP hotspot, and then use an SSH tool to connect. There’s not much technical challenge here; it’s just quite convenient to use that I’ve decided to jot it down.

Let’s get started.

  1. First, you’ll need a Raspberry Pi (obviously).
  2. You need a pre-installed system on a memory card. For specific configuration, check Getting Started with Raspberry Pi.
  3. You need a USB-WIFI or an Ethernet cable (I prefer using USB-WIFI).

The Wi-Fi I’m using is TP-WN823N, with a chip RT8192eu. This Raspberry Pi is plug-and-play, which means you’ll need to compile the driver yourself.

You can first connect via Ethernet cable or use a router to connect the Raspberry Pi and the computer within the same local area network, then use Mstsc to connect to the Raspberry Pi, after which you can set it up in X.

1
2
# Install xrdp to enable mstsc connection
$ sudo apt-get install xrdp

Connect to the AP created by the computer on the Raspberry Pi:

I recommend creating an AP hotspot on the computer and connecting the Raspberry Pi to it because it allows you to clearly see the Raspberry Pi’s IP, making it easier to connect.

Then, use SecureCRT to connect to the Raspberry Pi:
The Raspberry Pi username is pi, and the default password is raspberry.

Connection successful:

Now, install the compiler and editor:

1
2
sudo apt-get install gcc
sudo apt-get install clang

Use SecureFX to manage the Raspberry Pi’s files to conveniently upload code:

Let’s compile some code to test fork:

Use the man manual:

Note: When using SecureCRT, you must change the character encoding to UTF-8 in Options - Session Options; otherwise, Chinese characters will become garbled.

ScreenFetch Screenshot:

The article is finished. If you have any questions, please comment and communicate.

Scan the QR code on WeChat and follow me.

Title:将树莓派打造成便携的Linux编译环境
Author:LIPENGZHA
Publish Date:2016/05/25 09:04
World Count:2.3k Words
Link:https://en.imzlp.com/posts/15989/
License: CC BY-NC-SA 4.0
Reprinting of the full article is prohibited.
Your donation will encourage me to keep creating!