• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install Apache from source code on Ubuntu 17.04

{{postValue.id}}

To install Apache from source code on Ubuntu 17.04

Apache is a web server used to server web page content over HTTP and HTTPS protocol. For the easy installation of Apache web server, we normally use yum install command to install Apache in the system. In this tutorial, we will install Apache by compiling from its source code on Ubuntu 17.04.

Installing Apache

First, you need to download the Apache package by making use of the wget command in the following manner.

root@linuxhelp:~# wget http://redrockdigimark.com/apachemirror//httpd/httpd-2.2.34.tar.bz2
--2017-11-17 15:30:41--  http://redrockdigimark.com/apachemirror//httpd/httpd-2.2.34.tar.bz2
Resolving redrockdigimark.com (redrockdigimark.com)... 119.18.61.94
Connecting to redrockdigimark.com (redrockdigimark.com)|119.18.61.94|:80... connected.
HTTP request sent, awaiting response...
200 OK
Length: 5779739 (5.5M) [application/x-tar]
Saving to: ‘ httpd-2.2.34.tar.bz2’ 

httpd-2.2.34.tar.bz 100%[===================> ]   5.51M  --.-KB/s    in 0.1s   

2017-11-17 15:30:58 (45.6 MB/s) - ‘ httpd-2.2.34.tar.bz2’  saved [5779739/5779739]

Next, extract the downloaded tar file.

root@linuxhelp:~# tar -xf httpd-2.2.34.tar.bz2

Then create a directory in which you want to install your Apache Web Server.

root@linuxhelp:~# cd /usr/local/

Create an Apache directory.

root@linuxhelp:/usr/local# mkdir apache

Now, Move inside the directory .

root@linuxhelp:~# cd httpd-2.2.34

Make sure your configure script has the location as its prefix.

root@linuxhelp:~/httpd-2.2.34# ./configure --prefix=/usr/local/apache --enable-shared=max
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu


checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... x86_64-unknown-linux-gnu
.
.
.
.
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands

Once it is done, you make sure you run the make and make install commands which kickstart and completes the installation of all the required apache packages in your directory.

root@linuxhelp:~/httpd-2.2.34# make
Making all in srclib
make[1]: Entering directory ' /root/httpd-2.2.34/srclib' 
Making all in apr
make[2]: Entering directory ' /root/httpd-2.2.34/srclib/apr' 
make[3]: Entering directory ' /root/httpd-2.2.34/srclib/apr' 
/root/httpd-2.2.34/srclib/apr/build/mkdir.sh tools
/bin/bash /root/httpd-2.2.34/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/httpd-2.2.34/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.34/srclib/apr/include/arch/unix -I/root/httpd-2.2.34/srclib/apr/include -I/root/httpd-2.2.34/srclib/apr/include/private -I/root/httpd-2.2.34/srclib/apr/include/private  -o tools/gen_test_char.lo -c tools/gen_test_char.c & &  touch tools/gen_test_char.lo
.
.
.
generators/libmod_status.la modules/generators/libmod_autoindex.la modules/generators/libmod_asis.la modules/generators/libmod_cgi.la modules/mappers/libmod_negotiation.la modules/mappers/libmod_dir.la modules/mappers/libmod_actions.la modules/mappers/libmod_userdir.la modules/mappers/libmod_alias.la modules/mappers/libmod_so.la server/mpm/prefork/libprefork.la os/unix/libos.la -lm /root/httpd-2.2.34/srclib/pcre/libpcre.la /root/httpd-2.2.34/srclib/apr-util/libaprutil-1.la /root/httpd-2.2.34/srclib/apr-util/xml/expat/libexpat.la /root/httpd-2.2.34/srclib/apr/libapr-1.la -lrt -lcrypt -lpthread -ldl
make[1]: Leaving directory ' /root/httpd-2.2.34' 

root@linuxhelp:~/httpd-2.2.34# make install
Making install in srclib
make[1]: Entering directory ' /root/httpd-2.2.34/srclib' 
Making install in apr
make[2]: Entering directory ' /root/httpd-2.2.34/srclib/apr' 
make[3]: Entering directory ' /root/httpd-2.2.34/srclib/apr' 
make[3]: Nothing to be done for ' local-all' .
make[3]: Leaving directory ' /root/httpd-2.2.34/srclib/apr' 
/root/httpd-2.2.34/srclib/apr/build/mkdir.sh /usr/local/apache/lib /usr/local/apache/bin /usr/local/apache/build 
                             /usr/local/apache/lib/pkgconfig /usr/local/apache/include
.
.
.
mkdir /usr/local/apache/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory ' /root/httpd-2.2.34' 

Now, go to the installed directory and list all the files.

root@linuxhelp:~/httpd-2.2.34# cd /usr/local/apache/
root@linuxhelp:/usr/local/apache# ls -l
total 60
drwxr-xr-x  2 root root  4096 Nov 17 15:43 bin
drwxr-xr-x  2 root root  4096 Nov 17 15:43 build
drwxr-xr-x  2 root root  4096 Nov 17 15:43 cgi-bin
drwxr-xr-x  4 root root  4096 Nov 17 15:43 conf
drwxr-xr-x  3 root root  4096 Nov 17 15:43 error
drwxr-xr-x  2 root root  4096 Jul  7 00:49 htdocs
drwxr-xr-x  3 root root  4096 Nov 17 15:43 icons
drwxr-xr-x  2 root root  4096 Nov 17 15:43 include
drwxr-xr-x  3 root root  4096 Nov 17 15:43 lib
drwxr-xr-x  2 root root  4096 Nov 17 15:43 logs
drwxr-xr-x  4 root root  4096 Nov 17 15:43 man
drwxr-xr-x 14 root root 12288 Jul  7 00:50 manual
drwxr-xr-x  2 root root  4096 Nov 17 15:43 modules

And view the configuration file by making use of the following commands.

root@linuxhelp:/usr/local/apache# vim  conf/httpd.conf
root@linuxhelp:/usr/local/apache# /usr/local/apache/bin/apachectl start

Copy the service script towards /etc/init.d/ location. Make use of the following commands for the same purpose.

root@linuxhelp:/usr/local/apache# cp /usr/local/apache/bin/apachectl /etc/init.d/apachectl
root@linuxhelp:/usr/local/apache# chmod +x /etc/init.d/apachectl

Add the /etc/init.d/apachectl in /usr/sbin/update rc.d with the help of the following commands.

root@linuxhelp:/usr/local/apache# /usr/sbin/update-rc.d -f apachectl defaults
root@linuxhelp:/usr/local/apache# adduser --system apache
Adding system user `apache'  (UID 123) ...
Adding new user `apache'  (UID 123) with group `nogroup'  ...
Creating home directory `/home/apache'  ...

Make sure you also do the daemon configuration.

root@linuxhelp:/usr/local/apache# cd /etc/systemd/system
root@linuxhelp:/etc/systemd/system# nano apache2.service

[Unit]
Description=The Apache Webserver
After=network.target nss-lookup.target time-sync.target remote-fs.target
Before=getty@tty1.service plymouth-quit.service xdm.service
PartOf=apache2.target

[Service]
Type=notify
PrivateTmp=true
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl reload
ExecStop=/usr/local/apache/bin/apachectl stop
KillMode=mixed
TasksMax=infinity
NotifyAccess=all

[Install]
WantedBy=multi-user.target
Alias=httpd.service apache.service

Reload the daemon now.

root@linuxhelp:/etc/systemd/system# systemctl daemon-reload

After that, start and enable the service.

root@linuxhelp:/etc/systemd/system# systemctl start apache2.service
root@linuxhelp:/etc/systemd/system# systemctl enable apache2.service
Created symlink /etc/systemd/system/httpd.service &rarr  /etc/systemd/system/apache2.service.
Created symlink /etc/systemd/system/apache.service &rarr  /etc/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service &rarr  /etc/systemd/system/apache2.service.

Now, you need to Switch to your browser and type yourIP. It works.

It Works

With this, the method to install Apache from its source on Ubuntu 16.04 comes to an end.

Tags:
gabriel
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Where to get the apache source package?

A

use the link to get source package of apache,
"https://github.com/apache/httpd/archive/".

Q

Where to download the apr and apr-util ?

A

Please use the link as follow to download apr and apr-util
"https://github.com/apache/apr-util/archive/ " and "https://github.com/apache/apr/archive/".

Q

Why are the license files for the different Apache Software Foundation projects different?

A

While the core Apache developed code will be under one of the Apache licenses, other third party works may have been included and their license text may have been added to the Apache projects' LICENSE or NOTICE files. Alternatively, they may be available separately.

Q

Is there a fee for using Apache software in a commercial product?

A

No. We do not distinguish between personal, internal, or commercial use of our software, nor does the ASF charge for any of them. Packaging and redistribution of any of it is subject to the terms of our license , however.

Q

Is software from The Apache Software Foundation free of charge?

A

Yes. All software developed by all projects of The Apache Software Foundation is freely available without charge from the Foundation's Web sites. This is specified in the Foundation's Articles of Incorporation and explained in more detail about why our software is always free (no charge).

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.