• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to install Apache from source code on Ubuntu 17.04

2356

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

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).

Related Tutorials in How to install Apache from source code on Ubuntu 17.04

Related Tutorials in How to install Apache from source code on Ubuntu 17.04

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018

Related Forums in How to install Apache from source code on Ubuntu 17.04

Related Forums in How to install Apache from source code on Ubuntu 17.04

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017

Related News in How to install Apache from source code on Ubuntu 17.04

Related News in How to install Apache from source code on Ubuntu 17.04

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
Attackers take advantage of Apache Struts vulnerabilities
Attackers take advantage of Apache Struts vulnerabilities
Mar 17, 2017
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 Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

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.