[Multiple images] RaspberryPi, a cheap mini Linux machine

Source: Internet
Author: User
Tags rs components raspi win32diskimager

Earlier this year, Raspberry Pi was just released, and the credit card-sized mini Linux machine became popular instantly. On the evening of its launch, the website of the Pi program's official distributors, Premier Farnell/element 14 and RS Components, was almost inaccessible. Today, you can finally get a Raspberry Pi in three weeks. It is the most popular Linux device this year. if you are ready to start with one, the following article will show you how to set it.


What is Raspberry Pi?

At the beginning, Raspberry Pi was launched as a development model to attract more developers to the community. However, on the evening of the release, all dealer websites received numerous demands for the product. If you are one of the lucky winners of the first batch, you may be surprised or totally disappointed when you receive it.

If you think Pi has very poor performance, you may regard it as another item when buying it. First, we need to recognize what kind of device Raspberry Pi is: it is mainly used for educational purposes and designed for amateurs and young people who want to learn programming. It is not intended to replace the high-performance Linux desktop in the home.

With a very small amount of memory of 700 MB and a MHz ARM-11 processor that is slower than your mobile phone processor, you can see why Pi pricing is so low. Remember, Pi is mainly used to provide an affordable hardware platform with the most basic functions for people in need of education. Model B also provides two USB interfaces, HDMI output and 10/100 adaptive Ethernet ports. If you need audio output, you can use the on-board 3.5mm jack or the HDMI interface that supports audio output. Raspberry Pi claims that its GPU computing capability reaches 1 Gpixel per second, 1.5Gtexel per second or 24 GFLOPs, and complies with the OpenGL 2.0 standard. In other words, its graphic capabilities match the graphics capabilities of the first-generation Xbox.

In this article, we will show you step by step the configuration of Raspberry Pi Model B, and run Raspbian, a Debian-based Linux system.

Buy a Raspberry Pi


To support the Raspberry Pi fund, we recommend that you purchase Model B Raspberry Pi: Premier Farnell/element14 or RS Components from one of the two distributors for $35.

You also need the following:

? One SD memory card

? An SD card reader used to write the system image to the SD card

? Power supply source. We use an old Android phone charger. you need a 5 V micro USB interface charger to power it.

? If you are using a normal monitor instead of a HDTV, you need an HDMI cable with a HDMI-DVI converter. If your monitor supports HDMI or you want to connect to the TV, you can skip the converter.

? USB interface keyboard and mouse

? An Ethernet cable

Optional devices:

? Box used to protect Raspberry Pi

? In addition to the keyboard and mouse, if you want to connect more USB devices, you need a USB Hub.

What we use in this article:

? One Model B Raspberry Pi

? A 16 GB Class 10 SanDisk Ultra SDHC memory card with a transfer rate of 300 MB/s)

? An old charger originally used for HTC Inspire

? Logitech K260 wireless mouse and mouse set (two devices use only one receiver, so only one USB port is occupied)

? One RJ-45 cable

Set

When you have everything above, we can start to set the Raspberry Pi.

Install the Raspbian image to the SD card

Raspberry Pi has been out for a while, and that's why, whether you are using Windows, Mac OS X, or Linux, there are several ways to write Raspbian images to your SD card. However, to prevent this article from being an article about writing various images into software, we will show you the most common methods: in OS X and Linux, we will use the dd tool that comes with the system, while in Windows, we will use a tool named Win32DiskImager.

If you are using Mac:

To simplify the process, we recommend that you clear the downloaded folder before you start. Then download raspbian.zip from here. Select the latest Raspbian to download. Of course, you can also choose to use BT for download. in order to allow others to continue using BT for download, we recommend that you continue uploading after the download is complete.

After extracting the compressed file, you will get the Raspbian image file. in this case, open the terminal window. If you are using OS X 10.7 or later, you can find the terminal window from the tool (10.7) or other (10.8) in the application. After opening, use "cd ~ /Downloads to enter the download folder.

If you cleared your download folder before you start, there should be two files in it now, enter "ls" to check whether there is an img suffix and a zip suffix respectively, for example:


The next step is to write the extracted image file to the SD card. Unfortunately, this operation is not as easy as simply copying the file to the card. First, we need to figure out the partition status of your computer before inserting the SD card into your Mac. If you can't wait to plug the card in, remove it safely first.

Enter "df-h" in the terminal window and you will see a result similar to this:


Now, insert your SD card and run the command again. you will find an additional device named "/dev/disk1s1. Write it down first, and it will be used when you convert it into the original device name.


Next, you need to unmount the card from the system so that the "dd" tool can write the image to the SD card. Enter "sudo diskutil unmount/dev/disk1s1" in the terminal window, and then enter your system password.


If the operation is successful, you will see that XXX in the last line: "Volume XXX unmounted" is the name of your SD card. Now we can write images to the card.

Do you remember the device name you just wrote down? Now is the time to use it. Remove the last s1 of your device name (for example,/dev/disk1s1) and add r to the disk to "/dev/rdisk1 ", in this way, you will get the original device name of the SD card.

That is, "/dev/disk1s1" = "/dev/rdisk1 ". Do you understand?

Then enter the following command in the terminal: "sudo ddb s = 1 m if = 2012-06-15-wheezy-raspbian.img of =/dev/YOURDISKNAME ". Change YOURDISKNAME to your original device name, which is usually/dev/rdisk1.


The write process takes a little time. After "dd" completes its work, drag the SD card icon on the desktop into the recycle bin to safely remove the SD card.

The preparation is complete! Go to the "start your Pi for the first time" section.

Our prep work is finished! Skip ahead to "Booting your Pi for the first time ."

If you are using Linux

No matter which version of Linux you are using, the "dd" tool is usually installed by default. For the following operations, we assume that:

1) your sudo program has been properly set and you know how to use it

2) you have installed the fdisk tool in Linux (most releases are installed by default)

Here we use Ubuntu, the most popular Linux release version, where "dd" and "fdisk" are installed by default, and "sudo" is pre-configured for users.

First, download the latest version of Raspbian. You can also download the SDK using BT. After the download is complete, the first operation is to decompress the package.

Open a terminal window and use "cd ~" Command to change the working directory to your home directory. Enter "unzip imagename.zip" and replace imagename with the name of the downloaded file.

If you cannot find the downloaded package, you can try to use "cd ~ /Downloads/"to go to the download directory.


Next, determine the device name of your SD card in the system. Insert your SD card and enter "sudo fdisk-l" in the terminal ".


Note that the listed device: the result after you run the command is similar to the one shown above.

Here we can see that/dev/sda is a 250.1GB device, while/dev/sdb is a 15.9GB device. Obviously,/dev/sdb is our SD card. Leave the partitions shown below/dev/sdb:/dev/sdb1 and/dev/sdb2. we need to unmount these two partitions from the system before writing the image:

Sudo umount/dev/sdb1

Sudo umount/dev/sdb2


Next, we use "dd" to write the image file to the SD card: "sudo dd bs = 1 M if = 2012-08-16-wheezy-raspbian.img of =/dev/sdb ". The operation is the same as that in Mac. this process takes some time to complete.


If you see that the terminal displays text similar to the surface, the writing is complete. Now, you can go to the "start your Pi for the first time" section to continue reading.

If you are using Windows

If you are using a Windows system, a tiny tool named Win32DiskImager can help you do this. After downloading it, download the Raspbian image from here. Select the latest version of Raspbian.

After downloading the Win32DiskImager and Raspbian image files, decompress them. You can decompress all the files to a folder on the desktop to facilitate subsequent operations.

Insert your SD card into your card reader and pay attention to the drive letter of the card reader on your computer. After the card reader is connected to the computer, open the unzipped Win32DiskImager program:


At startup, Win32DiskImager may prompt the following error: (at least in Windows 7)


Ignore this error. Click OK to continue.


Click the blue folder icon on the right and select the extracted Raspbian image file. Make sure that the drive letter in the rightmost Device is the drive letter of your card reader.

After opening the image file, click Write and then click Yes to confirm the operation. The entire write process takes some time to complete.


After writing, you will see the following information, and then you can safely remove your SD card.


Start your Pi for the first time

When you start Raspberry Pi for the first time, you will see a configuration tool named raspi-config. If you need to change these settings later, you can use this tool by running raspi-config in the command line of Pi. Here, you need to make some basic settings to continue using your Pi.


First, select expand_rootfs. It expands the size of the image file written to the SD card to the entire SD card. If you are using a large SD card (such as 16 GB), you must make full use of the above space. Because the original image size is only about 2 GB, this operation can extend it to the same size as your SD card.

Select the expand_rootfs option and press enter. You will see the following prompt, just press enter to return to the main menu of raspi-config.


The next step is the overscan option. You will find that the images displayed on the screen do not fully occupy the space of your monitor. Therefore, you can disable overscan to make full use of the entire screen. However, if your screen shows no problem, you can skip this step. If you want to disable overscan, select the overscan option and press enter.

The following screen allows you to select either Disable or Enable overscan. If you change the monitor or TV set later, you may need to enable overscan again.


Next, make sure that our keyboard works properly. Raspbian uses the British keyboard layout by default, and the keyboard layout we use in China is the same as that in the United States, so we need to change it for normal use.

Select configure_keyboard and press enter. The screen shown below shows a very long list of different keyboard types. You can choose either based on your needs or directly select the Generic 105-key (Intl) PC keyboard.


After selecting the keyboard type, you need to select a keyboard layout for it. Only the British keyboard layout is displayed in the list at the beginning, but now we want to select the American keyboard layout, so we select Other (Other ), then select English (US) for the list ).



Then you will be asked about the secondary key, select the default option, and select the No compose key option in the next screen. Similarly, you can use raspi-config to change this setting.

The last option is whether to enable CTRL + ALT + BACKSPACE. It can end the GUI process without restarting when your GUI crashes.

Go back to the main menu and set a user password.


Select change_pass and press enter. After a confirmation window pops up, you will be prompted to enter a new UNIX user password under the screen.


It's almost done here. Next, set your "region". This mainly determines the character set and language used by the system. Similarly, if you do not want to use English, you can change these settings here. In the demo we chose American English, so we chose en_US.UTF-8 and went down the list to remove the en_GB option.


In the next dialog box, select the default region, select the region you just selected, and press enter to continue.

Return to the main menu of raspi-config and set the appropriate time zone. Select the change_timezone option and press enter. You will first see a region list.


Select a region and the location of the region is displayed in the next menu.


Return to the main menu again. we can ignore the remaining options that have not been selected. click Finish ). The system will prompt you that some changes must be restarted to take effect. After the restart, you will see a logon interface, as shown below:


Here, the user name is "pi", and the password is the UNIX user password you just set.

Use your Raspberry Pi

Now you have logged on to the Raspberry Pi you set. The first thing you need to do is enter "startx" in the command line to enter the graphic interface. below we will call this interface "window manager ".


After the screen flashes several times, you should see the following screen: (except the terminal window)


Welcome to the LXDE window manager. LXDE is a lightweight and fully functional graphical interface that can run well in Raspberry Pi. If you have never used LXDE, don't worry. it is very similar to Windows. Click the icon in the lower-left corner to view an application list.

What can I do now?

After you complete Pi configuration and open the LXDE window manager, you will get a Linux machine running the complete Debian. At this time, you can use Midori to browse the web page, set up a Web server, or perform some common work.

But first, we will talk about the most important aspect of Raspberry Pi: education. In particular, software development education.

Write your first program on Raspberry Pi

Python is pre-installed in Raspbian. it is the official programming language of Raspberry Pi, as well as IDLE 3, a Python integrated development environment (IDE ). We will teach you how to use IDLE to write a simple program on the Raspberry Pi.

When learning a new programming language, usually the first thing is to write a "Hello World !" . Next we will teach you something similar to this, but it is a little more fancy than it. This is a Python program that will ask you for your name and introduce yourself.

First, double-click the icon on the LXDE desktop to open IDLE 3.


Click File> new window. a blank window is displayed, allowing you to enter text.

Enter the following content in your new window:

# My first Python program

Username = input ("Hello, I'm Raspberry Pi! What is your name? ")

Print ('Nice to meet you, '+ username + 'have a Nice day! ')

For example:


Now, click File> save as, save your file as "hello", and click save.

Now you can run the program you just wrote!

Click run> run module, or press F5.

When the IDLE 3 window prompts you "Hello, I'm Raspberry Pi! What is your name ?" Enter your name and press enter. You will see the Raspberry Pi responding to you.


Summary


Your first Raspberry Pi program is really easy. You can use the Python language to write many very powerful software. We recommend that you participate in their Python tutorials on the official Python website to learn more. Even a 7-year-old child can write a game on the Raspberry Pi. I believe you can.

When you are tired of learning Python, you may want to relax and play some old games. You can configure your Pi as an MAME arcade simulator and connect it to your TV. Even if the game is exhausted, you can install an XBMC on it. Pi supports playing p Full HD videos and connects them to a high-definition TV. it is still not a big problem to act as a media center. Of course, if you only want a Linux machine that is so cheap as $35, Raspberry Pi can also be your choice. You will find that it brings you a lot of joy-it is an endless possibility for a hacker. We expect more Pi programs to appear in the coming months, especially after the announcement of Gertboard. I hope this article will bring you a little bit of interest in this powerful gadgets. you may wish to buy one to play!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.