Apt-get install Apache2 debian basic how to tutorial
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3788
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
There's some helpful tips to upgrade your debian based system to Apache 2.0 on crazysquirrel.com

This assume you have mysql installed already:
mysql-server-4.1
or
mysql-server-5.0

and apache2
apache2-mpm-prefork

so, to get running, let's say we're using mysql 5 and php5 here:
:: Code ::
apt-get update
# install mysql first so it's running so apache sees it.
apt-get install mysql-server-5.0
# for basic installs, unless you know why you do otherwise, use this apache
apt-get install apache2-mpm-prefork
# add php5-pgsql if you're going to run postgre
apt-get install libapache2-mod-php5 php5-mysql

And that's it, it will be running.

You may need to issue this command as root to get it started:
:: Code ::
apache2 -k restart

then visit:
:: Code ::
http://localhost/

and you should see the default apache welcome message

To make sure your php is working, make a test page here, called index.php, like this: /var/www/apache2-default/index.php

Give it content:
:: Code ::
<?php echo 'hello world';?>


Run this location:
:: Code ::
http://127.0.0.1/apache2-default/index.php


and it should show: hello world

and nothing else.

your php is running now.

Legacy 1.3 conversion information, not required I believe for fresh Apache 2.x installs
Key items are:
:: Quote ::

1. When you upgrade Apache you have to install libapache2-mod-php4

2. The first gotcha is with register_globals which is set to on in the default php.ini for Apache 1.3 but off in the default php.ini for Apache 2.

3. when you install Apache 2 after Apache 1.3 it doesn't automatically update the php.ini files so that the related packages can be used with Apache 2. The result is that database access doesn't work and you get nasty error messages like this:

Fatal error: Call to undefined function: pg_connect() in
/usr/share/phpbb2/site/db/postgres7.php on line 79

The solution to this is to reconfigure the php4-pgsql and php4-mysql packages with:

dpkg-reconfigure php4-pgsql php4-mysql

Thanks for the info crazysquirrel.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3788
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
By the way, in the above, if you're using php5, just change the above apt-install and dpkg configure stuff to say php5 instead of php4, it works the same.

this is also assuming you've installed php on apache, you'll want mod_php4 or mod_php5, to suite your tastes and needs.

Then to start your new webserver, read this how to

:: Quote ::
Then you can change the NO_START entry in /etc/default/apache2 to 0, and run /etc/init.d/apache2 start to start your shiny new Apache 2 Web server.

I found NO_START to be already set to 0 in the latest apt-get install of apache2, but double check that anyway.

And that's about it, just follow these steps and you're on your way.

To get both mysql and apache2 to start as daemons, use this:
:: Quote ::
Another is to use the sysv-rc-conf run-level configuration editor. This is not installed on Debian systems by default, but can be installed using apt-get install sysv-rc-conf.


Once installed, run sys-rc-conf as root, and you'll get a semi-gui console interface, you can check off or on services and runlevels for apache2 and mysql, or any other db you want. Since I don't know any better, I just made them start and run in runlevels 2 through 5, I'll change that iif it's wrong.

Type 'q' to quit, then restart linux just to make sure it's all working. When it restarts, both apache2 and mysql, or postgre if you're using that, should be running as daemons, or services.

You can make sure apache is running correctly by simply typing 'localhost' in a browser and hitting enter. You should see the default apache page, that has various advice and warnings on it. If you see that, your web server is now running.

You'll want to create some dbs etc to test that your db is also running, then install something that uses a db and php to test the php/mysql end of things.

If you go into your console, switch to su mode, then run this command:
mysql
that should drop you right into the mysql monitor, assuming you've installed mysql and its utility packages [debian:: apt-get install mysql-utils]. If you see that, you're mysql is ready to go.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3788
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
This thread covers the process of creating your SSL certificates etc. Well, actually, it links to a tutorial on that process.
Back to top
massivelad
Status: New User - Welcome
Joined: 23 Feb 2011
Posts: 1
Reply Quote
Hi there
im relatively new to this but ive tried folloing all the steps in command line and the apache server and mysql server seem to install successfully but it doesnt load on reboot and I cant restart it with "apache2 -k restart" in command line - any help would be greatly appreciated.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3788
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
You're giving zero details, like what system are you running, debian, and if debian, which version? testing sid stable etc

Rather than force someone like me to pull out piece by piece the information needed to help you, why don't you try asking your question again, but this time with all relevant information. Especially the output of the commands that you say fail.

Saying something doesn't work really is of little help until you provide meaningfully precise and specific details, consider this a lesson in not just how to do apache, but on how to get help in the first place.
Back to top
ckosloff
Status: Contributor
Joined: 21 Dec 2011
Posts: 254
Location: South Florida
Reply Quote
:: techAdmin wrote ::

Then to start your new webserver, read this how to

Sorry, dead link
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3788
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Yeah, people are bad about maintaining web pages, sad to say. One reason I run these forums, to get things rolling.

With debian, installing the packages will make them start automatically as daemons/services, which is what you want.

I don't use many apache2 commands, but I use this one a lot:

:: Code ::
apache2 -k restart

after adding a new virtual host site on my local machine.

That also gives error messages on failure, which can help figure out what you did wrong setting up a new site.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours