Don't remove your existing installation of apache2 without thinking. gnome-core depends on it.
Updated 1 March 2012. Added missing information which prevented building and now provide information about auto-start using an /etc/init.d/ script. Original post at 2012-02-23
Building
A new version of apache is kind of a big deal. Here's how to build it.
sudo apt-get install libapr1-dev uuid-dev libaprutil1-dev libmysqlclient-dev libpq-dev libsqlite3-dev rcconf
wget http://apache.mirror.aussiehq.net.au//httpd/httpd-2.4.1.tar.gz
tar -xvf httpd-2.4.1.tar.gz
cd httpd-2.4.1/
./configure
make -j5
where 5 is the number of cores+1. Four-core i5 => 4+1=5.
To install run
sudo make install
or
sudo checkinstall
sudo dpkg -i *.deb
Done.
sudo checkinstall won't work unless you first
sudo mkdir -p /usr/local/apache2/modules
(see comment below by Y&S who pointed this out)
If you don't create the directory first, you get
/usr/share/apr-1.0/build/libtool --silent --mode=install install mod_allowmethods.la /usr/local/apache2/modules/
ranlib: could not create temporary file whilst writing archive: No more archived files
make[3]: *** [install-modules-yes] Error 1
make[3]: Leaving directory `/home/me/tmp/httpd-2.4.1/modules/aaa'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/me/tmp/httpd-2.4.1/modules/aaa'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/me/tmp/httpd-2.4.1/modules'
make: *** [install-recursive] Error 1
**** Installation failed. Aborting package creation.
Anyway, your compiled httpd is now in /usr/local/apache2/bin/httpd
In my case /usr/local/apache2/bin is not in my PATH -- whether you want to add it or not is a matter of choice.
In order for you to bind your own httpd to port 80 you need to stop apache2 if it is running
sudo service apache2 stop
Test your build:
me@tantalum:~$ /usr/local/apache2/bin/httpd -vSo far, very easy.
Server version: Apache/2.4.1 (Unix)
Server built: Feb 23 2012 11:51:26
I've tried it on amd64 and i386 debian testing machines.
Replacing old version of apache2
Don't try to remove apache2.2-bin since gnome-core depends on it:
http://www.linuxformat.com/forums/viewtopic.php?p=101538
The easiest way to deal with this is to do
sudo rcconf
and de-select apache2. This way it's still installed, but won't run as a rc service.
Making it boot -- init.d script
I had a look at this: http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html
And here's my /etc/init.d/httpd script
#!/bin/bash
# description: apache2 httpd 2.4.1 server
# Start the service httpd
start() {
/usr/local/apache2/bin/httpd &
echo "Up and running"
}
# Restart the service httpd
stop() {
killall httpd
echo "Killing httpd"
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac
exit 0
Don't forget to chmod+x
Finally,
sudo rcconf
and select httpd (it'll be at the bottom of the list)
It's not the prettiest of scripts, and you can probably do better by editing /etc/init.d/apache2
"sudo checkinstall didn't work for me.
ReplyDelete/usr/share/apr-1.0/build/libtool --silent --mode=install install mod_allowmethods.la /usr/local/apache2/modules/"
Didn't work for me either but if you look there at the error, it's because Debian doesn't have an apache2 directory in /usr/local and libtool can't write temp files...so, just make the apache2/modules directories in /usr/local and checkinstall works fine.
Cheers for pointing that out. It goes to show that it pays to actually look at the error messages.
Delete