Project httpsrv 2.0 – Script to compile, install and manage on DEB/RPM based Linux

Httpsrv 2.0 is my attempt to make it easier to compile your own LAMP STACK on Linux
The tutorial expects your selinux to be runing in permissive-mode and firewalls are turned off
This tutorial is writen for CentOS6/7 and Ubuntu Linux. It will probably work on RedHat, fedora
Security holes, vulnerabilities and bugs in the software shall be reported to each individual project
This Script is only tested with sourcearchives and softwareversions found in
I take no responsibility for this script, use at your own risk

Video: Click here to watch on YouTube

1 Install dependencies and other software

Copy and paste one line at a time

apt-get install libpcre3-dev libbz2-dev libfreetype6-dev libicu-dev g++ libxslt-dev -y
apt-get install gcc make nano libjpeg-dev libpng-dev libxml2-dev libcurl4-openssl-dev -y
apt-get install libssl-dev libmcrypt-dev libreadline-dev pkg-config unzip wget -y

Copy and paste one line at a time

yum install gcc make openssl-devel nano epel-release libjpeg-devel libpng-devel lynx -y
yum install libxml2-devel libcurl-devel libmcrypt-devel readline-devel freetype-devel -y
yum install bzip2-devel libicu-devel pcre-devel gcc-c++ libxslt-devel unzip wget -y

2 Download and install MySQL

Copy and paste one line at a time

cd /tmp && wget -O mysql-apt.deb && dpkg -i mysql-apt.deb
apt-get update && apt-get install mysql-client mysql-server -y

Copy and paste one line at a time

cd /tmp && wget -O mysql-el6.rpm && rpm -Uvh mysql-el6.rpm
yum install mysql-community-server -y && service mysqld start && cat /var/log/mysqld.log | grep "temporary password"

Copy and paste one line at a time

cd /tmp && wget -O mysql-el7.rpm && rpm -Uvh mysql-el7.rpm
yum install mysql-community-server -y && service mysqld start && cat /var/log/mysqld.log | grep "temporary password"

Only for CentOS and other yum installs

You can configure the Password Validation Plugin in MySQL
Se Options and Variables and add them to /etc/my.cnf
Don´t forget to restart the service after editing /etc/my.cnf
systemctl restart mysqld.service or service mysqld restart

MySQL Yum Repository RPM for Fedora Linux:
MySQL Zypper Repository RPM for SUSE Linux:

3 Download httpsrv using wget
Copy and paste one line at a time

cd /tmp && wget
cd /tmp && unzip -d /srv

4 Edit and configure variables in /srv/httpsrv/tmp/
Uncomment the ‘sock_file’-variable depending on system in use…
Ubuntu: #sock_file=/run/mysqld/mysqld.sock => sock_file=/run/mysqld/mysqld.sock
CentOS: #sock_file=/var/lib/mysql/mysql.sock => sock_file=/var/lib/mysql/mysql.sock


cd /srv && chmod -R 777 /srv/httpsrv
nano /srv/httpsrv/tmp/

5 Configure and build httpsrv, httpd (Apache) + PHP and phpMyAdmin
Copy and paste one line at a time

/srv/httpsrv/tmp/ web_conf
/srv/httpsrv/tmp/ web_make
/srv/httpsrv/tmp/ php_conf
/srv/httpsrv/tmp/ php_make
/srv/httpsrv/tmp/ finalize
mysql -u root -p < /srv/httpsrv/phpmyadmin/sql/create_tables.sql

6 Edit: /srv/httpsrv/conf/httpd.conf
Ex: nano /srv/httpsrv/conf/httpd.conf
Define a new variable called ‘root_path’ on the row below the ”ServerRoot” directive:

Define root_path /srv/httpsrv

7 Edit, add and change below in httpd.conf
Ex: nano /srv/httpsrv/conf/httpd.conf

LoadModule rewrite_module modules/
User httpsrv
Group httpsrv
ServerName httpsrv:80
# AllowOverride controls what directives may be placed in .htaccess files.
# This directive is for the directory: /srv/httpsrv/htdocs
AllowOverride All
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Add this line to the bottom of your configuration.
# Configurationfile for phpmyadmin, aliases and permissions:
Include conf/extra/phpmyadmin.conf

8 Restart httpsrv and configure autostart


update-rc.d init-httpsrv defaults && httpsrv restart


chkconfig --add init-httpsrv && chkconfig init-httpsrv on && httpsrv restart

You can now test your installation
Open a web browser and navigate to:

Read this post to enhance security on SFTP and httpsrv 2.0:
Project httpsrv v2.0 – Increase security with chrooted user using SSH (SFTP) Linux

More actions in this script

Start the webserver
httpsrv start

Stop the webserver
httpsrv stop

Restart the webserver
httpsrv restart

Display active processes
httpsrv stats

Display executabes and there versions
httpsrv info

Display were configurationfiles are:
httpsrv conf

Change permissions, owner and group on /srv/httpsrv/htdocs
httpsrv perm

Change permissions, owner and group on /srv/httpsrv
httpsrv perm_all

Validate configurationfile for Apache2 (httpd)
httpsrv conftest

Create a new empty directory in /srv
cd /srv && httpsrv update_all

Uninstall and remove /srv/httpsrv
cd /srv && httpsrv remove_all

Configurations and variables

Variables in httpsrv/tmp/

This hasn’t been tested and shall be considered experimental
You will have to change those before you compile and install

User and Group used when changing perrmisions on files and folders
OBS: httpsrv/chroot will always be owned by the root user and group

The path were httpsrv will be installed

User and Group used when changing perrmisions on files and folders for the service
OBS: httpsrv/chroot/htdocs will always be owned by the httpsrv user and group

Variables to hold links that will be used in the script to download sourcefiles
Httpsrv is tested with the versions on those links but you are free to experiment

Download new apr1_src:
Download new apr2_src:
Download new web_src:
Download new php_src:

Uncomment one of those variable depending on system in use
This variable enabled php to connect to MySQL via the local Unix-Socket

Configurationfiles for httpsrv

Main configurationfile for Apache

Main configurationfile for php

Main configurationfile for phpMyAdmin
Use this file to change your blowfish_secret

Main configurationfile for MySQL

Executables and script

Some files are linked to /usr/local/sbin and will be accessible through the whole system


/usr/local/sbin/php = Call this with help to find out more info
/usr/local/sbin/phpize = Can be used when compiling PECL extensions
/usr/local/sbin/htpasswd = Used with flat-files for basic authentication in httpd
/usr/local/sbin/htdigest = Used with flat-files for digest authentication in httpd
/usr/local/sbin/htcacheclean = Used to clean up disk cache in httpd (apache)
/usr/local/sbin/httpsrv = Main script to manage httpsrv (apache and php)
/etc/init.d/init-httpsrv = Initscript to enable autostart of httpsrv

Usefull links for more reading:

Donation are not required but very much appreciated.
Click the below link to donate with PayPal (PayPal.Me)