Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Banana Pi Cookbook

You're reading from  Banana Pi Cookbook

Product type Book
Published in Jun 2015
Publisher
ISBN-13 9781783552443
Pages 200 pages
Edition 1st Edition
Languages
Author (1):
Ryad El-Dajani Ryad El-Dajani
Profile icon Ryad El-Dajani

Chapter 2. Administration

This chapter will cover the following recipes:

  • Determining the IP address and hostname

  • Connecting via SSH on Windows using PuTTY

  • Connecting via SSH on Unix-like systems

  • User maintenance

  • Searching, installing, and removing the software

  • Updating the operating system

  • Wireless network on the Banana Pro

Introduction


In this chapter, we will get to know the tricks of administrating the Banana Pi. Administration can be a difficult task as a lot of factors must be considered. However, we will go along this journey step by step. We will begin this chapter by connecting to the Banana Pi via a remote shell. This way, you will be able to administrate the Banana Pi from another computer on your local network. You will see that it will become a very convenient way of working with the device. You will not have to attach a keyboard and display directly to the Banana Pi anymore. Fortunately, the very basic service (that is the OpenSSH server) is configured on almost all Linux-based distributions for the Banana Pi by default. Therefore, you will only need to install and configure an SSH client onto your computer to connect to your Banana Pi remotely.

Determining the IP address and hostname


To connect to your Banana Pi via your local area network, you will need to know the IP address or the hostname of your device.

This recipe shows you how to find out the IP address and hostname of your Banana Pi.

Getting ready

The following components are required for this recipe:

  • A Banana Pi running a Linux system connected to your local network

  • A configured SD card containing a Linux distribution

  • A keyboard, mouse, and display attached to your Banana Pi

How to do it…

Perform the following steps to determine the IP address:

  1. Initiate the booting of your Banana Pi and wait for the desktop to appear.

  2. Start a terminal application such as LXTerminal.

  3. Type in the following ifconfig command:

    $ ifconfig eth0
    

    This will output all the information of your Ethernet device (eth0), including the IP address, subnet mask, MAC address, and some additional information. The IP address is the value after inet addr:XXX.XXX.XXX.XXX (for example, 192.168.0.2).

    Note

    Do not confuse inet...

Connecting via SSH on Windows using PuTTY


The following recipe shows you how to connect to your Banana Pi remotely using an open source application called PuTTY.

Getting ready

For this recipe, you will need the following ingredients:

  • A booted up Linux operating system on your Banana Pi connected to your local network

  • The PuTTY application on your Windows PC that is also connected to your local area network

How to do it…

To connect to your Banana Pi via SSH on Windows, perform the following:

  1. Run putty.exe.

  2. You will see the PuTTY Configuration dialog.

  3. Enter the IP address of the Banana Pi and leave the Port as number 22 as shown in the following screenshot:

    Note

    In the previous screenshot, we use the destination IP address of the Banana Pi, which we determined in the last recipe. Indeed, you need the correct IP address or hostname of your Banana Pi.

    Tip

    Some routers that support DHCP have an address reservation feature. This way, you can assign your desired IP address to your Banana Pi forever.

  4. Click on...

Connecting via SSH on Unix-like systems


In this recipe, we will connect to the Banana Pi using SSH on Linux or other Unix-like operating systems such as Mac OS X or FreeBSD. You probably have installed the required OpenSSH client already.

Getting ready

You will need the following ingredients to connect to your Banana Pi using SSH:

  • A booted up Linux operating system on your Banana Pi connected to your local network

  • A PC or Mac running a Unix-like operating system that has the OpenSSH client installed and is also connected to your local area network

How to do it…

To connect to your Banana Pi, you only need to perform the following steps:

  1. Open an arbitrary terminal program of your operating system.

  2. Type in the following ssh command into your shell:

    $ ssh -l bananapi 192.168.178.37
    

    Note

    In the previous command, we use the destination IP address of the Banana Pi, which we determined earlier. Indeed, you need the correct IP address or hostname of your Banana Pi.

  3. When trying to connect for the first time...

User maintenance


Most Linux distributions for the Banana Pi come preconfigured with a default username and password. The login information is published on the download website for the operating system images (see Chapter 1, Installation and Setup).

In almost all cases, the credentials are:

Username

Password

bananapi

bananapi

You might want to create your own user on the system. At the very least, it is highly recommended you change the default password of the default user. This recipe explains the necessary tasks.

Getting ready

The following ingredients are required to create or delete users and to change their passwords:

  • A booted up Linux operating system on your Banana Pi

  • SSH connection if you plan to do the user maintenance remotely; however, in most of the upcoming recipes, you can do the user maintenance directly on Banana Pi

How to do it…

We will split this recipe into adding a user, changing a password, and deleting a user.

Adding a new user

We are going to use the useradd and the...

Searching, installing, and removing the software


Once you have your decent operating system on the Banana Pi, sooner or later you are going to require a new software. As most software for Linux systems is published as open source, you can obtain the source code and compile it for yourself. However, this can be a difficult task and we will cover it in later recipes.

One alternative is to use a package manager. A lot of software is precompiled and provided as installable packages by the so-called repositories. In case of Debian-based distributions (for example, Raspbian, Bananian, and Lubuntu), the package manager that uses these repositories is called Advanced Packaging Tool (Apt).

The two most important tools for our requirements will be apt-get and apt-cache.

In this recipe, we will cover the searching, the installing, and removing of software using the Apt utilities.

Getting ready

The following ingredients are required for this recipe.

  • A booted Debian-based operating system on your Banana Pi...

Updating the operating system


This recipe explains how to update your Linux operating system using the apt-get program.

Updating (or upgrading) the Linux system is important, still quite simple. Almost every day, the community improves the software that is used on Linux systems. Some updates are just for new features while others are incredibly important. Think of the dangerous Heartbleed Bug in the widely used cryptography library OpenSSL in April 2014.

Therefore, distribution upgrading is highly recommended on a regular basis but at least once a month.

Getting ready

The following ingredients are required for this recipe:

  • A booted Debian-based operating system on your Banana Pi

  • An Internet connection

How to do it…

Upgrade your whole Debian-based Linux distribution by performing the following steps:

  1. Connect to your Banana Pi remotely or open a terminal on the desktop.

  2. Type in the following command into the shell:

    $ sudo apt-get update
    
  3. If asked to type the password for sudo, enter the user's password...

Wireless network on the Banana Pro


This recipe explains how to configure a wireless network on the Banana Pro.

Getting ready

The following ingredients are required for this recipe.

  • A Banana Pro with the wireless LAN antenna attached

  • An SD card containing the Raspbian operating system for the Banana Pro

  • An attached keyboard, mouse, and display to configure WLAN via the desktop

  • Alternatively, an SSH connection to configure WLAN manually

To attach the WLAN antenna, flip your Banana Pro, and carefully plug in the antenna into its slot beneath the Micro SD slot. The following image shows the Banana Pro and the wireless LAN antenna plugged in correctly:

How to do it…

We need to do two things to configure the wireless network.

Loading the ap6210 module

The wireless LAN interface depends on a special module named ap6210. The following are the steps to load this module:

  1. Open a shell.

  2. Load the module by typing:

    $ sudo modprobe ap6210
    
  3. Type the following command to list all the currently loaded modules:

    $ lsmod...
lock icon The rest of the chapter is locked
You have been reading a chapter from
Banana Pi Cookbook
Published in: Jun 2015 Publisher: ISBN-13: 9781783552443
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}