4

I'm new to server maintenance, and am running Apache 2.4 on Ubuntu 14.10 on a VPS I just set up yesterday. It seems as if I have two different Apaches installed at different places in the machine due to the following reasons.

  1. When I run sudo /usr/local/apache2/bin/apachectl start followed by ps -A I get this:

     4408 ?        00:00:00 httpd
     4409 ?        00:00:00 httpd
     4410 ?        00:00:00 httpd
     4411 ?        00:00:00 httpd
    

    It updates the error log /usr/local/apache2/logs/error_log with something like

    [Sat Feb 14 00:16:49.963014 2015] [mpm_event:notice] [pid 4542:tid 140160010012544] AH00489: Apache/2.4.12 (Unix) mod_wsgi/4.4.8 Python/2.7.8 configured -- resuming normal operations
    [Sat Feb 14 00:16:49.963260 2015] [core:notice] [pid 4542:tid 140160010012544] AH00094: Command line: '/usr/local/apache2/bin/httpd'
    

    as set by the configuration file found at usr/local/apache2/conf/httpd.conf

  2. However, if I run sudo apachectl start (after stopping the example in 1.) followed by ps -A I get this:

    4743 ?        00:00:00 apache2
    4744 ?        00:00:00 apache2
    4745 ?        00:00:00 apache2
    

    It updates the error log var/log/apache2/error.log with something like

    [Sat Feb 14 00:22:06.816281 2015] [mpm_event:notice] [pid 4743:tid 139905582937984] AH00489: Apache/2.4.10 (Ubuntu) configured -- resuming normal operations
    [Sat Feb 14 00:22:06.816480 2015] [core:notice] [pid 4743:tid 139905582937984] AH00094: Command line: '/usr/sbin/apache2'
    

    as set by the configuration file found at /etc/apache2/apache2.conf

I have been trying to set up a Django app with mod_wsgi and Apache, and in doing so have been editing the configuration file in example 1. I did a little googling and people seemed to be saying that apache2.conf and httpd.conf seem to compliment each other, but in my case, since they both set different ErrorLog information, and generally seem to control different programs, I'm a little confused.

Do I have two different Apaches instances installed on the same machine? Or is this just normal?

4
  • How did you install apache on the machine? From the repositories? Built from source? Both? Feb 13, 2015 at 23:49
  • Well, at first I think I did it from the repositories, and then I tried to uninstall it in order to build it from source, and I thought that worked. How would I check that?
    – conradg
    Feb 14, 2015 at 0:24
  • 1
    What is the output of which apachectl Feb 14, 2015 at 0:26
  • /usr/sbin/apachectl
    – conradg
    Feb 14, 2015 at 0:35

2 Answers 2

5

Yes, you have two Apache installations on your VPS.

You have Apache installed from the ubuntu repositories, installed in /usr You have Apache installed from source installed in /usr/local/apache2

Now, you stated in a comment that you tried to uninstall apache before reinstalling from source. It would appear that the uninstallation did not properly complete.

What to do about it...

Option A: Just use the apache from the repositories:

  1. Stop the apache you built from source. sudo /usr/local/sbin/apache2/apachectl stop.
  2. Just use the apache installed from the repos. Start it, or if its already running, restart it: sudo /etc/init.d/apache2 restart
  3. Unless you created init scripts when you built from source, you can safely ignore the installation from source - just don't start it manually again and you'll be fine.

Option B: Just use the apache you built from source

  1. Stop the repository provided apache. sudo /etc/init.d/apache2 stop
  2. Remove the apache from the repositories. sudo aptitude remove apache2
  3. Start (or restart) apache that you built. sudo /usr/local/apache2/bin/apachectl graceful
2
  • Thanks for your reply. The following packages will be REMOVED: apache2 0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 474 kB will be freed. The following packages have unmet dependencies: apache2-mpm-prefork : Depends: apache2 (= 2.4.10-1ubuntu1) but it is not going to be installed. The following actions will resolve these dependencies: Remove the following packages: 1) apache2-mpm-prefork This is what comes up when I go for OPTION B. Can you help me understand whether I should go ahead or not?
    – conradg
    Feb 14, 2015 at 1:06
  • yes, go ahead and remove the packages. Feb 14, 2015 at 1:14
6

Yes - they are reporting different version numbers hence are different instances of Apache.

/usr/local/apache2 is the default base directory for a apache compiled from source, while the other one with files in /usr/sbin and /etc is the Ubuntu distributed version.

Unless you have a very specific reason for doing otherwise it is best practice to stick with the packages supplied by your distro. Updates will be managed via the package manager system and it should stay in sync with the rest of your OS.

5
  • I guess one reason for going with the source version might be that it is better documented? For example, I'm trying to set up mod_wsgi, and it seems I need to add a line LoadModule wsgi_module modules/mod_wsgi.so. In the source conf file, httpd.conf, there are a lot of other LoadModule lines, as suggested in the various docs I've read. But in the Ubuntu version, there's no such thing... or is there?
    – conradg
    Feb 14, 2015 at 0:39
  • 1
    @conradg I don't think source versions are better documented. After all, the OS version is created from the source version, so it should include basically the same documentation. In this case, I'd be surprised if the Ubuntu version doesn't have a configuration file somewhere with many of the same LoadModule lines. (This is not really documentation, but configuration)
    – David Z
    Feb 14, 2015 at 0:59
  • @DavidZ Debian makes many changes to Apache's configuration, most of which range from slightly odd to bizarre. Ubuntu inherits these changes. One of those slightly odd changes is where to place directives like LoadModule (there's a command line utility for this). Feb 14, 2015 at 5:26
  • 1
    A problem with Ubuntu is that it ships an old outdated mod_wsgi version that has various known issues that have since been addressed. With Linux distributions being so far behind on versions, in some cases for mod_wsgi over 20 versions behind, you can't blame people for wanting to use packages from source code. Linux distributions are slowly killing the incentive for working on open source projects as there is no point improving packages when, because of the Linux distributions, users are stuck with 2 year old versions. Feb 14, 2015 at 23:26
  • 1
    So use operating system packages may seem attractive, but in practice it is pretty stupid unless you want to be stuck with very old versions for which there is no support because developers will not support such old versions. Linux distributions don't support the packages either, even though it has been their choice to keep users on old versions. So that using a package from from the Linux distributions means it is supported is nonsense. Feb 14, 2015 at 23:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .