Ubuntu Linux Install Apache 2 Web-Server Software

How do I install Apache 2 software on Ubuntu Linux using command line options?

The web server is responsible for providing access to content via the HTTP protocol. Apache supports a variety of features, many implemented as compiled modules which extend the core functionality. These can range from server-side programming language support to authentication schemes. Some common language interfaces support Perl, Python, Tcl, and PHP.

ADVERTISEMENTS

You need to login as root user to install Apache 2 server.

Install Apache2 on Ubuntu

The Apache2 (HTTPD) web server is available in Ubuntu Linux. You can install Apache2 using apt-get command. Open a console (terminal) and type the following command to update existing packages:

sudo apt-get update

Next, type the following command to install Apache2 web server:

sudo apt-get install apache2

Apache 2 configuration files

  1. Default http port – 80
  2. Default https (SSL) port – 443
  3. Default configuration directory – /etc/apache2/
  4. Various configuration file directory – /etc/apache2/conf.d/
  5. Various configuration files to load modules and configure them directory – /etc/apache2/conf.d/mods-available/ , also /etc/apache2/conf.d/mods-enabled/ is symlinked to this directory.
  6. Apache virtual hosting configuration directory – /etc/apache2/sites-available/ ,also /etc/apache2/sites-enabled contains symlinks to the /etc/apache2/sites-available directory.
  7. Default main configuration file – /etc/apache2/apache2.conf
  8. Default TCP/IP ports configuration file – /etc/apache2/ports.conf
  9. Default environment configuration file – /etc/apache2/envvars (various Apache2 environment variables are set such as username, PID file etc.)

You can edit all the configuration files using nothing but a text editor such as vim or joe.

Confirm Minimal Built-in Modules

Type the following command to display the set of compiled-in modules
$ httpd -l
Sample Outputs:

Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  prefork.c
  http_core.c
  mod_so.c
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdig host ip nmap
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w

ADVERTISEMENTS
1 comment… add one
  • Lee Murray Sep 23, 2010 @ 15:28

    is it better to use the ubuntu installer for apache or to manually download and install apache?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.