Raspberry Pi using Profile

You need the following things:

A Micro SD memory card
with an SD card reader for writing system image to a Micro SD card, power supply sources. We are using an older Android phone charger, you need a 5V micro USB port charger for its power supply.
If you are not the normal display with HDTV, you need an HDMI cable to the HDMI-DVI converter. If your monitor supports HDMI television or if you intend to use to connect, then you can save a converter.
USB keyboard and mouse interface,
an Ethernet cable

optional equipment:
for protection Raspberry Pi box
in addition to the keyboard and mouse, if you intend to connect more USB devices, you need a USB Hub hub.
What we use in this article:
a Model B Raspberry Pi
a 16GB Class 10 SanDisk Ultra SDHC Memory Card (standard transfer rate is 300MB / s)
a original charger for the HTC Inspire old
Logitech K260 Wireless Mouse (two piece only one receiver, therefore occupies only one USB port)
a RJ-45 cable

set
when you put above everything is ready, we can begin to set up Raspberry Pi

will Raspbian image into the Micro SD card
Raspberry Pi has been out for some time, because of this, whether you are using Windows, Mac OS X or Linux, there are several ways to write the image Raspbian your Micro SD card. However, in order to make the article does not become article describes the various image-writing software, we will show the most commonly used method for everyone to see: We will write the system comes with the dd utility in OS X and Linux, while in Windows, we will use a tool called Win32DiskImager be.

To make the process gets simple, we advise you before starting operation, first download folder empty. Then, download Raspbian.zip from here. Inside, choose to download the latest Raspbian. Of course, you can also choose to use BT to download, in order to allow others to continue to use BT download, we recommend that you continue to upload after the download is complete.

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

If you empty before the start of your download folder, so now there should have two files, type "ls" to confirm whether there is a img suffix with a zip file suffix, respectively, as shown below:

 

 

 

Then begin to extract from the image file written to a Micro SD card, it is a pity that this operation is not directly copying the file card that simple. First of all, before we put Micro SD card into your Mac, take your computer to find out the status of the partition. If you can not wait to insert the card into it, then put it is safe to remove it.

Enter "df -h" in a terminal window, you should see results like this

 

 

 

Now insert your Micro SD card, and then just run a command, you will find more than a "/ dev / disk1s1" devices. First down to it, it will use while wait a little longer to convert it into the original device name.

 

 

 

Next, you need to first uninstall the card system, in order to "dd" This tool can write the image to the Micro SD card. In the terminal window type "sudo diskutil unmount / dev / disk1s1", then enter your system password.

 

 

 

If the operation is successful, you will see that the last lines: "Volume XXX unmounted" The XXX is the name of your Micro SD card. Now we can ever write to the image on the card.

Just remember to let down your device name of it? Now is the time to use it. Your device name (eg / dev / disk1s1) last s1 removed, and then in front of the disk plus r, becomes "/ dev / rdisk1", ​​so you get a raw device name of the Micro SD card.

In other words, "/ dev / disk1s1" = "/ dev / rdisk1". understand?

Enter the following command in the terminal: "sudo ddb s = 1m if = 2012-06-15-wheezy-raspbian.img of = / dev / YOURDISKNAME". The YOURDISKNAME into your original device name, usually this is / dev / rdisk1.

 

 

 

The process takes a little time to write. When the "dd" completed its work, the desktop icon is dragged into the Micro SD card to the Recycle Bin to remove the Micro SD card safe.

Preparatory work is complete! Directly to the "First start your Pi" part of it.

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

If you are using Linux

No matter which one you use release of Linux, "dd" This tool is usually installed by default. For the next operation, we assume:

1) Your sudo program has been set up properly, and you know how to use it

2) already installed on your Linux fdisk tool (Most distributions are installed by default)

Here we use is the most popular Linux distribution Ubuntu, where "dd", "fdisk" is installed by default, and "sudo" has also been pre-configured for the user as well.

First, download the latest version from here Raspbian archive. Similarly, you can also choose to use BT download. After you download is complete, the first action is to extract the natural.

Open a terminal window and use the "cd ~" command to change the working directory to your home directory. Enter "unzip imagename.zip", will be replaced imagename name of the file you just downloaded.

If you can not find just downloaded archive, you can try using "cd ~ / Downloads /" into the download directory to find.

 

 

 

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

 

 

 

Note the listed devices: After you come to run the command with the results shown above should be very similar

Seen here, / dev / sda is a device 250.1GB size, and / dev / sdb is a device of 15.9GB. Obviously, / dev / sdb is our Micro SD card. Look at / dev / sdb shown below partition: / dev / sdb1 and / dev / sdb2, we want these two partitions from the system uninstall before writing the image:

sudo umount /dev/sdb1

sudo umount /dev/sdb2

 

 

 

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

 

 

 

If you see a terminal with a display similar to the above text, then write has been completed. Now, you can skip the "First start your Pi" section to continue reading.


If you are using Windows

If you are using Windows systems, there is a small tool called Win32DiskImager can help you get the job done. After download it, then Raspbian images downloaded from here. Remember to choose the latest version of Raspbian.

When you put Win32DiskImager and Raspbian image files are downloaded, unzip them all out. You can put all the files are extracted to a desktop file folder, making it easy to do next.

Your Micro SD card into your card reader, look at the card reader drive letter on your computer. After the card reader to the computer, just open the extract from the Win32DiskImager program:

 

 

 

在启动时,Win32DiskImager可能会提示以下错误:(至少在Windows 7中是这样的)

 

 

 

这个错误可以忽略掉,点OK继续

 

 

 

点击右边的蓝色文件夹图标,然后选中刚才解压出来的Raspbian映像文件。确保最右边Device中的盘符为你读卡器的盘符。

打开映像文件以后,点Write,然后点一下Yes确定操作。整个写入过程需要一些时间来完成。

 

 

 

写入完毕以后,你会看到下面的信息,这时你就可以把你的Micro SD卡安全移除了。

 

 

 

 

初次启动你的Pi

初次启动Raspberry Pi时,你会看到一个叫做raspi-config的配置工具。如果在日后使用过程中你需要更改这些设置,你可以通过在Pi的命令行中运行raspi-config来使用这个工具。在这里,你需要进行一些最基本的设置来继续使用你的Pi。

 

 

 

首先,我们要选择expand_rootfs。它的作用是将刚才写入到Micro SD卡中的映像文件大小扩展到整张Micro SD卡中。如果你使用的是一张较大的Micro SD卡(例如16GB),那么你肯定像充分利用上面的空间。因为原本的映像只有大约2GB的大小,进行该操作就能将它扩展到与你的Micro SD卡同样的大小。

选中expand_rootfs选项,然后按下回车。你会看到如下提示,只需要再按一下回车就可以回到raspi-config的主菜单中。

 

 

 

接下来就是overscan选项。你会发现,屏幕显示的图像并没有完全占用你的显示器空间;所以,最后就是将overscan禁用掉,来让系统充分利用整个屏幕。但如果你的屏幕显示没有问题,那么你就可以跳过这个步骤。假设你需要禁用overscan,那么将overscan选项选中后按下回车。

接下来的画面能够让你选择禁用(Disable)或者是启用(Enable) overscan。如果你在往后使用的过程中更换显示器或者电视机,你或许需要重新启用overscan。

 

 

 

接下来,我们要确保我们的键盘正常工作。Raspbian默认的是英国键盘布局,而我们在中国使用的键盘布局与美国的相同,因此我们要对它进行更改才能正常使用。

选中configure_keyboard,然后按下回车。下面显示的画面中你会看到一个很长的列表,里面都是不同的键盘类型。你可以根据你的需要来选择,或者直接选择Generic 105-key (Intl) PC键盘。

 

 

 

 在选择键盘类型以后,你需要为它选择一个键盘布局。刚开始显示的列表中,都只有英国的键盘布局,但是我们现在要选择美国的键盘布局,因此我们选中其他(Other),然后再里面的列表选择English (US)。

 

 

 

 

 

 

然后你会被问到关于辅助键的问题,选择默认的选项,并且在下一个画面中选择No compose key选项。同样,如果你需要更改这个设置,可以使用raspi-config来更改。

最后一个选项为是否打开CTRL+ALT+BACKSPACE的组合键。它可以在你的图形界面崩溃时,不需重启而将图形界面进程结束掉。

回到主菜单,下一步我们要设置一个用户密码。

 

 

 

选中change_pass然后按下回车。一个确认窗口弹出以后,在屏幕的底下会提示你输入一个新的UNIX用户密码。

 

 

 

到这里就差不多完成了。接下来设置你的“区域”,这个主要会决定系统使用的字符集和语言。同样,如果你不想使用英国英语,那么你可以在这里更改这些设置。在演示中我们选择的是美国英语,因此我们选择en_US.UTF-8,并下翻列表将en_GB选项剔除

 

 

 

再下一个对话框中会让你选择默认的区域,选择你刚才选的区域然后按回车继续。

回到raspi-config的主菜单,设置适当的时区。选中change_timezone选项然后按下回车。你会先看到一个地区列表。

 

 

 

选择一个地区,然后下一个菜单中会显示该区域的具体位置。

 

 

 

再次回到主菜单,剩下还没选过的选项我们可以忽略,直接点击完成(Finish)。系统会提示你,一些变更需要重启才能生效。重启以后,你会看到一个登录界面,如下:

 

 

 

在这里,用户名为”pi”,密码就是你刚才设置的UNIX用户密码。

使用你的Raspberry Pi

现在,你已经登录到了你之前设置的Raspberry Pi中了。你要做的第一件事,就是在命令行中输入”startx”来进入图形界面,以下我们会把这个界面称之为“窗口管理器”。

 

 

 

屏幕快速闪烁几次后,你应该会看到如下画面:(除了那个终端窗口以外)

 

 

 

欢迎使用LXDE窗口管理器。LXDE是一个非常轻量级,并且功能齐全的图形界面,它能够很好地运行在Raspberry Pi中。如果你从来未使用过LXDE,别担心,它用起来跟Windows非常相似。点击最左下角的图标,你会看到一个应用程序列表。

现在能干嘛呢?

当你把Pi配置完成,并且打开了LXDE窗口管理器以后,你就得到了一台运行完整 Debian的Linux机器了。在这个时候,你可以使用Midori来浏览网页,架设一个网页服务器,或者是进行一些平常的工作。

但首先,我们要谈的是Raspberry Pi本身最注重的方面:教育。特别是,软件开发教育

在Raspberry Pi上撰写你的第一个程序

Raspbian中预装Python,它是Raspberry Pi的官方编程语言,还有IDLE 3,一个Python的集成开发环境(IDE)。我们将会教你如何使用IDLE在Raspberry Pi上写一个简单的程序。

在学习一门新的编程语言时,通常第一件事都是写一个”Hello World!”的小程序。接下来我们要教你的跟这个也差不多,不过要比它稍微花哨一些。这是一个会问你的名字,然后作自我介绍的Python程序。

首先,直接双击LXDE桌面上的图标来打开IDLE 3

 

 

 

点击文件 > 新窗口,就会出现一个可以让你输入文字的空白窗口。

输入以下内容到你的新窗口中:

#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!')

如下图:

 

 

 

现在,点击文件 > 另存为,然后将你的文件保存为”hello”,点击保存。

现在就可以运行你刚才写的程序了!

点击运行 > 运行模块,或者直接按F5键。

当IDLE 3窗口中提示你”Hello, I’m Raspberry Pi! What is your name?”的时候,输入你的名字然后按下回车。你会看到Raspberry Pi对你做出回应。

 

 

Guess you like

Origin www.cnblogs.com/SkystarX/p/12286026.html