Howto host using ehcp on different platforms ?

Windows:
Now easiest way i think: install vmware or virtualbox on Windows,
install Ubuntu onto virtual machine,
then install ehcp inside...
This way, ehcp may be installed on any os...

Other Linuxes:
You need to install hosting softwares manually...Such as apache, dns, postfix, vsftpd,
ehcp installs these on Ubuntu/debian based OS'es,
but cannot install on other linuxes...
Because ehcp installs all software using apt-get...

more info may be written here...

Comments

Hi We have installed EHCP on Mandriva 2009 and Centos 5. The following are the changes you need to make:
1. install the following packages through RPM
a. apache with mod_php
b. php with php_mysql & php_cli (command line interface for php)
c. mysql . After mysql installation check for the mysql local socket, ehcp needs the file as /var/lib/mysql.sock/mysq/mysql.sock. If you are not abl to find it use this command
mysqladmin -uroot -ppassword variables |grep -i sock
now create a link to this file as
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

if the installation of rpms goes well , everything should be configured for properly. if you choose to install these software through source compilation , then you may have to configure them manually.

2. unzip ehcpXXXXX.tar.gz in the web root for the apache. For RPM installations it would be /var/www/html , for non RPM (Source Compilations) please use the dir that you have configured.

3. edit the install.sh file and comment all Debian/Ubuntu related functions and apt-get calls. This is the install file we have used:
************************************************************
************************************************************
ehcpversion="0.29"

echo
echo
echo "Please Wait..."
echo
echo

################################################################################################
# Function Definitions #
################################################################################################

function infoMail(){
ip=`ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{print $2}' `
wget -q -O /dev/null --timeout=10 http://www.iyibirisi.com/diger/msg.php?msg=$1.$ip
# echo "(infoMail) your ip is: $ip"
}

# Function to kill any running ehcp / php daemons
function killallEhcp() {
for i in `ps aux | grep ehcpdaemon.sh | grep -v grep | awk -F " " '{ print $2 }'`;do
kill -9 $i;
done

for i in `ps aux | grep 'php index.php' | grep -v grep | awk -F " " '{ print $2 }'`;do
kill -9 $i;
done
}

#############################################################
# Start Install #
#############################################################

infoMail "ehcp_1_installstarted_ver_$ehcpversion"
killallEhcp

#----------------------start some install --------------------------------------

echo
echo

echo "STAGE 2"
echo "====================================================================="
echo "now running install_1.php "
infoMail ehcp_2_install-starting-install_1.php
php install_1.php

echo
echo
echo "STAGE 3"
echo "====================================================================="
echo "now running install_2.php "
infoMail ehcp_2_2_install-starting-install_2.php
php install_2.php

echo "now running ehcp daemon.."
cd /var/log
/etc/init.d/ehcp restart
echo "ehcp run/restart complete.."

infoMail "ehcp_8_install-finished-install.sh_ver_$ehcpversion"

# you may disable following lines, these are for debug/check purposes.

ps aux > debug.txt
echo "============================================" >> debug.txt
tail -100 /var/log/syslog >> debug.txt

cat debug.txt | sendmail ehcpdeveloper@gmail.com > /dev/null 2>&1

echo "ehcp : Finished all operations.. go to your panel at http://yourip/ now..."

********************************************************************
********************************************************************

4. Now run the install.sh as root .
It may give a few errors which can be ignored or fixed later, but the installation will go thruough. After the installation ends it will open the EHCP home page.

5. use the following to control it

/etc/init.d/ehcp start|stop

the home page can be accessed at http://yourip/ehcp or http://yourip/vhost/ehcp

regards
bhupinder

Hi,
thank you for your good work,
may i ask, what did you do with apt-get commands inside install_lib.php ?

there are apt-get commands inside that file... and may i ask, are all packages, installed by ehcp installer, exists in yum/rpm repositories ? You may find packages in install_lib.php, search for aptget command...

Below is another install script, used by an advanced ehcp user, to start installation, But we didnt yet clarified packages in install_lib.php; if we can figure out same or equivalent packgaes in rpm/yum, we can run full ehcp in rpm based distros... Below, pay attention to installpack function... that is important i think..

#!/bin/bash
# ehcp - Easy Hosting Control Panel install/remove by info@ehcp.net
# this is a very basic shell installer, real installation in install_lib.php, whic is called by install_1.php, install_2.php
#
# please contact me if you made any modifications.. or you need help
# msn/email: info@ehcp.net or debugmail@iyibirisi.com
# skype/yahoo/gtalk: ehcpdeveloper
#
# Marcel
# - added initial support for yum (RedHat/CentOS)
# - some code ordering, documentation and cleanup
#

ehcpversion="0.28"

clear
echo
echo
echo "Please Wait..."
echo
echo

################################################################################################
# Function Definitions #
################################################################################################

# Stub function for apt-get

function installaptget () {
echo "now let's try to install apt-get on your system.";
echo "Not yet implemented";
exit;
}

# Stub function fot yum

function installyum () {
echo "now let's try to install yum on your system.";
echo "Not yet implemented";
exit;
}

# Initial Welcome Screen
# Removed some echo lines, the scripts exits if the linux distro is not compatible with the installer

function ehcpheader() {
echo "STAGE 1"
echo "====================================================================="
echo
echo "--------------------EHCP PRE-INSTALLER $ehcpversion -------------------------"
echo "-----Easy Hosting Control Panel for Ubuntu, Debian and alikes--------"
echo "---------------------Coming soon: Yum support------------------------"
echo "-------------------------www.ehcp.net--------------------------------"
echo "---------------------------------------------------------------------"
echo
echo
echo "Now, ehcp pre-installer begins, a series of operations will be performed and main installer will be invoked. "
echo "if any problem occurs, refer to www.ehcp.net forum section, or contact me, mail/msn: info@ehcp.net"
echo "Please be patient, press enter to continue";read
}

# Get distro name

function CheckDistro() {
cat /etc/*release | grep -i ubuntu && distro="ubuntu"
cat /etc/*release | grep -i red && distro="redhat"
cat /etc/*release | grep -i centos && distro="centos"
cat /etc/*release | grep -i debian && distro="debian"
echo "Your distro is $distro";
}

# Check for yum

function checkyum () {
which yum > /dev/null 2>&1
if [ "$?" == "0" ]; then
echo "yum is available";
return 0;
else
# This should never happen
echo "Please install yum";
installyum;
exit;
fi
}

# Check for apt-get

function checkaptget(){
if [ `which apt-get | wc -w` -eq 0 ] ; then
ehco "apt-get is not found."
installaptget

elif [ `which apt-get | wc -w` -gt 1 ] ; then
ehco "apt-get is not found."
installaptget
fi
echo "apt-get is available"
}

# Retrieve statistics
# This freezed the installer on one of my Centos Servers (needs more investigating)

# ehcpdeveloper:answer: this infomail may be disabled, only for statistical purposes... may hang if for 10 second if user is not connected to internet, or something is wrong with wget or dns resolution...
# no hanging longer than 10 sec should occur... i think.. btw, your code is perfect

function infomail(){
ip=`ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{print $2}' `
wget -q -O /dev/null --timeout=10 http://www.iyibirisi.com/diger/msg.php?msg=$1.$ip
}

# Function to be called when installing packages

function installpack(){

if [ $distro == "ubuntu" ] || [ $distro == "debian" ];then
# first, try to install without any prompt, then if anything goes wrong, normal install..
apt-get -y --no-remove --allow-unauthenticated install $1
if [ $? -ne 0 ]; then
apt-get --allow-unauthenticated install $1
fi
else
# Yum is nice, you don't get prompted :)
yum -y -t install $1
fi
}

# Check if the running user is root, if not restart with sudo

function checkuser() {
if [ `whoami` != "root" ];then
echo "you are $who, you have to be root to use ehcp installation program. switching to root mode, please enter password or re-run install.sh as root"
sudo $0 # modified by ehcpdeveloper - hope this is running script, not functionname :)
exit
fi
}

# Function to kill any running ehcp / php daemons

function killall() {
for i in `ps aux | grep ehcpdaemon.sh | grep -v grep | awk -F " " '{ print $2 }'`;do
kill -9 $i;
done

# This is not SAFE :) ! # ehcpdeveloper: answer: yes, other php related programs also may be killed, but, by killing ehcpdaemon.sh is not enaugh, we need also kill php index.php
#for i in `ps aux | grep php | grep -v grep | awk -F " " '{ print $2 }'`;do
# kill -9 $i;
#done
#killall php;

for i in `ps aux | grep 'php index.php' | grep -v grep | awk -F " " '{ print $2 }'`;do
kill -9 $i;
done

}

# Function to be called when trying to install php and update system

function checkandinstallphp () {
if [ $distro == "ubuntu" ] || [ $distro == "debian" ];then
apt-get update
else
yum -y -t update
fi

installpack php5
installpack php5-mysql
installpack php5-cli
installpack sudo

}

#############################################################
# Start Install #
#############################################################

infomail "ehcp_1_installstarted_ver_$ehcpversion";
ehcpheader;
CheckDistro;
checkuser;
if [ -z $distro ];then
echo "You cannot install ehcp automatically on this system";
exit;
fi
killall;
if [ $distro == "ubuntu" ] || [ $distro == "debian" ];then
checkaptget;
else
checkyum;
fi
checkandinstallphp;

# First php install script begins #

echo
echo
read
echo "STAGE 2"
echo "====================================================================="
echo "now running install_1.php "
infomail ehcp_2_install-starting-install_1.php
php install_1.php

# Second php install script begins #

echo
echo
echo "STAGE 3"
echo "====================================================================="
echo "now running install_2.php "
infomail ehcp_2_2_install-starting-install_2.php
php install_2.php

# The Grand Finale #

echo "now running ehcp daemon: "
cd /var/log
/etc/init.d/ehcp restart > /dev/null &
infomail "ehcp_8_install-finished-install.sh_ver_$ehcpversion"

# you may disable following lines, these are for debug/check purposes.

ps aux > debug.txt
echo "============================================" >> debug.txt
tail -100 /var/log/syslog >> debug.txt

cat debug.txt | sendmail debugmail@gmail.com

echo "ehcp : Finished all operations.. go to your panel at http://yourip/ now..."