A SUCCESSFULL installation guide to VHCS2 on Debian Etch (4.0)

I’ve read a lot of manuals, how-to’s etc. describing the process of setting a Debian webserver containing the great VHCS2 control panel system. I’ve tried them all, and all were failing for me on several critical points. So i tried to gathered all steps to this one-stop how-to.

First of all, download your debian-etch iso from http://cdimage.debian.org/debian-cd/4.0_r0/i386/iso-cd/debian-40r0-i386-netinst.iso (for i386 systems only, please visit http://cdimage.debian.org/debian-cd/4.0_r0/ for other distributions) and burn your iso to CD-ROM (you can use CDBurnerXP for free, http://www.cdburnerxp.se/).

Startup your server with the CD inserted. When the boot-manager is shown, ENTER. The setup wizard for Debian Etch will start and guide you through the installation procedure of Debian.
Important!:

when asked at software selection choose Standard system only and hit continue
when asked if the GRUB boot loader has to be installed, choose Yes
Next we go on preparing our system for VHCS.

after installation and re-boot, for your sake install the SSH server:

#apt-get install ssh
Now you can log-on from your desktop machine into your fresh debian server by using Putty (and the best of all, copying and pasting parts of this manual directly into your terminal).

Configure your network interfaces:

#vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.0.201
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

Now run

echo your.defined.hostname > /etc/hostname

Reboot the system:

#shutdown -r now

Afterwards, run:
#hostname
#hostname -f

Both should show your hostname (like server1.example.com)

Edit /etc/apt/sources.list and comment out the cd-rom entry:
#vi /etc/apt/sources.list

#
# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ – Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main

# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ – Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main

deb http://ftp2.de.debian.org/debian/ etch main
deb-src http://ftp2.de.debian.org/debian/ etch main

deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib

save the file and exit.

Then run:
#apt-get update

And run:

#apt-get upgrade

Now, install the MySQL server (MySQL5):

#apt-get install mysql-server mysql-client libmysqlclient15-dev phpmyadmin

We want MySQL to listen on all interfaces, not just localhost, so:

#vi /etc/mysql/my.cnf

find the line “bind-address = 127.0.0.1” and comment it out:
# bind-address = 127.0.0.1

then, we restart MySQL:
#/etc/init.d/mysql restart

now check that networking is enabled, run:
#netstat -tap

You should see a line like this:
tcp 0 0 *:mysql *:* LISTEN 3281/mysqld

Run
#mysqladmin -u root password yourpassword
#mysqladmin -h server1.example.com -u root password yourpassword

(replace yourpassword with your desired password, replace server1.example.com with the hostname you set at installation)

next we install Apache 2(.2) with PHP5

#apt-get install apache2 apache2-doc apache2-mpm-prefork apache2.2-common apache2-utils libexpat1 ssl-cert

next we install php5

#apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

you will be asked the following question:

Continue installing libc-client without Maildir support?

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

edit /etc/apache2/ports.conf and add Listen 443:

#vi /etc/apache2/ports.conf

Listen 80
Listen 443

now we have to enable some Apache modules (SSL, rewrite, suexec, and include):
#a2enmod ssl
#a2enmod rewrite
#a2enmod suexec
#a2enmod include

and reload the apache configuration:
#/etc/init.d/apache2 force-reload

now we’re going to prepare the system for the VHCS installation:

#apt-get install postfix postfix-tls

Please at request fill in the hostname you’ve entered at the debian installation, e.g. server1.example.com

#apt-get install proftpd proftpd-mysql

Please choose for “Stand alone” at request

#apt-get install courier-authdaemon courier-base courier-imap courier-maildrop courier-pop libberkeleydb-perl libcrypt-blowfish-perl libcrypt-cbc-perl \
libcrypt-passwdmd5-perl libdate-calc-perl libdate-manip-perl libdbd-mysql-perl libdbi-perl libio-stringy-perl libmail-sendmail-perl \
libmailtools-perl libmd5-perl libmime-base64-perl libmime-perl libnet-dns-perl libnet-netmask-perl libnet-perl libnet-smtp-server-perl \
libperl5.8 libsnmp-session-perl libterm-readkey-perl libtimedate-perl perl perl-base perl-modules bind9 diff gzip iptables libmcrypt4 patch procmail tar original-awk libterm-readpassword-perl \
libsasl2-modules libsasl2 sasl2-bin bzip2 gcc make libc6-dev

then open /etc/proftpd/proftp.conf to stop some errors from ProFTPD:

#vi /etc/proftpd/proftpd.conf

UseIPv6 off

Then, add some security fixes to it:

DefaultRoot ~
IdentLookups off
ServerIdent on “FTP Server Ready”

save the file and exit.

next we’re going to download the vhcs package:
#cd /usr/src
#wget http://downloads.sourceforge.net/vhcs/vhcs2-2.4.7.1.tar.bz2

then unpack the archive:
#tar -xjf vhcs2-2.4.7.1.tar.bz2

enter the newly created directory:
#cd vhcs2-2.4.7.1

now, we’re creating the installer:
#make install

after this, go to:
#cd /tmp/vhcs2-2.4.7.1

and copy all of it’s content to the right destination:
#cp -R * /

after this, go to:
#cd /var/www/vhcs2/engine/

now, edit the file vhcs2_common_code.pl
#vi vhcs2_common_code.pl

now, turn on displaying line numbers within Vi:
:set nu

scroll down to line 1408, look for:
`key`=>$main::db_pass_key,

next, add the following line BEFORE the above quoted line:
`keysize`=>32,

scroll down to line 1446 where you will need to repeat the above steps

now save the file and exit.

Start-up the VHCS2 installer:

#cd /var/www/vhcs2/engine/setup
#./vhcs2-setup

At setup, fill in all fields requested.

Now you’ve succesfully installed your debian etch machine containing VHCS2 for virtual hosting!

Sponsored Link

28 thoughts on “A SUCCESSFULL installation guide to VHCS2 on Debian Etch (4.0)

  1. This manual is great. But is there any possibility to have antivirus and antispam filter on this?

  2. After make install:

    after this, go to:
    #cd /tmp/vhcs2-2.4.7.1

    ***

    I get a No Such Directory error. Any idea how to resolve this?

    Thanks!

  3. Hi Ewonde and hi all, first thanks for this article, very complete, useful and thus time saving 😉
    I followed the entire instructions on a fresh Etch installation, I only had a (little) problem with proftpd installation and maybe any others in the future could have so I’m posting here how I solved it.

    Apparently, the VHCS2 installer put proftpd.conf in /etc/, but in Debian Etch it should be inside /etc/proftpd/, another thing that I needed was adding the line:

    Include /etc/proftpd/modules.conf
    inside /etc/proftpd.conf (I added it simply in the first block and it works)

    and also, inside /etc/proftpd/modules.conf add a comment to the line about postgresql module like that:
    # LoadModule mod_sql_postgres.c
    (because it seems that proftpd try to use postresql BEFORE than mysql indipendently from
    the order listed in the modules.conf files)

    With this setting, now ftp works, I just have a warning inside the web interface about the unaccessibility of the /tmp directory but I think that this should be caused by the proftpd chroot env. so I don’t worry to it that much…

    Cheers
    Fabio

  4. I followed it exactly and while running the setup script I receive this error after entering admins email:
    ERROR: External command ‘/usr/bin/mysql –user=USER –pass=PASSWORD/tmp/db.sql.stdout 2>/tmp/db.sql.stderr’ returned ‘1’ status !

    Anyone know how to resolve that?

    Before I saw this install guide, I attempted to this install and finally got everything working but when trying to access the site after setup script installed I recieved just a blank page, even when trying to access the /admin/ section. Only time I could recieve something was when I would make a up a directory in teh vhcs2 folder like /vhcs2/sdad/ it would give a page not found within vhcs.

  5. Hi all. Followed everything to the letter and after running ./vhcs2-setup and filling in the details, I get the following. I have no idea what to do beyond this point. Any help would be greatly apprciated.

    Mike Murphy

    Can’t exec “keysize”: No such file or directory at /var/www/vhcs2/engine/setup/../vhcs2_common_code.pl line 14 08, line 8.
    Odd number of elements in anonymous hash at /var/www/vhcs2/engine/setup/../vhcs2_common_code.pl line 1408, line 8.
    Please provide an encryption/decryption passphrase or key using -key at /var/www/vhcs2/engine/setup/../vhcs2_c ommon_code.pl line 1408

  6. Hi verry nice article!
    everything works except for one thing is the proftp.
    It starts
    Client connects to the server
    But this is what i get next:

    Response: 530 Login incorrect.
    Error: Unable to connect!

    I also took the changes from fabio but it didnt work..
    I really want to use VHCS and the ftp has to word else its useless.

    Anyone that fixed this problem?

    Greetz Bjorn
    the netherlands

  7. Hi
    for the one had also this problem this is the solition. It worked for me
    go to
    # cd /etc/proftpd/
    and change the file proftpd.conf to proftpd2.conf
    just for backup.

    then copy the file
    # cd /etc/proftpd.conf
    to
    # cd /etc/proftpd/proftpd.conf

    then you edit this to the proftpd.conf file

    UseIPv6 off
    DefaultRoot ~
    IdentLookups off
    ServerIdent on “FTP Server Ready”

    (see manual)

    and at last you restart proftpd with

    etc/init.d/proftpd restart

    If you get no errors then it should work.

    Good luck

  8. Hi All,
    this maybe can help Murphy and Flo:

    when you cut and paste instructions from this howto (above) pay attention that in perl code you must use normal
    hypenation while in this “html generated page” you would cut a back-hypen (I really don’t know the english name of it 😉 … I hope to be clear, anyway, look around below line 1408 inside /var/www/vhcs2/engine/vhcs2_common_code.pl and use the SAME hypenation that already is in the perl script …

    Another thing:
    if when finished the setup, all work but webmail, go inside /var/www/vhcs2/gui/tools/webmail/inc/inc.php
    and delete the “\r\n” from lines 153 and 154.

    good luck!
    Fabio

  9. This comment help me after some hours trying to change vftp password :
    Apparently, the VHCS2 installer put proftpd.conf in /etc/, but in Debian Etch it should be inside /etc/proftpd/, another thing that I needed was adding the line.

  10. My install falls over at the point of network configuration. after completing I’m unable to run apt-get (failure to resolve debian.planetmirror.org)

    Here is a copy of my /etc/network/interfaces, any hints?

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    #allow-hotplug eth0
    #iface eth0 inet dhcp
    auto eth0
    iface eth0 inet static
    address 192.168.1.220
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

    auto eth1
    iface eth1 inet static
    address 192.168.1.221
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

    Any help appreciated!
    Simon

  11. We have an debian web server with VHCS2 Its works great, but from a few days ago, when i log in the administrator user give the error:
    Table ‘./vhcs2/domain_traffic’ is marked as crashed and should be repaired

    I’m unable to log and make any change in my domains..

    Please HELP !!!!

    Any help appreciated!
    ALLAN – San José Costa Rica

  12. i finish my istallation and when i put to my explorer
    my ip with /vhcs2
    i see to my screen only this Index of /vhcs2
    and some directory

    what’s going rong?

  13. Please add this to the apache set up part.

    # a2enmod php5

    mine was not enabled and gave me a headache.
    So I go this “download PHTML file” box and
    could not run php pages.

    But the rest of the tutorial worked.

  14. There a errors in this tutorial. Read these points to fix them.

    Maildir question:
    The tutorial does not indicate what you should answer at the question ‘Continue installing libc-client without Maildir support?’ I indicated Yes and it has worked so far.

    Proftpd:
    ServerIdent on .FTP Server Ready.
    Should be
    ServerIdent on “.FTP Server Ready.”

    cd /tmp/vhcs2-2.4.7.1
    Should be
    cd /tmp/vhcs-2.4.7.1

    Webmail:
    Edit /var/www/vhcs2/gui/tools/webmail/inc/inc.php and delete the “\r\n” from lines 153 and 154

    There also seems to be a very serious security flaw in the admin section. Your vhcs installation can easily be hacked by hackers. To prevent this, add a ip filter on the admin section. This does require advance knowledge of apache.

  15. Thanks for this writeup guimeau. Thanks also to Bjorn, Fabio and Helper

    I wanted to add that I required add the following line into /etc/proftpd/proftpd.conf

    Include /etc/proftpd/modules.conf

    I added it just under the user/group lines.

    hope this helps.

  16. i have just followed this guide and everything is setup and running but i cannot access the webserver any ideas to this ?

  17. Regarding Chris’ entry dated 9-10-07
    He said (in part) After setup script installed I received just a blank page. Only time I can receive something was when I would make a up a url in the vhcs2 folder like /vhcs2/bla.php/ it would give a 404 page not found within vhcs. This is my situation as well. I receive a blank white page. If I do a “View Page Source”, this is the content of the page.

    Any help would be greatly appreciated.

  18. ubuntu@ubuntu-laptop:/var/www/vhcs2/engine$ sudo /var/www/vhcs2/engine/setup/./vhcs2-setup
    ERROR: File ‘/etc/vhcs2/vhcs2.conf’ does not exist !

  19. ubuntu@ubuntu-laptop:/var/www/vhcs2/engine$ sudo /var/www/vhcs2/engine/setup/./vhcs2-setup
    ERROR: File ‘/etc/vhcs2/vhcs2.conf’ does not exist !

    getting this error

Leave a comment

Your email address will not be published. Required fields are marked *