Skip to content

Instantly share code, notes, and snippets.

@mansurali901
Last active March 19, 2018 13:19
Show Gist options
  • Save mansurali901/a5952cecabe1799310f340398386ee7b to your computer and use it in GitHub Desktop.
Save mansurali901/a5952cecabe1799310f340398386ee7b to your computer and use it in GitHub Desktop.
Install Apache2 in CentOS 6.8 with APR 1.6.3
#!/bin/bash
# This script is designed to installation apache
# from source code with all options using apr &
# apr-utils and library for portability
# Author : Mansur Ul Hasan
# EMail : [email protected]
# Skype : genious840
# Facebook : https://www.facebook.com/itmarkaz
# YouTube : https://www.youtube.com/user/mansur7820
# Function for Preparing System
PrepareSystem () {
# Preparing system for Installation
yum update -y
# Removing uneccasry tools that will cause issues
# in installation of the program
yum autoremove apr apr-utils apr-utils-devl
# Installtion of Development Tools
yum groupinstall "Development Tools"
}
# Gathering required stuff and ram packages
Source_down () {
# Apache 2.4.32 Package which is latest till script written
wget http://archive.apache.org/dist/httpd/httpd-2.4.32.tar.gz
# Apache Portable Runtime Environemnt Tools
wget http://www-us.apache.org/dist//apr/apr-1.6.3.tar.gz
# Apache Portable Runtime Environemnt utilities
wget ftp://ftp.mirrorservice.org/sites/ftp.apache.org/apr/apr-util-1.6.1.tar.bz2
}
# Function to prepare source code
PreSourceCode () {
# Making Temp directory
mkdir -p /usr/local/apache-source
# Moving downloaded to appropriate directory
mv -v httpd-2.4.32.tar.gz apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 /usr/local/apache-source/
cd /usr/local/apache-source
# Extraction of source code
tar -vxf *.tar.gz
# Downloading prerequisites for extraction
yum install bunzip2; bunzip2 apr-util-1.6.1.tar.bz2; tar -xvf apr-util-1.6.1.tar
# Moving APR to SRCLib which is correct path for compilation
mv apr-util-1.6.1 apr-util ; mv -v apr-util httpd-2.4.32/srclib/
mv apr-1.6.3 apr ; mv apr-1.6.3 httpd-2.4.32/srclib/
}
InstallCode () {
# For now we are compiling Apache with default modules
# because we don not required for now but if you wish to
# Know other compilation option for apache 2.4.32 you can
# Issue below command.
# cd /usr/local/apache-source/; ./configure --help
# Above command will tell you the list option can
# be use during compilation.
./configure --with-included-apr
make
make install
cd /usr/local/apache2/bin
./apachectl start
ps aux |grep apache
}
# Functions calling area
PrepareSystem
Source_down
PreSourceCode
InstallCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment