Hardware Reference
In-Depth Information
ALTHOUGH THE PI is signiicantly less powerful than most devices you would ind in a
data centre, that doesn't mean that it can't act as a useful server in a home or business envi-
ronment. Despite a small amount of memory and relatively underpowered processor, the
Pi's low power draw and silent running makes it a great choice for serving low-traic simple
pages to a local network or even out onto the Internet.
A large proportion of modern web servers run a combination of Linux, Apache, MySQL and
PHP—commonly referred to as a LAMP stack . Linux provides the underlying operating sys-
tem; MySQL the database back-end; Apache the web server; and PHP a scripting language for
dynamic pages. Using a LAMP-based server, you can run some quite complex packages rang-
ing from content management systems like WordPress to interactive forums like phpBB. All
of this is possible with the Raspberry Pi, so long as you don't expect performance similar to
that of a powerful commercial server.
Web servers work best with plenty of memory. To ensure maximum performance, switch the
Pi's memory partitioning to a 224/32 MB split (see Chapter 6, “Coniguring the Raspberry Pi”)
and don't run a graphical user interface (GUI) at the same time.
TIP
Installing a LAMP Stack
If you're running the recommended Debian distribution for the Raspberry Pi, you're already one-
quarter of the way to having a fully-operational LAMP stack—speciically, you've already got the
Linux portion installed. he next step is to install the missing components: Apache, MySQL and
PHP. At the terminal or console, type the following commands to install these packages:
sudo apt-get update
sudo apt-get install apache2 php5 php5-mysql mysql-server
his will prompt the apt package manager (see Chapter 2, “Linux System Administration”)
to ind a number of dependencies required to get a fully-functional LAMP stack running (see
Figure 9-1). hese packages and their dependencies take up a lot of room on the Pi's SD
card—around 113 MB in total—so if you haven't resized the root partition on the SD card,
turn to Chapter 5, “Partition Management”, for instructions on how to free up more space.
Installation of the full LAMP stack can take quite some time on the Pi. Don't panic if the
system appears to freeze for a minute or two; the installation should continue normally
after. Partway through the installation process, MySQL will prompt you for a password (see
Figure 9-2). Make sure you pick a secure password, as this protects the MySQL database—
which, depending on what your web server is designed to do, can store user names, payment
details and other personally identiiable information. Also make sure you pick a password
 
Search WWH ::




Custom Search