Re: sudo: apachectl: command not found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey mike,

This was added to draft, so I'm re-sending this.
I tried the command with -f option myself like this. (sudo /usr/local/apache2/bin/apachectl -V -f /usr/local/apache2/conf/httpd.conf) And the result is,

[sudo] password for padmahas:
Server version: Apache/2.4.12 (Unix)
Server built:   Mar 31 2015 16:20:21
Server's Module Magic Number: 20120211:41
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

On Wed, Apr 1, 2015 at 9:26 AM, Padmahas Bn <padmahas@xxxxxxxxx> wrote:
Hello mike,

I would like to clarify one thing. Whatever the apache related command I execute inside /usr/local/apache2/bin, it all affecting the apache inside /usr. The exact reason may be because I installed apache inside /usr at first and only later I installed in "usr/local...."

Hence if you want exact result of the sudo /usr/local/apache2/bin/apachectl -V, please tell me how to explicitly specify the path as you suggested me in the last command using -f option(sudo /usr/local/apache2/bin/apachectl -k start -f /usr/local/apache2/conf/httpd.conf ).

So tell me if apache configures any environment variables and it may not overwriting the path when I install second time inside /usr/local....

The steps I used to install apache2
To install apr and apr-util I followed this link (http://www.linuxfromscratch.org/blfs/view/svn/general/apr.html). This is where I came to know about --prefix option and I used "/usr" from this tutorial. But irrespective of using /usr as --prefix, apr installed inside /usr/local.

Hence I used the same option for apache2 like this. ./configure --prefix=/usr
Unfortunately apache2 was installed in the exact location inside /usr, by merging its files inside bin.


Later I read in apache documentation, if --prefix not specified it will install inside /usr/local... so I thought it would be easy if all apache files is available inside one directory (apache2) which will be created by server. This time I just ran ./configure. And you know the later part.

Two installations are conflicting with each other. Only the first installation is valid and the second is not even executing server start command.

So is there any way I can completely uninstall apache? something similar to "make uninstall". "make uninstall" is not working I don't know why.

On Wed, Apr 1, 2015 at 5:42 AM, Mike Rumph <mike.rumph@xxxxxxxxxx> wrote:
Hello Padmahas,

Okay.  This tells us a few things.
One problem is that the HTTPD_ROOT is set to /usr instead of /usr/local/apache2.
Other relative paths will be based from here.
Since the SERVER_CONFIG_FILE is set to conf/httpd.conf,
the default config file will be /usr/conf/httpd.conf instead of /usr/local/apache2/conf/httpd.conf.
The -f switch allowed you to override this.

What steps did you use to install and configure httpd into  /usr/local/apache2?
In your httpd source directory, what are the contents of the config.nice file?

You could review the following links:
- http://httpd.apache.org/docs/2.4/install.html#configure
- http://httpd.apache.org/docs/2.4/programs/configure.html

Take care,

Mike


On 3/31/2015 4:19 PM, Padmahas Bn wrote:
Hello mike,

Yes you are write I installed server first inside /usr and then inside /usr/local/apache2 (installed by default when I used ./configure without --prefix option). Even you are right about my manual un installation.

About the command you suggested with -V option, this is the result.

Server version: Apache/2.4.12 (Unix)
Server built:   Mar 31 2015 16:20:21
Server's Module Magic Number: 20120211:41
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

I looked inside /usr/local/apache2/bin/apachectl, the HTTPD var set to
HTTPD='/usr/local/apache2/bin/httpd'

In parallel I also looked inside /usr/bin/apacheclt, there the HTTPD var set to

HTTPD='/usr/bin/httpd'. So I assume both of them pointing to their respective directories.

I tried the second command you suggested
sudo /usr/local/apache2/bin/apachectl -k start -f /usr/local/apache2/conf/httpd.conf

Good news
The server started with usual warning message but Yes!!! it is using the httpd.conf file which resides inside /usr/local/apache2/conf/httpd.conf.
The message it always show is,
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

Now is there any way I can set apache to look inside /usr/local/apache2/conf/httpd.conf  by default, by forgetting the first installation inside /usr? Or should I always specify the httpd.conf path as you suggested?

Thank you for the documentation links, I'm referring those links now.

On Tue, Mar 31, 2015 at 10:11 PM, Mike Rumph <mike.rumph@xxxxxxxxxx> wrote:
Hello Padmahas,

It looks like your two installations of Apache httpd 2.4 are conflicting with each other.
If I understand correctly, you first installed into /user and then into /usr/local/apache2.
Then you tried to remove the /user installation by deleting files manually.
(As you've seen, /user is not a good choice, because this is used for many other things as well.)
It would probably help to do a fresh installation.
But let's try a few things first.

When tried " sudo /usr/local/apache2/bin/apachectl -k start "
It gave " httpd: Could not open configuration file /usr/conf/httpd.conf: No such file or directory ".
You are probably wanting to use /usr/local/apache2/conf/httpd.conf instead.

What results do you get from sudo /usr/local/apache2/bin/apachectl -V   ?
Look inside /usr/local/apache2/bin/apachectl 
What is the variable HTTPD set to?
You could try using sudo /usr/local/apache2/bin/apachectl -k start -f /usr/local/apache2/conf/httpd.conf
to override the config file location.

See the following links for further options on the apachectl or httpd commands:
- http://httpd.apache.org/docs/2.4/programs/apachectl.html
- http://httpd.apache.org/docs/2.4/programs/httpd.html

Thanks,

Mike Rumph


On 3/31/2015 3:36 AM, Padmahas Bn wrote:
If anyone finds this as a big question please let me know. I'll precise my problem.

Steps I followed:


I installed apr and apr-utils package in the path "/usr" using the --prefix option.

Both were installed successfully. Hence I installed apache 2.4 to the same path ("/usr") using --prefix option while running "./configure" .

Later I came to know if prefix is not mentioned for apache2.4 installation, it will be installed inside /usr/local/apache2 by default.

Hence I again installed without specifying --prefix option which does installed the apache2 into /usr/local/apache2.

Now I cd to /usr/local/apache2/bin and run sudo apachectl -k start and the apache server was started successfully. Only later I came to know the server is running from the /usr files  installed at first time.

Instead of having 2 installations I thought of removing the one installed inside /usr and deleted all files manually and carefully from all sub folders of /usr.

Now when I run the server from /usr/local/apache2 using " sudo apachectl -k start " it says sudo: apachectl: command not found

So I supplied full path using " sudo /usr/local/apache2/bin/apachectl -k start "

But its giving " httpd: Could not open configuration file /usr/conf/httpd.conf: No such file or directory ".

Thank you.






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux