Raspberry Pi. Installing Raspbian OS. Technically optimal control settings Setting the password for the "root" user in the Raspberry Pi

The recommended operating system for the Raspberry Pi 3 is Raspbian. It is her that 90% of all new users of this platform install after purchasing a device. But at the same time, beginners do not always understand exactly how this distribution is installed and what needs to be done after its first launch.

Why Raspbian is the best solution for "Raspberry"

Raspbian is a modification of the popular GNU / Linux Debian distribution. It has many distinctive features from its progenitor. All of them can be found in the official "Wiki" of the project. And here it makes sense to list only the main ones:

  • the ability to work on ARM-processors;
  • the presence of all the necessary drivers in the kit;
  • good optimization for a relatively small amount of RAM;
  • GPIO support out of the box.

Of course, there are other distributions for "Raspberry". But in many of them, they initially do not have the support of the necessary functionality, and they need additional configuration. Raspbian on Raspberry Pi 3, in turn, can work fine right after installation.

What you need to install the OS on "Raspberry"

First of all, you need to consider the question of what is required in order to install Raspbian on the Raspberry Pi 3.

In addition to the board itself, you will also need:

  1. computer and card reader;
  2. 5 Volt power supply and USB / MicroUSB cable;
  3. software set;
  4. USB mouse and keyboard;
  5. monitor / TV;
  6. HDMI cable;
  7. MicroSD-card formatted in FAT32 (speed class - 4 and higher, volume - from 4 gigabytes).

Raspbian installation and configuration process

There are several options for installing Raspbian on a Raspberry Pi 3. The first is to use the NOOBS utility, the second is to write the contents of the image directly to the card. The use of a special application allows you to select the OS. In this case, you just need to install Raspbian. Therefore, it is the second option that will be described.

First you need to download the distribution kit from the Raspbian.org website and insert the MicroSD card into the card reader. Then, using the Win32DiskImager utility (or some other utility with similar functionality), you will need to write the image to a flash drive. This is done easily - the path to the downloaded distribution is indicated; select the letter under which the system mounted the "disk", and then click Write.

When the progress bar is completely full and the program informs about the successful completion of the recording process, you can remove the card from the card reader and insert it into the "Raspberry". Then it remains only to turn on the single-board, having previously connected the monitor and peripherals to it.

Setting up Raspbian after installation

After the RPi is turned on for the first time, it will not boot the desktop, but the built-in Configuration Tool utility. One thing that needs to be done in it is to define a suitable desktop environment. To do this, go to the third point, press Enter and determine the appropriate option from the list. It is recommended to use LXDE as it is a fairly convenient and lightest environment. Then it remains to return to the main menu and click on Done. The system will reboot.

After downloading, she will ask for the access details. The Raspbian standard ones are: login - pi, password - raspbian. They need to be written in small letters.

Once logged in, Raspbian will load the desktop. Now you can use all the features of the system. It may also require additional configuration of Raspbian on the Raspberry Pi 3. To do this, refer to the official system documentation. It should be noted that many of the Debian instructions apply to Raspbian as well.

How can you be sure the answer to the question "how to install Raspbian on a Raspberry Pi 3?" is pretty straightforward. In fact, the process of recording the system for this single board is even easier than installing Windows on a regular computer. Therefore, even a child can cope with this. And the whole process, in turn, takes no more than half an hour of pure time.

The Raspberry Pi quickly became a popular platform for various projects. Low price, relative versatility and openness allows using the board both for amateur purposes and in commercial projects. After we have selected / bought a model and installed, we will start installing the necessary packages

Configuring Sharing Folders in Debian Jessie OS

To set up sharing on the Raspberry Pi on the local network, you need to install the package Samba

Sudo apt-get install samba samba-common-bin

Set the owner for the required folder

Chown -R pi: pi / path / to / share

Change the contents of the configuration file /etc/samba/smb.conf to your own settings:

Comment = WWW Folder path = / var / www create mask = 0775 directory mask = 0775 read only = no browseable = yes public = yes force user = pi #force user = root only guest = no

Change the password used in the SMB session

Smbpasswd -a pi

And restart samba

Service samba restart service smbd restart service nmbd restart

The network folder will be accessed in Network Neighborhood at: \\ RASPBERRYPI \ www or \\ X.X.X.X \ www

Connecting a flash drive to increase additional space

We use fdisk for formatting, mkfs to create a file system. After connecting the media, we check the device in the system

Sudo fdisk -l

The command will show all devices that are connected to our raspberry, for example:
Disk / dev / sda: 16.0 GB, 16013852672 bytes

Run fdisk to format the media:

Sudo fdisk / dev / sda

Sections are deleted with the command d,
created by the team n,
Saving settings - w.

Create an ext2 filesystem on media:

Sudo mkfs -t ext2 / dev / sda1 sudo mount -t ext2 / dev / sda1 sudo mkdir / mnt / flash

We insert our data into the fstab file, for example

Sudo nano / etc / fstab / dev / sda1 / mnt / flash ext2 defaults 0 0

Connecting a WI-FI adapter and configuring a wireless network

Disconnect the LAN cable from the network card and replace it with a wireless wi-fi adapter. Not all models of wi-fi adapters start working automatically. Some require drivers to be installed.
The adapter that worked plug & play in Rasbian is the D-link DWA140 (ID 2001: 3c15 D-Link Corp.). But for the TP-LINK TL-WN727N wireless adapter, the drivers did not automatically connect.
The wireless network is configured using the wpa_supplicant.conf file
Opening the file

Sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

And we prescribe the settings for connecting to a Wi-fi network

Ctrl_interface = DIR = / var / run / wpa_supplicant GROUP = netdev update_config = 1 network = (ssid = "Your SSID Here" psk = "Enter Passkey Here" proto = RSN key_mgmt = WPA-PSK pairwise = CCMP TKIP group = CCMP TKIP)

ssid - the name of the wireless network
psk - network password
proto - WPA2 or WPA encryption type.
key_mgmt - WPA-PSK or WPA-EAP
pairwise - CCMP (WPA2) or TKIP (WPA1)
group - CCMP for WPA2 or TKIP for WPA1

For OS Raspbian jessie in the wpa_supplicant.conf file, it is enough to specify

Network = (ssid = "The_ESSID_from_earlier" psk = "Your_wifi_password")

And restart the interface:

Sudo ifdown wlan0 sudo ifup wlan0

Configuring a static IP address for the wireless interface

Open the network settings file

Sudo nano / etc / network / interfaces

Auto lo iface lo net loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

specify your network settings

Auto lo iface lo net loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.39 netmask 255.255.255.0 gateway 192.168.1.1 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Installing auxiliary system packages

View system information: CPU load, memory, memory size

Sudo apt-get install htop

File manager

mc (Midnight Commander)

Sudo apt-get install mc

Network utility for ping / tracing specified nodes

mtr

Sudo apt-get install mtr

Mail client for working with mail

Sudo apt-get install mutt

Configuring a web server based on Apache

Your own web server will help you practice creating sites, experimenting with settings, plugins, and will save you from crashing the main site.

1. Install Apache and PHP

Sudo apt-get install apache2 php5 libapache2-mod-php5

2. Install MySQL
During the installation process, you must set a password for the root user for the database.

Sudo apt-get install mysql-server php5-mysql

4. Install PHPmyadmin

Sudo apt-get install phpmyadmin

5. Install WordPress

Before unpacking files, set permissions for the folder

Chmod -R 777 / var / www cd / var / www sudo chown pi sudo rm *

Downloading the latest version

Sudo wget http://wordpress.org/latest.tar.gz

Unpack

Tar xzf latest.tar.gz mv wordpress / * rm -rf wordpress latest.tar.gz

Detailed instructions on setting up WordPress can be found.

In order for WordPress to update locally (without using FTP), add the line define (‘FS_METHOD’, ’direct’) in the wp-config.php file; , for example:

/ ** Sets up WordPress vars and included files. ** / require_once (ABSPATH. "wp-settings.php"); define ("FS_METHOD", "direct"); define ("WPLANG", "ru_RU");

If you don't need to install WordPress, then just install the Apache package, place the index.html file in the / var / www folder and the WEB server is ready for use.

Using Raspberry as a Media Player

To turn your Raspberry into a full-fledged networked media player with IP-TV support, you need to install Openelec. There are alternative skins such as OSMC, Kodi.

Openelec can be installed in two ways:
1. We write the Noobs distribution kit to the flash drive, select Openelec at startup. Settings are made using the graphical shell.
2. Or download the distribution kit from the Openelec website and write the image for installation on the media using Win32DiskImager:

Image for RPi First-Generation single-core models (Model A / B / B + 256 / 512MB)

Image for RPi2 Second-Generation quad core models (Model B 1024MB)

CCTV

The most common packages for organizing video surveillance: Motion, Zoneminder. Using Zoneminder requires additional system resources, is difficult to install, so after setting up and adding cameras, system performance will noticeably decrease. The Motion package has a wide range of camera control capabilities without loading the system.

Motion package

Installing a package

Sudo apt-get install motion

Program configuration file: /etc/motion/motion.conf

The main parameters that need to be changed

We fix:
daemon = OFF on daemon = ON
webcam_localhost = ON on webcam_localhost = OFF

The package is launched by the service motion start command

In order to see the image from cameras, you must specify port 8081 after the IP address.
To access the settings, you must use port 8080.

In our example, access to the camera is possible only within your local network. To connect to a video server remotely, you need to configure incoming connections redirection on your home router. If instead of the image on the screen there is a gray rectangle, then you need to check the port to which the webcam is connected. The video capture device configured in the system must match the one specified in the motion.conf configuration file

Raspberry Pi 3 is a miniature, one might say pocket, computer.

All computing power and memory are located on one printed circuit board.

The development was created at the University of Cambridge back in 2006, and the miniature gadget got into mass production only 6 years later.

Initially, the device was planned as a way to attract users from the poorest countries and families to the use of modern computing technology due to its low cost, but the possibilities and scope of operation of the Malinka turned out to be much wider.

Device

The Raspberry Pi of the third generation is an oversized printed circuit board half a notebook leaf in size, on which hinged elements such as an ARM processor, SD slots for external memory, audio output, USB ports and pins for connecting peripherals and a network cable are soldered.

In the third generation of gadgets, Wi-Fi and Bluetooth appeared for data exchange when pairing with other devices without wires and working in wireless networks.

This tiny piece of iron works under the control of a specially sharpened * nix distribution kit.

Moreover, the power of the board is sufficient to play video in low resolution and run old and undemanding games on hardware resources.

Specifications

In technical terms, a microcomputer is device with the following characteristics and features:

  • single-chip system Broadcom BCM2837 with a quad-core ARM Cortex-A53 processor with a clock frequency of 1.2 GHz;
  • graphics accelerator VideoCore IV also from Broadcom;
  • DDR2 standard RAM (1 GB) with a frequency of 900 MHz;
  • unsoldered adapters: 10/100 Ethernet, Wi-Fi, Bluetooth version 4.1;
  • interfaces: 4 USB ports, HDMI output for connecting a visual information output device, CSI, DSI, 3.5 mm audio output, a separate connector for a MicroSD flash card.

What is needed

As you can see, the updated Raspberry Pi 3 with a 64-bit processor is just a computing center, which is nothing without devices for input, output and storage of information, and even without a case, a board with a bunch of elements does not look very good, and it’s not practical.

To start working at a computer, we will definitely need:

  • passive cooling system in the form of copper radiators;
  • body, most popular is acrylic;
  • 5V power adapter (the power supply must provide at least 2A of electric current, however, it is recommended to use an adapter with a current of 2.5A);
  • a microSD flash drive with 8 GB of free space for recording an image with an operating system.

This is with regard to the additional costs for the acquisition of peripherals.

It is also necessary to have a mouse and / or keyboard with a USB port or connected via Bluetooth, which will be much more convenient.

To display the image, you need a small display with an HDMI interface.

The presence of a Bluetooth and Wi-Fi module is really convenient, because half of the USB ports do not have to be occupied by corresponding adapters at a price of $ 5, which is a significant waste compared to the cost of the computer itself.

Appearance

The microcomputer is classically delivered in a miniature cardboard box made in white and red tones, where on the front side, in addition to the name of the device, flaunts the forest sweetness, in honor of which it was named.

All of this is wrapped in a bubble gouge antistatic bag.... Inside the box there is additionally a brief safety note and a certificate of paper.

"Malinki" are produced by a British company RS Components with partners and Chinese Element14. Depending on the manufacturer, the corresponding logo is applied to the packaging, and the board - "Made in UK" or "Made in PRC".

Running

Step 1. First of all care should be taken to cool the printed circuit board and the elements applied to it, for which you need to install radiators.

The Chinese make them from aluminum, copper and ceramics (because this is more affordable and cheaper, albeit ineffective).

Better to opt for a copper (or copper-plated) cooling system, since the thermal conductivity of copper is higher than that of aluminum.

Basically, any radiator is suitable, but it is better to spend money on the one recommended by the manufacturer, especially since the processor, when running synthetic tests, can warm up to the boiling point of water.

A couple of the supplied pieces of hardware are intended for the GPU chip and USB, one of which powers the computer.

A small copper plate is attached to the outside of the RAM.

Step 2. Power... Asians produce power supplies specifically for the device, connected to it via a microUSB connector.

And it should be remembered that this PC is quite demanding on the energy resource.

If there is insufficient current, the Raspberry Pi 3 will start, but it will work slowly and with brakes, and when there is generally trouble with power, most likely it does not even start.

Also, performance problems may arise due to the use of an economical flash card with a speed class below ten or problems with a USB cable.

A shortage of power is signaled by a yellow lightning bolt icon located in the corner of the screen.

Step 3. Assembling the case- the next stage before starting the microcomputer.

It will be unpleasant if the board burns out from a discharge of static electricity or is mechanically damaged (shock, fall, spilled coffee, etc.).

The body is made of a stainless tin with a bunch of milled holes or plexiglass and is a set "assemble it yourself": top and bottom walls and four sides.

Software part

Everything is ready to launch. It remains to install the operating system.

A huge selection of OS is available for the device based on * nix however, it is better to follow the developer's advice and stick with the Raspbian distribution (takes up less than 2 GB).

The developer recommends using NOOBSfor OS deployment, but it should only be used if you want to have a couple of systems.In addition toRaspbian is available in 9 more official operating systems, including those based on Windows 10, as well as about three dozen unofficial distributions.

The operating system is pretty nice, it is stable and supports basic functionality.

After installation, we start the system and set the password for the root: sudo pass

We choose 5 - change the language. After replacing the interface, it will become very simple to work.

You should also update immediately. In the console, enter:

sudo apt-get update then sudo apt-get upgrade and reboot.

Sometimes "raspberry" incorrectly detects the resolution, adding black stripes at the edges of the picture.

This can be fixed as easy as shelling pears:

sudo leafpad in the boot / config.txt file remove the # sign in the disable_overscan = 1 line by uncommenting it.

Work

We proceed to the most interesting thing - checking the operability of the pocket computer by connecting it to a small monitor and information input devices.

At first glance, everything works smoothly: windows move and collapse smoothly, no artifacts.

We open as many as five tabs in the browser, one of them with video, the rest with pictures and animation - everything is smooth.

We launch the browser version of Minecraft - no lags, the same with Quake III; Team Arena - Works great.

Due to the fact that the Internet browser is equipped with the function of hardware acceleration of videos from Youtube, any video in resolution up to 480p is reproduced perfectly, problems already begin with 720p. The animation does not play at all, the built-in decoder is not designed for it, but most normal people do not need it.

Presentations in office programs also do not lag and play smoothly.

conclusions

Purchase of a low-power pocket computer for ~ $ 40, capable of:

  • play video at 480p;
  • cope with all office tasks;
  • work with five open tabs in the browser (if no more than two of them have a video or game running);
  • cope with "light" and old games -

Agree, a good idea not only for residents of third world countries.

The PC runs on an operating system tailored for programming learning - it has preinstalled environments for Python and Java. The Raspberry Pi 3 also supports GPIO-connected peripherals.

This resource explains how to install a Raspberry Pi operating system image on an SD card. You will need another computer with an SD card reader to install the image.

Alternative distributions are available from third-party vendors.

If you "re not using balenaEtcher (see below), you" ll need to unzip .zip downloads to get the image file (.img) to write to your SD card.

Note: the Raspbian with Raspberry Pi Desktop image contained in the ZIP archive is over 4GB in size and uses the ZIP64 format. To uncompress the archive, a unzip tool that supports ZIP64 is required. The following zip tools support ZIP64:

Writing an image to the SD card

You will need to use an image writing tool to install the image you have downloaded on your SD card.

balenaEtcher is a graphical SD card writing tool that works on Mac OS, Linux and Windows, and is the easiest option for most users. balenaEtcher also supports writing images directly from the zip file, without any unzipping required. To write your image with balenaEtcher:

  • Download the latest version of balenaEtcher and install it.
  • Connect an SD card reader with the SD card inside.
  • Open balenaEtcher and select from your hard drive the Raspberry Pi .img or .zip file you wish to write to the SD card.
  • Select the SD card you wish to write your image to.
  • Review your selections and click "Flash!" to begin writing data to the SD card.

Note: for Linux users, zenity might need to be installed on your machine for balenaEtcher to be able to write the image on your SD card.

Computers based on the Raspberry Pi single board hardware platform are becoming more and more popular. If earlier they were bought mainly by engineers and computer specialists, now they are purchased by many amateurs for home experiments and electronic crafts. Such a computer is controlled by a Linux-based operating system (usually Ubuntu or its derivatives). By default, the network in this operating system is configured so that when Raspberry Pi is connected to a local network (which is usually controlled by a router), each time it is dynamically assigned a new IP address thanks to the configured DHCP protocol. This is not always convenient. Therefore, it is best to configure a static IP on the Raspberry Pi.

This is done simply. If you know the address of your router through which the LAN is organized - great, if not, then in the terminal we type the command:

Netstat -r –n

This displays the routing table. Looking at the Gateway column, it should display the current IP address of your router. Typically, on home networks, this is either or. Let this be the first address in my example. We remember or write it down.

In order to configure the network manually on the Raspberry Pi through the console and make a static IP - enter the command:

Sudo nano / etc / network / interfaces

In the opened config, look for the line "iface eth0 inet dhcp" and erase it. Instead, write the following:

Iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1

I think that the meaning of the lines is clear, but I'll explain a little. In the line "Address (Address)" you need to enter the IP from the subnet of the router, the main thing is that it is not already occupied by some other device. The mask in 99% of home networks is 255.255.255.0, in the line "Gateway" the address of the router itself is indicated to show the system that all traffic should be, as it were, "run" through this host.

Then press the key combination "Ctrl + X" to exit the editor. At the request to save the file, you will first have to press the "Y" button, and then - "Enter". The network service must be restarted to apply the changes. This is done with the following command:

Sudo / etc / init.d / networking restart

If the system suddenly generates an error, then open the file again and check the correctness of the addresses entered.
The network setup on the Raspberry Pi is complete.

Note:

On the latest releases of the Raspbian JESSIE operating system, the config of the network card from / etc / network / interfaces is not readable and obtaining an IP address is only automatic. It is not clear what the developers were guided by, but now it has become much more difficult to prescribe statics. One solution is to kill the DHCP client daemon. Of course, you can, but there is another option suggested by the author of the homeless.su blog - to correct its configuration in the /etc/dhcpcd.conf file.
We open it through the nano editor:

Sudo nano /etc/dhcpcd.conf

Scroll it to the very bottom and add this:

Nodhcp interface eth0 static ip_address = 192.168.1.10 / 24 static routers = 192.168.1.1 static domain_name_servers = 192.168.1.1

Of course, the addresses must be registered from your network. We reboot our Raspberry Pi and check if the static address is working.

Bluetooth