From Windows to a Debian GNU/Linux desktop, sans the geekness
The Original - since June 2006 - Run Debian GNU/Linux and be Happy.
Honesty and integrity...get some.
 

this site  web    
The Goods
Home Page
Forum
debiantutorials.org Licensing
Website Disclaimer
Site Map
Links
w32codecs
How to really switch Mom to Linux
Documentation
Release Notes
Developers Reference
Debian Survival Guide
Debian Books
Manuals
Debian Security
Linux Dictionary
Leaving Windows
Resize Windows Partition for Dual-Booting
Back up your Partitions, Imaging
Still Suffering Windows
Keep your Money, your Sanity and your Self-Respect
Installing Debian Etch
Debian GNU/Linux (Etch) Installation Tutorial
My Etch Desktop in 150 words or Less
Upgrade Sarge to Etch
Configure Debian Etch
Multimedia on Debian Etch
Install nVIDIA 3d driver on Debian Etch
Wireless on Debian Etch: Broadcom - bcm43xx
Klikit, Klikit good
Handy Little Things
Package Management
Peripherals & Debian Etch
Set up your web cam on Debian Etch
Printing in Debian (Browsers, too)
Your ipod on Debian Etch
Atheros Wireless
Broadcom Wireless
Etch on the Desktop
Visitors apache log reader
Andrea del Sarto
(Poetry snippet for your Ignorant Ass)
Beagle on Debian Etch
Convert Digital Camera .mov Files
Some Debian Etch System Files
My Debian Desktop
Using wget
Copying or Ripping DVD's in Linux (Debian)
Reset root password
So, you want to run Linux
Convert mov files
Securing Debian
Password Protect Grub Boot Loader
Debian Etch as Server
Debian Linux file and print server: NFS, CUPS, LPR
Stream your music with gnump3d
Simple local web server on Etch
Web Server on Debian Etch
Miscellaneous Linux
Linux Conventions
Can People read my Documents?
Install Software on your Linux System (Debian)
Partition your Hard Drive
History of debiantutorials.org
A School Without Windows (PDF)
How to talk to Tech Support
Linux Demystified
Off Topic
A DRM Dissertation
An Artist's take on Downloading Music
An Insane and Damaging lack of Understanding
On Children and Drugs
On Visitor Q
Intellectualism for the Masses
debiantutorials.org stats
Smart Crows
How old are We?
Why we run Debian
How not to ask an egomaniac like myself for an article
Sarge Specific Tutorials
Installing Debian Sarge, net install, no DHCP
Easy Graphical Sarge Installation Tutorial
Rebuilding my Debian Sarge Machine
Multimedia for Sarge
w32codecs
nVIDIA on Sarge
Trouble Burning discs: cdrecord
Athcool on Debian Sarge
Where are my Newly Installed Apps?
Easy LAMP on Debian Sarge
Archive
Sites Worth a Look
Debian Mailing List
spidercider
Linux Comparison at PolishLinux.org
Thin Clients
Common Commands
Common iptables Filtering
iwouldntsteal.net
Big-Ass iptables info Page
iptables Port Reference
README: Firewall
General Security Tips
Newbie Security
Kickass RFC's
Data Breaches
Hemp Seed Oil
linux-hardcore.com
Search for a local Computer Tech
Evelyn's Linux Cheat Sheet
Lotsa (687) Linux Commands

Favorite Utilities

Super Grub Disc
System Rescue Disc
News Feeds
visitors run
operating system
Linux
Windows
Mac
Unknown
BSD
54.8 %
39.8 %
3.40 %
1.50 %
0.10 %

web browser
Firefox
Mozilla
IE
Opera
Epiphany
41.4 %
25.1 %
15.8 %
8.40 %
3.50 %
updated 17apr08
What's Root?
Root is the super-ultra-mega. All system commands on a Linux box need to be done as root. This means installing software and changing files not in your /home directory, etc. In your terminal, if you're logged in already become root by typing su at your $ prompt, then the root password. Log in the system directly as root from a terminal, but not the graphical login. # shows root.
dediantutorials.org is ad-free
debiantutorials.org has always been and will always remain ad-free I make no unrealistic demands that you "owe me for my time and bandwidth" in order to use my site. I detest all those scumbags out there that think that they are owed something for putting a web site up. I do debiantutorials.org because I love it. You owe me nothing.
If you can walk and chew gum at the same time, you can run Linux

    Friday, May 09, 2008      Contact  Etch Info  what's new in Etch  Linux Demystified  Our Forum
Easy LAMP on Debian Sarge PDF Print E-mail
Using Debian Sarge - Using Debian (Sarge) for common tasks
Written by machiner   
Tuesday, 12 July 2005
Setting up Apache, MySQL, and PHP4 on a Debian System

For LAMP on Debian Etch I have 2 tutorials, local web server and something suitable for a live LAMP on Etch

It's pretty easy to get a working local web server on your Debian box. You can use the command line (apt-get install) to get your packages or fire-up Synaptic to do it. When I set up LAMP I need my web server to work for various Content Management System (CMS) scripts. Some, like VTiger use gd for image manipulation, so I install that aspect when installing the web server. As well, I use Mambo for many sites, this one included, so I install php4-pear, curl, etc.

You will probably need less components, and if you're only coding html, all you need to install is Apache. Today we'll install Apache, PHP4, and MySQL.

README: This brief tutorial sets up a local web server. Local! This tutorial is not intended to set up a real, live running web server serving up pages to the world. In no way is this a suitable tutorial for accomplishing that task.

If you want to compile your own LAMP packages it's simple to do as well, just visit this compiling LAMP tutorial. Since you're coming from Windows we use a fancy GUI in the tutorials on debiantutorials.org. Mostly. Also, to make life really easy you'll be installing Webmin to admin your server, et al. Webmin can do a lot and can admin your entire machine, but I don't use it for much and I never leave it running.

On to business...open Synaptic and search for "apache". Right-click apache 1.3.33-6 in the results and choose to "mark for installation". It'll have dependencies so allow those to be installed as well. Don't forget to also select:

  • libapache-mod-perl
  • libapache-mod-ssl (you never know)

Next, search for "php4". This pic illustrates the php4 components that I have installed on my machine. They are not all necessary for you but no harm if you install them as well. Make sure you install:

  • libapache-mod-php4
  • php4-mysql
The rest of the php4 modules are fluff, but handy. Installing php4 is a good idea. Yes to dependencies.

lamp-install-php4-sm.png

Next search for "mysql" and right-click on "mysql-server" and mark for installation. Again, there will be dependencies.

Even if you don't plan to utilize MySQL in a web environment, there are many cool applications that you might feel like installing someday that use the MySQL database.

Following the selection of these LAMP components, install 'em! You may be prompted a couple times during the actual installation; things like setting up Apache, stopping or restarting it, etc. etc. I let it restart during installation when it installs a module or otherwise must stop to incorporate a change in its configuration file. You don't have to worry, it's OK to do this. Also, when prompted to run Apache in SuEXEC it's OK to say NO. (See the following "SuEXEC on a local machine" search result. Good info on page 1 and 2, search for "SuEXEC" on the pages)

Following the install open a terminal because we MUST create a password for your Admin (root) user in MySQL. There are many that say to change the default username but I think you're covered by just picking a password. This setup won't be serving actual pages on the web will it? If it is then this tutorial is not for you as I do not discuss securing your web server. That's a different tutorial for a different day.

For today, see any of the following Google search results:

Continuing, in your terminal type the following as a regular user:

$ mysqladmin -u root password [pick-a-password]

Next, let's make sure php4 will work with MySQL. Go ahead and open the following file:

# gedit /etc/php4/apache/php.ini

this will open your PHP configuration file so you can un-comment a couple things. I just search for mysql.so to find the section quickly.

; Example lines:

;extension=mysql.so
;extension=gd.so

remove the semi-colons in the beginning of each line beginning with "extension". Save the file and exit Gedit.

Following any changes you make to the httpd.conf (or module conf files like php.ini) you must restart apache:

# /etc/init.d/apache restart

At this point, installing LAMP this way, Apache and MySQL will both start when your machine does. I don't normally utilize the public_html capabilities letting each machine user have a web directory in his/her /home directory. You may want to do this, just because it's easier when creating your websites. Example, you want to start writing websites in .html. You cannot save your project files/folders to your /var/www directory because it's chmod'd and chown'd to keep regular users out. It's a good thing - Linux security 101. To take advantage of multi-user home web directories see this: link or do your own search.

At this point you do have a working web server but we'll want to modify your httpd.conf file a little to allow for .php pages...and stuff. We'll also install phpmyadmin for easy database management (ish) and Webmin 'cos you never know. Installing phpmyadmin is as easy as opening your terminal and running the following command:

# apt-get install phpmyadmin

A link will be created in your /var/www directory so running phpmyadmin is as simple as typing: 127.0.0.1/phpmyadmin into your web browser's address bar.

Installing Webmin is just as simple, but first let's install libnet-ssleay-perl so we can run Webmin securely. In your terminal run the following command:

# apt-get install libnet-ssleay-perl

Go ahead and download webmin right now, I'll wait...Following this, goto the directory you saved the .tar file to and extract the Webmin install directory. Next, cd into the extracted directory ( $ cd /path/to/webmin-1.210 ). Now run the following command to install Webmin:

# sh setup.sh /usr/local/webmin

From there follow the prompts, mostly just enter. You may choose your port, uname and password. As well, you may choose to have Webmin start at boot or no. I choose no. The command to start/stop Webmin when you need it is the following:

# /etc/webmin/start
# /etc/webmin/stop

Now let's get to your httpd.conf file and make a few mods allowing our sites to run. You can change the file from Webmin, or just run a text editor as "root" I open gedit as root. Go ahead and open your /etc/apache/httpd.conf file. Scroll down in the config file until you come to this section:

# First, we configure the "default" to be a very restrictive set of
# permissions.
#

Options SymLinksIfOwnerMatch
AllowOverride None
change None to read: All

Go to this section next:

# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
change None to read: All

Then:


DirectoryIndex index.php index.html index.htm index.shtml index.cgi
Make sure index.php is first one the string.

If you want to run cgi scripts and the like from another location (default on Debian is here: /usr/lib/cgi-bin ) find this section in the httpd.conf file:


    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

#
# "/usr/lib/cgi-bin" could be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
    
        AllowOverride None
        Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    
and change the default location to a location you desire, like /var/www/cgi-bin.

Finally, keep scrolling to the following section:

# And for PHP 4.x, use:
#
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps
un-comment the two AddType lines.

You're finished. Easy - huh? All you have to do now is restart Apache to incorporate your changes. Remember that command? If you forgot, here it is:

# /etc/init.d/apache restart

There are many cool and/or functional scripts you can now install into your web directory. There are Genealogy scripts (they work as a website), recipe scripts, CMS, a movie database -- the list goes on. You can install some other cool apps that use MySQL as well - like prokyon3 for your music. I also like to put my .oggs and .mp3's into an SQL database so I can run pmreport and revel in the geekness of data!

To see your websites open your browser and type: 127.0.0.1/site into your address bar. If you only have one local site and it's not in a sub directory of your /var/www directory, than just typing 127.0.0.1 into your address bar will serve that up.

By installing LAMP on your box you just opened up some listening daemons on your machine. You should probably go ahead and install a firewall now if you have not already done so. Fire up Synaptic and search for "firewall". Or, goto your favorite forum and ask around. Popular and very simple scripts are:

  • Firestarter
  • Guarddog
  • kmyfirewall
  • shorewall
These are just simple front-end scripts for iptables, your built-in firewall.

machiner - 13 July 2005

ADDENDUM: Many people are searching for advice on installing Mambo on a Debian system. I know this because I see it in my server logs. May as well do a quick write up for it, ey? This is how I do it:

Download the latest Mambo or Joomla from your favorite place -- it's everywhere.

Keep your browser open because we'll need that for the install. Also, open your terminal.

After downloading the file you will have a .tar.gz file that will need extracting. Careful because the files are not packed in a directory, so when you extract them you'll have all of the files in your server's root directory. If you like to have multiple web sites on your local LAMP server then you'll need to make a directory to put the Mambo (Joomla) files into. You can do it like this:

# tar -xvzf /location/of/file/Joomla_1.0.8-Stable-Full_Package.tar.gz --directory=/var/www/joomla

The directory will be created.

After you've extracted Mambo, or Joomla to your server root you'll need to make the owner of that directory www-data. It's pretty simple, change ownership at the command line like this:

# chown -R www-data:www-data /var/www/mambo

We're ready to install Mambo. You don't need to create a database first, the install routine will ask you for your mysql credentials and make the database for you.

Switch to your browser and open your Mambo site: 127.0.0.1/mambo and you will be greeted by the Mambo install script. It's pretty self explanatory and you can simply go through the 3 or 4 screens and you will be finished. After you install Mambo switch back to your still open terminal and still as root remove the installation directory:

# rm -rf /var/www/mambo/installation

At this point you're finished. The last screen in the Mambo install will have 2 links atop the page, skewed to the right, pick one: Site or Administrator. Have fun with Mambo.





Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
Trackback(0)
Comments (8)Add Comment
Much Thanks!
written by Guest, July 15, 2005
I have been having issues with php and Mysql working in harmony, and sometimes the Debian chat guys have been less than helpful. I really appreciate this simple explanation!
...
written by Guest, August 08, 2005
javascript:ac_smilie(\':p\')
javascjavascript:ac_smilie(\':upset\')
javascript:ac_smilie(\':upset\')ript:ac_smilie(\':p\')
great and clearly written
written by Guest, August 12, 2005
I have been using debian for a few months but never set up a web server before - this was a great tutorial to get me started, thanks!
Great stuff :-)
written by Guest, August 24, 2005
Last time i set up a Lamp server it took me about 3 weeks, today it took my about 30 mins.
Thanks!
written by Guest, September 02, 2005
Now, if only I knew how to:
- structure a DB effeciently
- put delimited data into the database
- write applications to generate reports...


:)

Seriously, this was a big help.

wow...
written by Guest, January 25, 2006
before today all I could do was log on and log off and install xampp. Now I have successfully installed LAMP and actually understand next to all of it. thank you...
...
written by 'Guest', August 12, 2006
This really sucks. I have spent hours trying to get by a socket message. Linux does not have good documentation nor does it have any logical method of problem solving. I\'m going to bed and try to forget about it.
Awesome Tutorial
written by 'Guest', May 27, 2007
I\'ve been meaning to sit down and get lamp going on my etch box. It was very easy thanks to this tutorial. This is going in my bookmarks for sure.

Write comment

security code
Write the displayed characters


busy
 
Creative Commons License © debiantutorials.org Thanks for dropping by. I hope you have found this site to be helpful.   Search for a local Computer Tech  debiantutorials.org