Raspberry Pi - basic configuration

1. Change source

Switch the download source from the default foreign source of the Raspberry Pi to the domestic Tsinghua University open source software mirror station. The default download source of the Raspberry Pi is a foreign source. Every time you download, you have to obtain resources from across the ocean. The speed is naturally slow. To solve this problem, we can obtain these resources from people who have downloaded these resources in China, for example , Tsinghua University open source software mirror station.
The principle of the domestic mirror station: why it is called a mirror is because the mirror station will keep itself synchronized with the foreign source every once in a while (a few minutes), and maintain the same software resource list as the foreign source, just like looking in a mirror. This article will configure the image of the apt-get package manager on the Raspberry Pi and the image of the python third-party library download tool pip to the domestic mirror station. In addition, many programming languages ​​such as node.js (npm) can also set the domestic mirror image.
In addition to Tsinghua University's open source software mirror site, there are also many domestic mirror sites, such as Alibaba Cloud, Tongji University, Chongqing University, University of Science and Technology of China, Douban, Taobao, etc.
Enter in the command line interface of Raspberry Pi with putty

sudo nano /etc/apt/sources.list

Use the keyboard arrow keys to control, add a # at the beginning of the first line, and then move the cursor to the beginning of the next line after the last line, that is, copy the following content after the last line:

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

First press ctrl+o on the keyboard, then press Enter to save, and then press ctrl+x to exit the nano editor and return to the command line interface. Then enter the following command to update to the latest software list of the mirror source of Tsinghua University.

sudo apt-get update

This command will visit each URL in the source list, read the software list, and then save it locally on the Raspberry Pi.
The above steps have implemented Respbian’s package manager apt-get to change the source to the Tsinghua University software mirror station, and updated the software list. In the future, when you execute sudo apt-get install software name in the command line of the Raspberry Pi, it will be automatically installed from Tsinghua University. Open source software mirror station for high-speed download.

2. Change the source of Python's third-party module installation tool pip

Method 1: Change the source with one line of command

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Note: It is https instead of http, simple must not be less.

Method 2: Configure the source script

Enter and run the following three commands in sequence on the command line of the Raspberry Pi

sudo mkdir ~/.pip
cd .pip
sudo nano pip.conf

Enter the following into the opened file:

[global]
timeout = 10
index-url =  http://mirrors.aliyun.com/pypi/simple/
extra-index-url= http://pypi.douban.com/simple/
[install]
trusted-host=
    mirrors.aliyun.com
    pypi.douban.com

First press ctrl+o on the keyboard, then press Enter to save, and then press ctrl+x to exit the nano editor and return to the command line interface.

3. Internal configuration of Raspberry Pi

Open the Raspberry Pi command line interface and enter commands to enter the Raspberry Pi configuration interface. Use the up and down keys and left and right keys to switch the cursor position.

sudo raspi-config

The first line: Change User Password Change the password
according to the requirements inside and change it to your own password. The default user name is pi, and the password is raspberry. This password will be used for remote ssh login, VNC remote desktop, and input when administrator root authority is required.
The fourth line: Localization Options to select the region
The first line: Change Locale to select the country where you are located. This is a very long list, go to the bottom of the list, put the cursor in front of zh_CN.UTF-8 UTF-8, press space first, then press Enter, return to the previous interface and press Enter again.
The second line: Change Timezone select the time zone where you are. Select Asia, then select Shanghai, and press Enter to confirm.
The fourth line: Change Wi-fi Country to select the wifi country. Select CN China and press Enter to confirm.
Line 5: Interfacing Options enable function
Turn on Camera, SSH, VNC, Serial, Remote GPIO, these functions are the functions we will use in the future.
Camera: camera
SSH: ssh remote communication and login
VNC: VNC remote desktop login
Serial: serial port control
Remote GPIO: remote GPIO pin control
Line 7: Advanced Options advanced settings
○ Select Expand Filesystem to expand the root directory to this SD card, Make full use of the storage space of the SD card
○ Select Overscan to display on the entire screen
○ Select Audio, select Force 3.5mm('headphone' jack), the sound of the Raspberry Pi will be output from the headphone jack
○ Select Resolution, select the default setting, and automatically adjust the resolution 1080x720 according to the display screen.
○ Select Pixel Doubling to increase the desktop display quality.
Select Finish, and a dialog box will pop up asking whether to restart. You can directly press Enter to confirm the restart, or you can wait for the next time Takes effect at startup.

4. Download and install commonly used software

Install Chinese fonts and input methods

Open the Raspberry Pi command line and enter the following command

sudo apt-get install fonts-wqy-zenhei

The sudo in this command line means to use the root authority of the administrator, apt-get means to use the apt-get package manager to download, install means to download and install, and fonts-wqy-zenhei means the software name. After that, all sudo apt-get install software names mean this.

Next, install the Chinese input method fcitx and Google Pinyin input method (it takes about five minutes).

sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin

In the dialog box that pops up, enter y and press Enter ↩ to confirm the download and installation, which requires 90MB of storage space. After the installation is successful, it will take effect on the next restart. You can use ctrl+space to switch to Chinese input method.

Install desktop controls to beautify the desktop

1、conky

sudo apt-get install conky
wget -O /home/pi/.conkyrc https://raw.githubusercontent.com/novaspirit/rpi_conky/master/rpi3_conkyrc
conky

2、wbar

sudo apt-get install wbar wbar-config
wbar

Note: Install conky first, and then install wbar, otherwise conky may fail to install. The wbar command and the conky command must be run under the command line of the Raspberry Pi with desktop. Configure wbar in wbar-config. Check Vertical bar to change the position of wbar.

Install remote desktop login software teamviewer

(Generally, you can skip this step without installing it.)
We have used VNC Viewer on the computer to remotely control the desktop of the Raspberry Pi, but this only applies to your computer or mobile phone and the Raspberry Pi on the same LAN (for example, they are all connected to the same wifi at home). Once the Raspberry Pi is connected to other external networks, the ip address is the ip address under another subnet, which cannot be accessed in the original local area network. In order to solve this problem, people use intranet penetration technology.
The name of this technology sounds lofty, but in essence it is still passing small notes through an intermediate agent. The remote desktop control software teamviewer we downloaded and installed is such a middleman who passes small notes between us and the Raspberry Pi.

To install teamviewer, just execute the following five commands in sequence. When running the second command, it will show that many dependent packages are not installed, don't panic, the third command is used to do this. If a dialog box pops up during command execution, enter y and press Enter ↩ to confirm the download and installation.

wget http://download.teamviewer.com/download/linux/version_11x/teamviewer-host_armhf.deb
sudo dpkg -i teamviewer-host_armhf.deb
sudo apt-get -f install
sudo apt-get install gdebi
sudo gdebi teamviewer-host_armhf.deb

Enter teamviewer info on the command line to view the current version of teamviewer, and select Accept License Agreement in the dialog box that pops up.
If the download fails, go directly to the official website to download the installation package, click the file transfer in the middle of the Raspberry Pi, and transfer the installation package to the Raspberry Pi desktop for installation. On the Raspberry Pi desktop, you can see the teamviewer icon in the upper right corner, click to enter. Then click Grant easy access, log in to your teamviewer account, and set the connection password. Through that string of numbers (1112747434 in the picture), you can let any computer or mobile phone with Internet access in the world control your Raspberry Pi remotely.

Upgrade all installed software

Run the following command to compare the locally installed software with the corresponding software in the newly downloaded software list. If you find that the installed software version is too low, you will be prompted to update it. It may take a long time to execute this command time.

sudo apt-get upgrade

We also ran the sudo apt-get update command just now, now we run the sudo apt-get upgrade command, what's the difference?
update is only to obtain and update the list of downloadable software from the download source, which is equivalent to updating the index map. And upgrade is to update the software itself. The latter takes much more time.

Guess you like

Origin blog.csdn.net/lijiahao1212/article/details/130065814