Low End Mac Reader Specials
TypeStyler For Mac OS X is Now Shipping! Download The Free Fully Functional 60 Day Tryout at www.typestyler.com
OWC: Get the Right Memory / Ram for your Mac. Top Quality, Competitive Prices, Lifetime Warranty. Expert Support and Video Installation Guidies too! 4.0GB Matched Sets from $87.99, Options up to 32GB. Click here
Don't install Parallels to play poker online! Poker Mac will show you how
to download and install a native Mac poker application such as Full
Tilt Poker Mac.
Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.
Compare products like desktop computers, apple laptops, apple macs, and LCD Monitors side by side! All the information and reviews to make the best purchasing decision for new mobile phones, sat nav systems, or MP3 players. The Ciao online shopping community makes searching products easy for you.
Macs in the Enterprise
Turn Your Old Mac into a Web Server with Linux, Apache, MySQL, and PHP
- 2008.07.09 - Tip Jar
Popularity: ![]()
![]()
![]()
![]()
![]()
![]()
Last time I talked about pressing your aging Mac into service as a web server. To show that it can be done, and quite easily, I decided to take the plunge.
I have three Macs that qualify as "left behind": an eMac, an iBook, and a Power Mac 6500/225. I decided to take the middle ground and selected the iBook.
Why would you want to make a notebook into a server? Well, it's small and takes up little space in the server room. It has a built-in screen and keyboard for when you can't access it remotely. And it has a built-in battery backup in case of power failure! What's not to love?
Besides, I didn't want to cop out and use a machine that actually runs Leopard relatively well, nor did I want to make my demonstration more difficult than necessary (the 6500 has plenty of disk space, but only 72 MB of RAM - a little tight for a server, where 128 MB is a realistic minimum and at least 256 MB is recommended).
The Installer
I've admitted to my preference for Debian PPC when working with Macs, and that is what I chose for this demonstration as well. I downloaded the 'netinst' version of the installation CD rather than the whole DVD. I think it makes better use of online resources to do so - not only is the install image relatively small, weighing in at under 250 MB (there have been updates to OS X that were larger!), it also forces you to download the latest and greatest packages from the Internet during the installation, virtually guaranteeing you an up-to-date system at first boot, rather than after you've run Software Update umpteen times.
Pop this installer CD into your system and boot (while holding down the C key), and you'll see your Mac do something you've probably never seen before, nor wanted - boot into a text interface. From this initial boot loader, simply press Enter to accept the defaults. Unless your system is very old indeed or full of very odd hardware, it should serve you just fine.
Watch all the text notices about hardware detection and driver status scroll by and wait for the system to drop you at a blue and gray installation screen.
Put your mouse aside, as you won't be using it for the rest of the installation - nor for the life of the server, if you keep running Linux this way.
The installer uses your keyboard arrow keys and Tab key to navigate, and usually the Enter key to accept whatever settings you have chosen.
The first things you'll be asked about are your location, language, and keyboard layout. After you have answered and some additional components have been installed, you will be asked which network adapter you wish to use. Impressively, Debian 4.0 detected my AirPort card and loaded the necessary drivers for me to proceed with my installation wirelessly.
Next you will have to decide on a name for your server. Make it unique on your network - I choose "iBook", not terribly original - and also put in your domain name. If you don't have a domain or don't know how you'll be using the server, just fill in example.org. Both the server name and domain can be changed after the fact if you change your mind.
Partitioning Your Hard Drive
The most daunting part of installing Linux for most folks is partitioning the hard drive. Let me stop here and say that if you have data on this disk and have not made a backup of it, stop now and do so. What you do next could - either deliberately or accidentally - erase that data.
The easiest option is to let the software do the partitioning for you by choosing "Guided - use entire disk." This does exactly what it says, taking over the entire hard drive and creating a new Linux partition on it, erasing everything that's on it. Note that if you have more than one drive, you can choose this option and in the next step tell it which drive to do use.
Your other option is to choose "Manual" and partition the drive yourself. As I had no data on the drive of this iBook, I chose to let the system do it itself.
You should also probably let the system create one big partition for all of your Linux data. It's the easiest system to deal with, and honestly there are few drawbacks to doing it this way, especially for a single-use server like we're setting up.
After your partitions have been approved and set up, you will be asked about your time zone and then to enter a password for the root account. Root is the superuser, and you'll need that access when you're setting up software, but make the password something strong. You'll also be prompted to create a non-privileged user, one that you can use every day without fear of causing accidental damage to the system.
The system will then install the base packages that are located on the CD-ROM and are required for every system. You could stop there once it's done and install nothing else, but your system would be about as useful as a DOS box onto which you've loaded DOS . . . and nothing else.
Before you can install any additional software, you have to tell it where to look on the Internet. By choosing a mirror that is close to you geographically, you are hopefully picking one that will be fast as well. If, after the install, you decide you wish to use a different mirror, you can edit the mirror location in a configuration file, so this decision is not set in stone.
Once that decision is made, you'll be presented with a list of prepackaged installation options. The only one you need is the standard system. If you don't deselect Desktop Environment, you will wind up installing a graphical desktop and desktop applications like OpenOffice and Firefox that you probably don't want or need on a server. And while you could theoretically select Web Server and SQL Server from this list, you don't know what'll be installed in those packages. In the interest of keeping your system lean, I would recommend not selecting them and instead waiting to install them manually after the system is fully installed.
As soon as you say go, the installation will begin in earnest. It won't take long (how long is more dependent upon your Internet connection than the speed of your hardware) before the CD is ejected and you're told that it's time to reboot.
Setting Up Your Linux Server
Let the boot process run automatically, though you will see an option to boot from the CD if you need to, and an option to enter additional boot parameters - you won't likely need to use them. You'll know it's done when you're prompted to log in for the first time.
Log in as root - we need that superuser access to install the rest of the software and tweak the configuration just so. To install the software, you only need one command:
apt-get install apache2 php5 mysql-server phpmyadmin
Note that this will install the web server, PHP, the MySQL server, and a web-based MySQL administration tool. Also note that when you hit Enter, it tells you that in addition to these packages, it will be installing a bunch of necessary supporting packages - called dependencies - to ensure that everything works. Go ahead and say Yes to this process and wait while everything installs. It won't take long.
Once that is completed, there are two final tweaks to ensure that everything is working as expected. First, you must assign a password to the root account in the MySQL server. By default the password is blank, and that's a major security hole. Type the following command:
mysqladmin -u root password PASSWORD
only replace PASSWORD with an actual password. It can be the same as the root password to log into the system, though for security's sake, I wouldn't recommend it.
Finally, to enable the interaction of MySQL, PHP and Apache, you need to change one line in one configuration file. Type this command:
nano /etc/php5/apache2/php.ini
to open up a text editor and the appropriate config file. Press Ctrl-W to begin a search within the document and type in 'mysql' and hit enter. This will take you to a line that looks like this:
;extension=mysql.so
The semicolon indicates that this line has been 'commented out' and does not get loaded at boot time. Use your arrow keys to move up to it, and delete that semicolon. Then type Ctrl-O to save (hit enter to keep the same file name) and then Ctrl-X to exit the editor.
The last step is to restart the web server with one simple command:
/etc/init.d/apache2 restart
And you're in business. Go to a different machine on the same network, open up a browser and type in the IP address of your new server. Don't know what IP address it was assigned? From the command prompt on the server, type:
ifconfig
This will bring up information about each of your network interfaces, including the current IP address.
When you click Go or hit Enter, you will see a screen that says, in big letters "It Works!" - this tells you you've done it, your web server is serving up pages. To test that PHP and MySQL are working, replace the "apache2-default" part of the URL that you were redirected to with "phpmyadmin" to see a login screen for the administration tool. Enter root as the user and the password you assigned above using the mysqladmin command, and you'll be able to manipulate your MySQL database using a PHP program.
And that is that! Easy as pie, honestly, and nothing quite like the rat's nest of commands you had to use to configure Linux once upon a time. Now you're ready to start loading up content on the system and serving up web pages, dynamic as well as static, on hardware that used to be ready to be retired.
Looking to do more? Investigate installing an SSH server so you can
remotely connect to your server and manage it from another Mac. Look at
the webmin software package for
remote server maintenance via the Web. Or, if your hardware isn't quite
so obsolete, install a desktop environment and see just how much
peppier things are under Linux. The sky's the limit!
Recent Macs in the Enterprise Columns
- Debunking Mac Myths Is Not the Way to Get Apple in the Enterprise, 08.06. There are other factors at work that keep those with vested interests on the Windows platform. Mythbusting won't change their minds.
- How to upgrade your eMac without cracking the case, 07.14. Some people like to replace the components inside their computers, but with FireWire and USB 2.0, Apple has made it easy to upgrade using external drives.
- Turn your old Mac into a website server with free open source software, 07.02. By installing Linux without a GUI, your old Mac can dedicate all of its resources to running Apache, MySQL, and PHP.
- What Snow Leopard means for Macs in the enterprise, 06.25. With Exchange and Active Directory support coming in Mac OS X 10.6, two of the big obstacles to Macs in the workplace will be swept away.
- More in the Macs in the Enterprise index.
Links for the Day
- Mac of the Day: Power Mac G5 Quad, Oct. 2005 - With two 2.5 GHz dual-core G5 CPUs, the G5 Quad was the most powerful PowerPC Mac ever and introduced PCI Express.
- Group of the Day: Mac Network deals with all aspects of Mac networking.
- November 21 in LEM history: 00: OS upgrades, downgrades - AltiVec vs. Pentium III - 01: Saved by the clones - Computer of the future - 02: Apple Education: Let's get to it - 03: Panther lets Macs and PCs work together, - Lombard SCSI bug - 05: 3 survivors from the 1970s - Real world battery life inadequate - Windows to Mac file transfer with Zip disks - $99 alternative to Microsoft Office - 06: Parallels 1.0 far more polished than beta
- Support Low End Mac
Recent Content on Low End Mac
- Apple's Tablet an End Run Beyond Netbooks, Frank Fox, Stop the Noiz, 11.20. Whatever Apple has planned will leverage existing technologies while going beyond what its competitors can offer.
- NASA Chemical Sensor for iPhone, Smartphone Death Match, iPhone Earrings, and More, Ian R Campbell, 11.20. Also mobile phone dangers, new apps, GPS solution for iPod touch, new iPod and iPhone cases, and more.
- Apple #4 in Reliability, Apple Tablet a Gadget for All?, HP's i7 Notebook Outdoes Mac Rivals, and More, The 'Book Review, 11.20. Also Flash 10.1 improves video on Hackintosh netbooks, thin-and-light notebooks impress, Windows XP finally on the way out, and more.
- i5 iMac Benchmarked, Mac mini 'Shouldn't Be Overlooked', Twitter Client for Classic Mac OS, and More, Mac News Review, 11.20. Also why Apple leaves the low end to others, 10.6.2 fixes video playback problem in 27" iMac, 3D Leopard and Snow Leopard performance, and more.
- Replacing the Hard Drive in a Clamshell iBook, John Hatchett, Recycled Computing, 11.19. Yes, it is one of the most difficult Apple notebooks to disassemble and reassemble, but a 10 GB hard drive just will not do.
- IBM Model F: A Great Old Keyboard with an Outdated Layout, Tommy Thomas, Welcome to Macintosh, 11.19. Although it used a different technology than the revered IBM Model M keyboard, the Model F was a great keyboard in its own right.
- Soft Touch Keyboards, Wireless Mouse Options, Loving SeaMonkey 2, and More, Charles W. Moore, Miscellaneous Ramblings, 11.18. Also the future of browsing with PowerPC Macs and the multiple mouse input bug introduced with OS X 10.5.8.
- More links in our archive.
Recent Deals
- Best eMac Deals, 11.18. Used 1 GHz Combo, $100; SuperDrive, $269; 1.25 GHz Combo, $119; SD, $319; 1.42 GHz Combo, $289; SD, $498.
- Best Mac OS X 10.6 and Mac Box Set Deals, 11.18. "Snow Leopard", single user, $25; 5 users, $45; Mac Box Set, single user, $139; 5 users, $180; Server, $414. Shipping included.
- Best Xserve Deals, 11.18. Used 1 GHz dual G4, $649; 2.3 dual G5, $795; 3.0 4-core Xeon, $1,899; refurb 2.26 4-core, $2,499; new, $2,888; refurb 8-core, $2,999; new, $3,449; more.
- Best 15" MacBook Pro Deals, 11.17. Used 1.83 GHz, $750; 2.16, $800; 2.33, $900; refurb 2.4, $1,299; 2.53, $1,449; 2.66, $1,699; 2.8, $1,899; new 2.53, $1,579; 2.66, $1,799; more.
- Best Power Mac G4 and AGP Video Card Deals, 11.17. Used 400 MHz, $50; 933 MHz, $80; 500 dual, $60; 867 dual, $90; 1 GHz dual, $150; 1.25 GHz dual, $225; 1.42 GHz, $499.
- Best Mac OS X 10.5 Deals, 11.17. "Leopard" upgrade, $80; single user license, $135; 5 users, $173; Mac Box Set, 5 users, $230; Server, 10 users, $340; unlimited, $850. Shipping included.
- Best Mac mini Deals, 11.16. Used 1.42 GHz G4 mini, $379; 1.66 GHz Core Solo, $419; 2.0 Core 2, $450; new 2.26 GHz nVidia, $580; 2.53 GHz, $769; Server, $990.
- Best iBook G4 Deals, 11.16. Used 12" 1.07 GHz Combo, $210; 1.33 GHz, $298; 14" 1.33 GHz, $398; 1.42 GHz, $479; SuperDrive, $498.
- Best iPod shuffle Deals, 11.16. Used 1 GB, $35; 4 GB, $65; refurb 1 GB, $39; 2 GB, $59; new 2 GB, $55, 4 GB, $75. New and refurb prices include shipping.
- More deals in our archive.
About LEM | Support | Usage | Privacy | Contacts
Navigation
Used Mac Dealers
Apple History
Video Cards
Email Lists
Favorite Sites
MacSurfer
MacMinute
MacInTouch
MyAppleMenu
InfoMac
Macs Only!
The Mac Observer
Accelerate Your Mac
RetroMacCast
PB Central
MacWindows
The Vintage Mac
Museum
DealMac
DealsOnTheWeb
Mac2Sell
ramseeker
Mac Driver Museum
JAG's House
System
6 Heaven
System 7 Today
the pickle's Low-End
Mac FAQ
Abandonware
Petition
Mac vs. PC Info
Affiliates
The Apple
Store
Mac
Connection
B&H
MacMall
TechRestore
ExperCom
Crucial
Memory
batteries.com
Advertise
MacMinute
MacInTouch
MyAppleMenu
InfoMac
Macs Only!
The Mac Observer
Accelerate Your Mac
RetroMacCast
PB Central
MacWindows
The Vintage Mac
Museum
DealMac
DealsOnTheWeb
Mac2Sell
ramseeker
Mac Driver Museum
JAG's House
System 6 Heaven
System 7 Today
the pickle's Low-End
Mac FAQ
Abandonware
Petition
Mac vs. PC Info
Mac Connection
B&H
MacMall
TechRestore
ExperCom
Crucial Memory
batteries.com
