You are here:

Unix/Linux OS/Install latest openssl and apache2 on Ubuntu 16.04.1 LTS

Advertisement


Question
How can you successfully install the latest versions of openssl and Apache2 on Ubuntu 16.04.1 LTS?

Answer
I just upgraded Ubuntu 14 LTS to Ubuntu 16.04.1 LTS and needed to secure LAMP to the point of disabling IE8, etc. with all the old ciphers. The consensus I found on the web was to use latest packages for OpenSSL, Apache2 and PHP5.

I tried to install them beside existing packages and it became to convoluted to keep the libraries straight. - The solution was to remove the packages related to what I was trying to install.

First, this process assumes you already have the relevant development tools installed. Things like gcc, g++, make, cmake, tons of lib-devs, etc.

I created a virtual machine duplicate of my development server so I could test this process without worrying about whether it would work. If you have resources to do the same thing, that's a good idea.

As of 08/29/2016, the packages and files in my install folder were:
Install (see below...)
httpd-2.4.23-deps.tar.gz
httpd-2.4.23.tar.gz
mod_fcgid-2.3.9.tar.gz
openssl-1.0.2h.tar.gz
openssl.ld (a needed file for Ubuntu/Debian compilation)
pcre-8.39.tar.gz
php-5.6.25.tar.gz

openssl installs to /usr/local/ssl
apache installs to /usr/local/apache2
php installs to /usr/local/php
Remember to modify your PATH variable/routine as needed afterwards...

The installed version of pcre was not compatible, but the package did not have to be removed.
The FastCGI module for Apache is optional.
Note that when compiling PHP5, I have the Oracle Client libs referenced - you can remove that for a straight LAMP server if you have no need to connect to Oracle databases. Otherwise you need to download and install them first.
Also note that the location of the mysql socket may be different on your systems - check your my.cnf file(s).

Here are the commands I used in my Install file:

#!/bin/bash
#
# This installs the latest (as of 08/29/2016) versions of
# openssl, apache2 and php5 on Ubuntu 16.04.1 LTS Server
#

# First - remove conflicting packages, update and clean up system
apt-get remove apache2
apt-get remove apache2-bin
apt-get remove apache2-data
apt-get remove apache2-doc
apt-get remove openssl
apt-get remove php5-cli
apt-get remove php5-dev
apt-get remove php5-common
apt-get update
apt-get upgrade
apt-get autoremove

# Now install openssl
Dist=`pwd`
# Got a version of openssl.ld for 1.0.2h that satisfied ssh,git,etc. versioning within Ubuntu
# Got it from: https://gist.github.com/Scottmitch/71a89d98b3af272aab6ae6bfed122c5a
# (I had to remove the last dependency "OPENSSL_1.0.2" on line 4682 [the last line] for it to compile properly...)
# Make sure you maintain an absolute reference to openssl.ld or subsystems will fail during linking
rm -r openssl-1.0.2h 2>/dev/null
tar xzf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
make clean
./config shared -Wl,--version-script=$Dist/openssl.ld enable-ec_nistp_64_gcc_128 no-rc5 no-idea no-ssl2 no-ssl3 -DOPENSSL_NO_HEARBEATS
make depend
make
make install
cd ..
# And ensure the ssl libraries show up in the library path for compiling
echo "# openssl configuration
/usr/local/ssl/lib
" > /etc/ld.so.conf.d/ssl.conf
ldconfig

# Install compatible version of libpcre - this defaults to /usr/local/lib, so it should be in the library path already
wget --no-check-certificate https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz
tar xzf pcre-8.39.tar.gz
cd pcre-8.39
./configure
make
make check
make install
cd ..

# Now install Apache2
tar xzf httpd-2.4.23.tar.gz
tar xzf httpd-2.4.23-deps.tar.gz
cd httpd-2.4.23
./configure --with-ssl=/usr/local/ssl --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-mpm=prefork --with-included-apr --enable-mpms-shared=all --enable-mods-shared=reallyall
make
make install
cd ..

# Optional install of FastCGI module for Apache2
tar xzf mod_fcgid-2.3.9.tar.gz
cd mod_fcgid-2.3.9
export APXS=/usr/local/apache2/bin/apxs; ./configure.apxs
make
make install
cd ..

# Now install PHP5
tar xzf php-5.6.25.tar.gz
cd php-5.6.25
./configure\
 --with-apxs2=/usr/local/apache2/bin/apxs\
 --with-pdo-mysql\
 --with-gd\
 --enable-mbstring\
 --with-mysql-sock=/var/run/mysqld/mysqld.sock\
 --with-pdo-oci=instantclient,/usr/local/instantclient_11_2,11.2\
 --prefix=/usr/local/php\
 --with-config-file-path=/usr/local/php\
 --with-zlib\
 --with-gettext
make
make install


Enjoy!
Larry

Unix/Linux OS

All Answers


Answers by Expert:


Ask Experts

Volunteer


mkitwrk

Expertise

Expert: Creating and managing *nix database/application servers for use with dl4/unibasic/mysql/apache/thoroughbred applications, especially in medical environments. Strengths: scripting, backup and disaster recovery, mysql, apache2, routing, samba/smbfs/cifs, LPRng, CUPS, telnet/ssh/sftp, vsftp, rsync, new system preparation, system duplication, database design, system conversions (AIX/SCO-OS5/Linux) Currently working on scripted setup of LAMP servers using PDO for MySQL and Oracle. Compiling Apache2, openssl, php and libxml2 from source and linking to libraries for MySQL and Oracle InstantClient. Works great so far! Familiar With: php, c, awk, sed, gnome, nfs and lots of other *nix tools

Experience

I've been head of development at our company since 1984. Our OS's at that time were Point 4's IRIS and Altos' Xenix. Then: SCO Xenix, SCO Unix, AIX, SCO-OS5, Caldera, RedHat 7, Debian Sarge, RedHat ES4, Debian Etch, Redhat ES5, Debian Lenny, RedHat ES6, Debian Squeeze. I've migrated our clients through those various versions with minimal interruption while preserving their investments in hardware and staff knowledge over time.

Education/Credentials
1980 BSBA Washington University, Saint Louis, Missouri

©2016 About.com. All rights reserved.