Chapter 3

Setting Up Raspbian

Before you can use your Pi you must set it up. You can change the password, select a keyboard layout to match the keyboard you are using, set a time zone, and set up the memory card. Optionally, you can also overclock the Pi so it runs faster.

Set a Password

Select a Keyboard Layout

Select a Time Zone

Manage Memory and SD Card Options

Set Up Overclocking

Connect to the Internet

Revise the Configuration

Update the Operating System

Launch the Desktop

Shut Down the Pi

Set a Password

The first time the Pi boots, a Setup Options screen, also known as the Configuration tool, appears. On this screen, you can change your Pi's basic settings, including your user password. The default username is pi, and the default password is raspberry.

You can shorten the password to a single letter for convenience or choose a much longer password for security. You cannot set a blank password or disable the login prompt.

Select a Password

001.eps Boot up and wait until the Setup Options screen appears.

9781118768198-fg0301.tif

002.eps Press 9781118768198-arkdn.tif to position the red highlight on the Change User Password option and press 9781118768198-ent.tif.

Note: You can also press 9781118768198-arkrt.tif to highlight <Select> and press 9781118768198-ent.tif.

Note: Because the Pi's software is always being updated, your Pi may not show the same setup options in the same order.

9781118768198-fg0302.tif

003.eps Press 9781118768198-Ent.tif again.

9781118768198-fg0303.tif

A The Pi shows a prompt at the bottom of the screen.

004.eps Type your new password and press 9781118768198-ent.tif at the prompt.

Note: The password does not appear on the screen as you type.

The Pi asks you to enter your password again.

005.eps Type your new password again and press 9781118768198-ent.tif.

A message appears saying your password changed successfully.

9781118768198-fg0304.tif

006.eps Press 9781118768198-ent.tif to return to the Setup Options screen.

Select a Keyboard Layout

You can use the Setup Options to localize your Pi so it produces the letters and characters printed on the keys.

This step is recommended. If you do not understand a setting, leave it unchanged. If your keyboard produces incorrect characters, run Setup Options again (explained in the section “Revise the Configuration” later in this chapter) and check online for the correct settings for your hardware and local language. You may need to try various combinations until you find one that works.

Select a Keyboard Layout

001.eps On the Setup Options screen, press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Internationalisation Options and press 9781118768198-ent.tif.

9781118768198-fg0305.tif

002.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Change Keyboard Layout and press 9781118768198-Ent.tif.

003.eps Wait until the Pi loads the keyboard configuration page.

Note: This screen appears after about 15 seconds. The Pi seems to be doing nothing while it loads.

9781118768198-fg0306.tif

A The Pi displays a list of keyboard makes and models.

004.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select your keyboard model and press 9781118768198-ent.tif.

Note: If you cannot see your keyboard or do not know which one to select, select Generic Keyboard for the United States or Generic Keyboard (Intl) for the United Kingdom.

The Keyboard Layout screen appears.

9781118768198-fg0307.tif

005.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select a keyboard subtype on the list and press 9781118768198-ent.tif.

Note: The default option is usually correct. Select a Macintosh keyboard layout if you are using an Apple keyboard.

006.eps Press 9781118768198-arkrt.tif and 9781118768198-Ent.tif to skip the AltGR and Compose Key screens.

9781118768198-fg0308.tif

007.eps Press 9781118768198-Ent.tif to select the option to use Control+Alt+Backspace to quit the Pi's desktop if it is running.

After 10 seconds, the Pi returns you to the Setup Options screen. The new keyboard layout is now set.

Select a Time Zone

You can use the Time Zone option to set how your Pi displays the time and date, and how it manages Daylight saving time (Summer time).

Note that the Pi does not have a full built-in clock. It uses a “fake” clock that loads the time from the Internet. If you do not connect your Pi to the Internet, the clock will be wrong. You cannot use the Time Zone setup option to set the time.

Select a Time Zone

001.eps On the Setup Options screen, press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Internationalisation Options and press 9781118768198-ent.tif.

9781118768198-fg0309.tif

002.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Change Timezone and press 9781118768198-ent.tif.

After a few seconds, the Pi displays the Geographic Area screen with a list of continents.

9781118768198-fg0310.tif

003.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select your region and press 9781118768198-ent.tif.

The Time Zone screen appears with a list of time zone regions.

9781118768198-fg0311.tif

004.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select your nearest city or region and press 9781118768198-ent.tif.

9781118768198-fg0312.tif

A The Pi displays a message confirming that the Time Zone has changed, and then it returns you to the Setup Options screen.

Manage Memory and SD Card Options

Memory is limited on the Pi. You can change two settings to make the most of the Pi's built-in memory and the free space on the SD card.

The Expand Filesystem option reformats your SD card to make all of its space available for storage. By default, storage is limited to 2GB, even on larger cards. This option expands it to make full use of the card. The Memory Split option in Advanced Options splits the Pi's memory between the built-in graphics and the operating system.

Manage Memory and SD Card Options

9781118768198-fg0313.tif

001.eps On the Setup Options screen, press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select the Expand Filesystem option and press 9781118768198-ent.tif.

The Pi displays some text, which flashes past too quickly to read, and then displays a message saying the file system will be enlarged upon the next reboot.

002.eps Press 9781118768198-ent.tif again to return to the Setup Options screen.

9781118768198-fg0314.tif

003.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Advanced Options and press 9781118768198-ent.tif.

9781118768198-fg0315.tif

004.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Memory Split and press 9781118768198-ent.tif.

9781118768198-fg0316.tif

005.eps Type one of the numbers from the list at the top.

006.eps Press 9781118768198-Ent.tif to return to the Setup Options screen.

The Pi reorganizes its memory and gives more to the options you selected.

Set Up Overclocking

You can overclock your Pi to make it run faster. Overclocking modifies key system settings. It improves performance, but makes your Pi run hotter. Overclocking does not void the warranty, but it can make your Pi less reliable and shorten its working life.

To overclock your Pi, select the Overclock option in the Configuration tool. You can choose one of five speed presets. The faster a preset, the hotter your Pi runs and the more likely it is to stop working reliably. If you enclosed your Pi in a case it runs even hotter.

Set Up Overclocking

9781118768198-fg0317.tif

001.eps On the Setup Options screen, press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select Overclock and press 9781118768198-ent.tif.

A warning screen appears.

9781118768198-fg0318.tif

002.eps Press 9781118768198-ent.tif to skip past the warning message.

9781118768198-fg0319.tif

003.eps Press 9781118768198-arkup.tif and 9781118768198-arkdn.tif to select an overclocking option and press 9781118768198-ent.tif.

9781118768198-fg0320.tif

004.eps Press 9781118768198-ent.tif again to return to the Setup Options screen.

Overclocking is set immediately. You do not need to reboot.

Connect to the Internet

You can link your Pi to the Internet by connecting it to a router or modem with a standard Ethernet cable. If your router is set up to provide local network addresses automatically, as consumer routers usually are, your Pi appears on your local network almost as soon as you connect it.

You can then load and view web pages, as described in Chapter 4. You can also begin to turn your Pi into a web server, file server, or home media player, as described in later chapters.

Connect to the Internet

9781118768198-fg0321.tif

001.eps Plug an Ethernet cable into your router.

9781118768198-fg0322.tif

002.eps Plug the other end of the cable into the Ethernet socket on your Pi.

After a few moments, your router automatically connects your Pi to your local network and the Internet.

Note: If you have an optional Wi-Fi dongle, you can connect the Pi over Wi-Fi. For details, see Chapter 4.

Note: Some applications require a static IP address. See Chapter 7 for details.

The Pi connects to the Internet. For information about using a web browser, see Chapter 4.

Revise the Configuration

When you finish configuring your Pi for the first time, the options you choose are saved to the memory card. You do not have to enter them again.

The Pi does not reload the Setup Options screen the next time it boots. But you can access the screen and change the options again — for example, if you decide to experiment with overclocking — by typing a simple text command.

Revise the Configuration

001.eps Power up the Pi, log in, and wait for the command-line prompt, indicated by the dollar sign ($).

9781118768198-fg0323.tif

002.eps Type sudo raspi-config and press 9781118768198-Ent.tif.

9781118768198-fg0324.tif

A The Setup Options screen appears. You can revise setup options here.

Update the Operating System

If you boot your Pi using an SD card with a preinstalled version of the OS, or operating system, the software that runs your Pi, it may be out of date. You can update the OS to the latest version by typing two simple commands at the command prompt. To do this, reboot your Pi and log in at the system prompt.

A full update can take a couple of hours, and you must connect your Pi to the Internet before you begin.

Update the Operating System

001.eps If you are starting from Setup Options, return to the main screen and press 9781118768198-arkrt.tif to select Finish and press 9781118768198-ent.tif.

9781118768198-fg0325.tif

002.eps If you see a screen asking if you want to reboot now, press 9781118768198-ent.tif again.

9781118768198-fg0326.tif

003.eps If you are starting from the login prompt, type pi and press 9781118768198-ent.tif.

004.eps Type your password and press 9781118768198-ent.tif.

Note: Remember to type your new password if you changed it in Setup Options.

005.eps When the dollar sign ($) prompt appears, type sudo apt-get update and press 9781118768198-ent.tif.

Note: Include all spaces and punctuation. Make sure the spelling is correct.

9781118768198-fg0327.tif

A The Pi starts displaying text to show that it is downloading and updating files.

006.eps Wait until the Done message appears, followed by the prompt.

007.eps When the dollar sign ($) prompt appears, type sudo apt-get upgrade and press 9781118768198-ent.tif.

008.eps Press 9781118768198-Y.tif when the Pi asks if you want to continue.

9781118768198-fg0328.tif

B The upgrade ends when the dollar sign ($) prompt reappears.

Note: The upgrade process can take a couple of minutes to a couple of hours.

Note: Linux does not tell you when updates are available. But you can update and upgrade at any time.

Launch the Desktop

You can launch the desktop on your Pi by typing the startx command at the system prompt. The Pi blanks the screen while the desktop loads — this can take awhile. After a few seconds the Pi displays a desktop with icons, a task bar, and official Raspberry Pi wallpaper.

Although some of the icons are unusual, the basic features of the desktop — clickable icons, a start menu, and a toolbar — should be familiar to users of Windows 7 and XP. Mac users may need to take some time to experiment with this environment.

Launch the Desktop

9781118768198-fg0329.tif

001.eps At the command prompt type startx and press 9781118768198-ent.tif.

9781118768198-fg0330.tif

A The Pi loads and displays the LXDE desktop.

Shut Down the Pi

Do not shut down your Pi by unplugging the power. You can corrupt the contents of the memory card, losing files and perhaps damaging the operating system and making it unstable or even unusable.

You can shut down the Pi from the command prompt. To get to the command prompt, you must quit the desktop. Note you can reboot your Pi by typing sudo reboot.

Shut Down the Pi

001.eps Click the power icon.

9781118768198-fg0331.tif

002.eps Click the Logout option on the floating menu.

9781118768198-fg0332.tif

A The desktop quits and returns you to the command prompt.

003.eps Type sudo poweroff and press 9781118768198-Ent.tif.

The Pi runs a shutdown sequence.

Note: After your screen goes blank, wait until the ACT light on the Pi stops flashing before unplugging the power.

Note: If you launch the desktop as superuser/root — see Chapter 5 — the power button displays extra reboot and shutdown options when you click it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.12.249