GN Latest News

How to Update your EHCP force Version.

How to Block a Suspicious IP Address.
How to Create a User Interface for Spamassassin
Backup and Restore Procedure.
How to Update your Server.
How to Update your EHCP force Version.
Post Reply
Rob Swan
Site Admin
Posts: 73
Joined: Tue Oct 31, 2017 3:03 pm
Location: UK
Contact:

How to Update your EHCP force Version.

Post by Rob Swan »

IMPORTANT INFORMATION REGARDING EHCP FORCE UPDATE

When it comes to updating your EHCP force installation, Please DO NOT use the update script from the EHCP force website as this will undo some of the changes we have made in other posts.

You must use the upgrade script provided later in this topic to update EHCP force.

It is important that you keep your server updated with the most recent version of EHCP force.

To check if a new version has been released since your last updated (or installed) EHCP force check this link.

https://ehcpforce.tk/forums/index.php?topic=15.0

Ok, lets do this.

We are going to create an update script file so in the future we can use a single line to update EHCP force.

Logon to your server using your PC and putty.

Issue this command to create a new script file.

sudo vi /var/www/new/ehcp/scripts/updateehcp.sh

Image

Press I for insert, and paste in this code

Code: Select all

#!/bin/bash
#
# EHCP force update script by Rob Swan (WA) V.1.09.01
#
#Check for root-----------------------------------------------------------------
ROOTUID="0"
if [ "$(id -u)" -ne "$ROOTUID" ] ; then
    echo "This script must be executed with root privileges."
    exit 1
fi
# Check for Ubuntu  updates ----------------------------------------------------
apt-get update
apt-get upgrade --assume-yes
apt-get dist-upgrade --assume-yes
#-------------------------------------------------------------------------------
#
# Protect the Squirrelmail installation -----------------------------------------
mv /var/www/new/ehcp/webmail2 /var/www/new/ehcp/hidemail2
#-------------------------------------------------------------------------------
#
#
# Run the EHCP force update----------------------------------------------------
mkdir -p ~/Downloads
sudo apt-get -y install git
cd ~/Downloads
if [ -e "ehcp" ]; then
    rm -rf "ehcp"
fi
git clone "https://github.com/earnolmartin/EHCP-Force-Edition.git" "ehcp"
cd ehcp
cd ehcp
bash "ehcpforceupdate.sh" "update"
#-------------------------------------------------------------------------------
#
# Re-activate Squirrelmail------------------------------------------------------
rm -rf /var/www/new/ehcp/webmail2
mv /var/www/new/ehcp/hidemail2 /var/www/new/ehcp/webmail2
chown root:www-data -R /var/www/new/ehcp/webmail2
chmod 754 -R /var/www/new/ehcp/webmail2
chown ftp:www-data -R /var/www/new/ehcp/webmail2/data
#-------------------------------------------------------------------------------
#
#
#Clean Up-----------------------------------------------------------------------
apt autoremove --assume-yes  >/dev/null 2>&1
apt autoclean --assume-yes  >/dev/null 2>&1
#-------------------------------------------------------------------------------
#
#Tell the user its time to reboot-----------------------------------------------
echo ""
read -p "Update Done, Press any key to reboot this server." -n1 -s
echo ""
shutdown -r now
#-------------------------------------------------------------------------------
#
#ALL DONE!
Please note, the next screenshot may look deferent, due to future updates to this script.

Image

Save and exit (Escape :w (enter) :q (enter))

As this is a new file we have to give it permission to execute so issue this command.

sudo chmod +x /var/www/new/ehcp/scripts/updateehcp.sh

Ok, that is our update script created (we don’t need to repeat that step when we update EHCP force in the future).

So from now anytime EHCP force needs updating simple issue the following command.

sudo /var/www/new/ehcp/scripts/updateehcp.sh

When the update completes, you be asked to press any key to reboot, so please do so.

Job done!
Post Reply