How do I install and run Apache2?

9,218

You should just install the repository version:

sudo apt-get install apache2

Start it running like this:

sudo service apache2 restart

Assuming it's working, you should see a basic greeting at http://localhost/. If you're looking for CGI scripting, I found this question helpful; otherwise you can start putting static content to serve in /var/www/ or configuring the operation of Apache with /etc/apache2/apache2.conf.

Share:
9,218

Related videos on Youtube

ltalhouarne
Author by

ltalhouarne

Android application development is my profession, passion, desire, i don't know its way cooler than any other technology.

Updated on September 18, 2022

Comments

  • ltalhouarne
    ltalhouarne over 1 year

    I have downloaded apache2 from the official site and compiled and installed it per the given instructions there, but on running I get an error:

     ulimit: 88: error setting limit (Operation not permitted)
     /usr/sbin/apache2ctl: 148: /usr/sbin/apache2: not found
     The Apache error log may have more information.
    
    • lumbric
      lumbric over 12 years
      Why didn't you install the apache package from the ubuntu repos? (just run sudo apt-get install apache2 in a terminal) Does the error log provide more information as mentioned? (look at /var/log/apache2/error.log)
    • ltalhouarne
      ltalhouarne over 12 years
      i have installed as you stold but while running i am getting an erro like ulimit: 88: error setting limit (Operation not permitted) apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information.
    • ltalhouarne
      ltalhouarne over 12 years
      any command to uninstall the previous apache
  • ltalhouarne
    ltalhouarne over 12 years
    * Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [ OK ] i got this and apache is running thanks
  • Jeroen
    Jeroen over 10 years
    I've had a similar problem to the OP, however I did install it using the sudo apt-get install apache2 command. When I run sudo service apache2 restart it gives me an error: No apache MPM package installed