— Summary —
Simple facts:
- WordPress rewrite works well on hosting server but not works well on my home computer.
- Ubuntu 12.04 LTS was released on 2012-04-26 and Apache httpd 2.4.2 was Released on 2012-04-17.
- Check http://packages.ubuntu.com/precise/web/, you will see that Package: apache2 (2.2.22-1ubuntu1).
- No available package for you to simply apt-get install yet.
- To compile and install manually is fun and educational. To verify your knowledge on operation system. If you actually check source code and you will respect Open Source more.
What to achieve?
- to compile and to install workable Apache httpd 2.4.2 to directory /usr/local/apache2.4.2
- to have 2 Apache server, old one in version 2.2.22 listening to port 80, and new one in version 2.4.2 listening to port 8080
— Preparation —
Check list
- to get source code of Apache at http://httpd.apache.org/docs/2.4
- to get source code of Apr and Apr-Util at http://apr.apache.org
- Put unpacked Apache source code under /home/mark/prja
- Put unpacked Apr source code under /home/mark/prja/httpd-2.4.2/srclib/apr
- Put unpacked Apr-Util source code under /home/mark/prja/httpd-2.4.2/srclib/apr-util
Check source code directory
mark@ubuntu:~$ pwd /home/mark mark@ubuntu:~$ cd prja mark@ubuntu:~/prja$ ls httpd-2.4.2 mark@ubuntu:~/prja$ cd httpd-2.4.2/ mark@ubuntu:~/prja/httpd-2.4.2$ ls ABOUT_APACHE buildmark.o httpd Makefile.in README.platforms acinclude.m4 CHANGES httpd.dsp Makefile.win ROADMAP Apache-apr2.dsw config.layout httpd.spec modules server Apache.dsw config.log include modules.c srclib apache_probes.d config.nice INSTALL modules.lo support ap.d config.status InstallBin.dsp modules.o test build configure LAYOUT NOTICE VERSIONING BuildAll.dsp configure.in libhttpd.dsp NWGNUmakefile BuildBin.dsp docs LICENSE os buildconf emacs-style Makefile README mark@ubuntu:~/prja/httpd-2.4.2$ cd srclib mark@ubuntu:~/prja/httpd-2.4.2/srclib$ ls apr apr-util Makefile Makefile.in mark@ubuntu:~/prja/httpd-2.4.2/srclib$ cd .. mark@ubuntu:~/prja/httpd-2.4.2$
— Step by Step —
1. Perform configure
mark@ubuntu:~/prja/httpd-2.4.2$ ./configure --prefix=/usr/local/apache2.4.2 --with-included-apr > ../prja-log1.txt rm: cannot remove `conftest*': No such file or directory rm: cannot remove `conftest*': No such file or directory rm: cannot remove `libtoolT': No such file or directory configure: WARNING: apr/apr-util is compiled without ldap support configure: WARNING: apr/apr-util is compiled without ldap support configure: WARNING: Your APR does not include SSL/EVP support. mark@ubuntu:~/prja/httpd-2.4.2$
2. Perform make
mark@ubuntu:~/prja/httpd-2.4.2$ sudo make > ../prja-log2.txt [sudo] password for mark: mark@ubuntu:~/prja/httpd-2.4.2$
Just in case, if you try more than one time, you might need to run “make clean” before “make” again.
3. Perform make install
mark@ubuntu:~/prja/httpd-2.4.2$ sudo make install> ../prja-log3.txt libtool: install: warning: relinking `libaprutil-1.la' mkdir /usr/local/apache2.4.2/modules mkdir /usr/local/apache2.4.2/conf mkdir /usr/local/apache2.4.2/conf/extra mkdir /usr/local/apache2.4.2/conf/original mkdir /usr/local/apache2.4.2/conf/original/extra mkdir /usr/local/apache2.4.2/htdocs mkdir /usr/local/apache2.4.2/error mkdir /usr/local/apache2.4.2/icons mkdir /usr/local/apache2.4.2/logs mkdir /usr/local/apache2.4.2/cgi-bin mkdir /usr/local/apache2.4.2/man mkdir /usr/local/apache2.4.2/man/man1 mkdir /usr/local/apache2.4.2/man/man8 mkdir /usr/local/apache2.4.2/manual mark@ubuntu:~/prja/httpd-2.4.2$
Several directories were created and we know where Apache was installed.
4. To start web server
mark@ubuntu:~/prja/httpd-2.4.2$ cd /usr/local/apache2.4.2 mark@ubuntu:/usr/local/apache2.4.2$ ls bin cgi-bin error icons lib man modules build conf htdocs include logs manual mark@ubuntu:/usr/local/apache2.4.2$ cd bin mark@ubuntu:/usr/local/apache2.4.2/bin$ ls ab apu-1-config dbmmanage fcgistarter htdigest httxt2dbm apachectl apxs envvars htcacheclean htpasswd logresolve apr-1-config checkgid envvars-std htdbm httpd rotatelogs mark@ubuntu:/usr/local/apache2.4.2/bin$ ./apachectl -v Server version: Apache/2.4.2 (Unix) Server built: Jun 25 2012 10:27:49 mark@ubuntu:/usr/local/apache2.4.2/bin$
Now, this new Apache 2.4.2 is ready to tune up.
You might want to try to start it, to expect error message and to study it accordingly.
mark@ubuntu:/usr/local/apache2.4.2/bin$ ./apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs mark@ubuntu:/usr/local/apache2.4.2/bin$
Permission problem. So we should add sudo and try it again.
mark@ubuntu:/usr/local/apache2.4.2/bin$ sudo ./apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs mark@ubuntu:/usr/local/apache2.4.2/bin$
Now, we have option, either to stop current running Apache or to let new Apache listen to alternative port. Stick to our plan, carry out the second solution.
Change directory to locate configuration file and make a backup first
mark@ubuntu:/usr/local/apache2.4.2/bin$ cd .. mark@ubuntu:/usr/local/apache2.4.2$ ls bin cgi-bin error icons lib man modules build conf htdocs include logs manual mark@ubuntu:/usr/local/apache2.4.2$ cd conf mark@ubuntu:/usr/local/apache2.4.2/conf$ ls extra httpd.conf magic mime.types original mark@ubuntu:/usr/local/apache2.4.2/conf$ sudo cp httpd.conf httpd.conf.backup mark@ubuntu:/usr/local/apache2.4.2/conf$ ls extra httpd.conf httpd.conf.backup magic mime.types original mark@ubuntu:/usr/local/apache2.4.2/conf$
Then, to use default text editor to modify configuration file,
mark@ubuntu:/usr/local/apache2.4.2/conf$ sudo gedit httpd.conf
You will see something like this,
Ctrl+F to Find the lines
#Listen 12.34.56.78:80 Listen 80
And change it to be
Listen 127.0.0.1:8080 #Listen 80
Save and exit editor. Run command to start it again
mark@ubuntu:/usr/local/apache2.4.2/conf$ sudo /usr/local/apache2.4.2/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message mark@ubuntu:/usr/local/apache2.4.2/conf$
Ignore warning message for a while.
5. Check result and it’s done
— Further Study —
- Log files are here for future reference: prja-log1.txt,prja-log2.txt and prja-log3.txt.
- You may compile and install Apr and Apr-Util first. However it’s easier to put them to proper location and to have configuration option –with-included-apr.
— Useful Command —
/usr/local/apache2.4.2/bin/apachectl -v sudo /usr/local/apache2.4.2/bin/apachectl start sudo /usr/local/apache2.4.2/bin/apachectl stop sudo gedit /usr/local/apache2.4.2/conf/httpd.conf
RECENT COMMENT