
06-20-2007, 11:34 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
**Updated** Install Guide for Installing VHCS on Ubuntu Server
I tried installing vhcs on a few versions of Ubuntu and have successfully done it with these instructions. This is basically a how-to for installing vhcs on most of Ubuntu server versions. I have pieced together instructions from the net and tested a lot to make sure this works right. I had submitted a how-to tutorial for Ubuntu Edgy and with there being a few errors even after the install said it was successful I was still having a few problems. I did a lot of searching for this tutorial and can’t really remember all of the places I went to so please use this on a test server, use in a live server at your own risk.
I am not going to go through a how-to of how to install Ubuntu server versions, if you are not sure on how to do that please learn that before doing this tutorial.
After I installed Ubuntu Server 6.06 LTS I had to install openssh. If you are new and do not know how to do this please do this command after logging in:
Code:
sudo apt-get install openssh-server
First: Depending on if you’re paranoid or not we need to set a root password. If your too paranoid to do so then simply either type sudo -s to get to root in the console or add sudo in front of all the commands. To set root password simply:
It will then ask for your password and the new password, after that type:
Code:
su (Then enter the password u just created)
Next we want to change the default Shell:
Code:
rm -f /bin/sh
ln -s /bin/bash /bin/sh
Then edit /etc/hosts by running this command:
Code:
nano /etc/hosts
Make it look like this:
127.0.0.1 localhost.localdomain localhost
192.168.0.100 server1.example.com server1
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Now run this:
Code:
hostname
hostname –f
They should show your hostname and full hostname (i.e. hostname and hostname.example.com)
Comment out the CD and enable some of the other repositories. It should look close to this:
Code:
nano /etc/apt/sources.list
Example Code:
# deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)]/ dapper main restricted
deb http://de.archive.ubuntu.com/ubuntu/ dapper universe
deb-src http://de.archive.ubuntu.com/ubuntu/ dapper universe
# deb http://de.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu dapper-security main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted
deb http://security.ubuntu.com/ubuntu dapper-security universe
deb-src http://security.ubuntu.com/ubuntu dapper-security universe
Now run this:
Code:
apt-get update
apt-get upgrade
Next we are going to install some more packages, you might not need all of these but I found the server ran better for me with the following installed:
Quote:
|
apt-get install binutils cpp cpp-4.0 fetchmail flex gcc gcc-4.0 libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev libnet-dns-perl libdb-file-lock-perl libhtml-parser-perl linux-kernel-headers lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev automake1.9 libtool bison g++ wget bzip2 libgd1 gawk libterm-readpassword-Perl patch libmcrypt4 iptables gzip diff bind9 libtimedate-Perl libterm-readkey-Perl libsnmp-session-Perl libperl5.8 libnet-smtp-server-Perl libnet-Perl libnet-netmask-Perl libmime-Perl libmd5-Perl libmailtools-Perl libmail-sendmail-Perl libio-stringy-perl libdbi-Perl libdbd-mysql-Perl libdate-manip-Perl libdate-calc-Perl libcrypt-passwdmd5-Perl libcrypt-cbc-Perl libcrypt-blowfish-Perl libberkeleydb-perl courier-maildrop proftpd-mysql
|
Answer the following questions in this order:
1. No
2. Internet Site
3. example.yoursite.com
4. standalone
Now we need to install quota, run the following:
Code:
apt-get install quota
Edit /etc/fstab to look like this (I added ,usrquota,grpquota to partition /dev/sda1 (mount point /; your device name might be /dev/hda1or similar):
Code:
nano /etc/fstab
Example Layout:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro,usrquota,grpquota 0 1
/dev/sda5 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
To enable quota, run these commands:
Code:
touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /
quotacheck -avugm
quotaon -avug
Now we need to configure bind, run the following:
Code:
/etc/init.d/bind9 stop
Edit the file /etc/default/bind9so that the daemon will run as the unprivileged user bind, chrooted to /var/lib/named. Modify the line: OPTIONS=" -u bind" so that it reads OPTIONS="-u bind -t /var/lib/named":
Code:
nano /etc/default/bind9
Make it look like this:
OPTIONS="-u bind -t /var/lib/named"
# Set RESOLVCONF=no to not run resolvconf
RESOLVCONF=yes
To get bind to run properly, run the below necessary commands:
Code:
mkdir -p /var/lib/named/etc
mkdir /var/lib/named/dev
mkdir -p /var/lib/named/var/cache/bind
mkdir -p /var/lib/named/var/run/bind/run
mv /etc/bind /var/lib/named/etc
ln -s /var/lib/named/etc/bind /etc/bind
mknod /var/lib/named/dev/null c 1 3
mknod /var/lib/named/dev/random c 1 8
chmod 666 /var/lib/named/dev/null /var/lib/named/dev/random
chown -R bind:bind /var/lib/named/var/*
chown -R bind:bind /var/lib/named/etc/bind
We need to modify the startup script /etc/init.d/sysklogdof sysklogdso that we can still get important messages logged to the system logs. Modify the line: SYSLOGD="-u syslog" so that it reads: SYSLOGD="-u syslog -a /var/lib/named/dev/log":
Code:
nano /etc/init.d/sysklogd
Make it look like this:
SYSLOGD="-u syslog -a /var/lib/named/dev/log"
Now we need to restart both of the following services:
Code:
/etc/init.d/sysklogd restart
/etc/init.d/bind9 start
Now we need to install mysql, run the following:
Code:
apt-get install mysql-server mysql-client libmysqlclient15-dev
After installing mysql we need to set a password for mysql root, run the following command:
Code:
mysqladmin -u root password YOURROOTSQLPASSWORD
Next run the following:
Code:
mysql -u root -p
create database vhcs2;
use vhcs2;
quit
Now we need to install Postfix with SMTP-AUTH, run the following:
Code:
apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail
Next run this command:
Code:
dpkg-reconfigure postfix
These should be the default answer, change if you feel it is needed:
1. Internet Site
2. None
3. example.yourdomain.com
4. example.yourdomain.com, localhost.yourdomain.com, localhost
5. No
6. 127.0.0.0/8
7. Yes
8. 0
9. +
10. all
Code:
postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'inet_interfaces = all'
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
Now we are going to create the certificates for TLS:
Code:
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
Now we are going to configure Postfix for TLS:
Code:
postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'
postconf -e 'myhostname = example.yourdomain.com'
Now restart Postfix:
Code:
/etc/init.d/postfix restart
Finally run the following commands for saslauthd:
Code:
mkdir -p /var/spool/postfix/var/run/saslauthd
Now edit /etc/default/saslauthd by running the following command:
Code:
nano /etc/default/saslauthd
Should look like the following:
# This needs to be uncommented before saslauthd will be run automatically
START=yes
PARAMS="-m /var/spool/postfix/var/run/saslauthd -r"
# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# "shadow" or "sasldb", like this:
# MECHANISMS="pam shadow"
MECHANISMS="pam"
We must also edit /etc/init.d/saslauthd and change the location of saslauthd's PID file. Change the value of PIDFILE to /var/spool/postfix/var/run/${NAME}/saslauthd.pid:
Code:
nano /etc/init.d/saslauthd
Should look like the following:
PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"
Now start saslauthd by running the following command:
Code:
/etc/init.d/saslauthd start
To see if SMTP-AUTH and TLS work properly now run the following commands:
Code:
telnet localhost 25
ehlo localhost
quit
Now we are going to installCourier-IMAP/Courier-IMAP-SSL (for IMAPs on port 993) and Courier-POP3/Courier-POP3-SSL (for POP3s on port 995):
Quote:
|
apt-get install courier-authdaemon courier-base courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-ssl gamin libgamin0 libglib2.0-0
|
You will be one question, all you should have to do is just hit enter.
Code:
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart
Next we are going to install Apache and PHP5, run the following commands:
First we will install Apche:
Quote:
|
apt-get install apache2 apache2-common apache2-doc apache2-mpm-prefork apache2-utils libapr0 libexpat1 ssl-cert
|
Next we are going to install PHP5:
Quote:
apt-get install autoconf automake1.4 autotools-dev libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php-pear php5-ldap php5-mhash php5-mysql php5-mysqli php5-snmp php5-sqlite php5-xmlrpc php5-xsl php5-imap php5-mcrypt php5-pspell
|
During the PHP install you will be asked a question, please answer yes to this question.
Next run the following command:
Code:
nano /etc/apache2/apache2.conf
Look for “DirectoryIndex” and make it look like the following:
Quote:
|
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
|
Next run the following command and add Listen 443 to the config:
Code:
nano /etc/apache2/ports.conf
Make it look like this:
Listen 80
Listen 443
This is optional to you if you would like to enable these Apache Modules (SSL, rewrite, suexec, and include). To enable these modules, run the following:
Code:
a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include
Next reload Apache by running the following command:
Code:
/etc/init.d/apache2 force-reload
Next we are going to install webalizer by running the following command:
Code:
apt-get install webalizer
It is a good idea to synchronize the system clock with an NTP (network time protocol) server over the internet. Run the following command to complete this:
Code:
apt-get install ntp ntpdate
Next we are going to install VHCS. We are going to start by downloading and unpacking vhcs.
First change to your root directory:
Next download VHCS:
Next unpack vhcs:
Code:
tar -xjvf vhcs2-2.4.7.1.tar.bz2
Next change your vhcs directory:
Next run the following command:
Next run the following command:
Code:
cp -R /tmp/vhcs-2.4.7.1/* /
Now we need to edit vhcs2_common_code.pl file before installing, this will fix an error when installing vhcs. Run the following command:
Code:
nano /var/www/vhcs2/engine/vhcs2_common_code.pl
Find the following (this entry will be in the file twice, find both and edit both the same way):
Code:
my to $cipher = Crypt::CBC -> new(
{
`key' => $main::db_pass_key,
`to cipher' => `Blowfish' ,
`IV' => $main::db_pass_iv,
`regenerate_key' => 0,
`padding' => 'space',
`prepend_iv' => 0
}
);
And to replace it with (both entries will be edited the same):
my to $cipher = Crypt::CBC -> new(
{
`keysize' => 32,
`key' => $main::db_pass_key,
`to cipher' => `Blowfish' ,
`IV' => $main::db_pass_iv ,
`regenerat e_key' => 0,
`padding' =>' space',
`prepend_i v' => 0
}
);
Next we will run the setup for vhcs, if all went all you will get asked the following questions after running the following command:
Code:
/var/www/vhcs2/engine/setup/vhcs2-setup
Questions:
Quote:
Answer all the question or installation will fail
here are some example answers
Please to enter system hostname (for Enter defaults) [debian]: hostname
Please to enter system network address (for Enter defaults) [10.0.0.69 ]: 192.168.0. 100 (use whatever your servers ip is)
Please to enter SQL server host (for Enter defaults) [localhost]:just press enter key
Please to enter system SQL database (for Enter defaults) [vhcs2]: vhcs2
Please to enter system SQL to user (for Enter defaults) [root]: vhcs2
Please to enter system SQL password (for Enter defaults) [none]: Password you entered earlier
Please repeat system SQL password: root password u entered earlier
Please to enter VHCS FTP SQL to user (for Enter defaults) [vftp]: vftp
Please to enter VHCS FTP SQL to user password (for Enter defaults) [none]: PASSWORD for virtual users
Please repeat VHCS FTP SQL to user password: PASSWORD for virtual users
Please to enter administrator login name (for Enter defaults) [admin]:
Please to enter administrator password: Administrator PASSWORD
Administrator Please repeat password: Administrator PASSWORD
Please to enter administrator email address: Email of root
|
You should see the permissions being set automatically, but if you do not see this during the install than run the following commands:
Code:
/var/www/vhcs2/engine/setup/set-engine-permissions.sh
/var/www/vhcs2/engine/setup/set-gui-permissions.sh
To fix a problem in the webmail edit the following file:
Code:
nano /var/www/vhcs2/gui/tools/webmail/inc/inc.php
locate the lines
Header (” You expire: Wed, 11 Nov 1998 11:11: 11 GMT \ r \ n”.
“Break-Control: \ n not-breaks \ r”.
“Break-Control: must-revalidate”);
Replace them with
Header (”You expire: Wed, 11 Nov 1998 11:11: 11 GMT”);
Header (”Break-Control: not-break”);
Header (”Break-Control: must-revalidate”);
After doing this install on Ubuntu Server 6.06 LTS, all of the features on VHCS worked without any errors. Server ran more stable.
This is still just a rough copy of the tutroial for the install of vhcs on Uuntu Server. I am going to be adding more how-to's for this and fine tuning this tutorial, there will be a couple of changes but not much to what you see here. If you have any questions or problems please ask. I will post a word doc of this tutorial in a couple of days.
arche
Last edited by arche; 06-20-2007 at 11:39 AM.
|

06-20-2007, 03:29 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
This is an error with the file manager, I forgot to post the fix for this.
The error:
Error: Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/srv/www/vhcs2/gui/tools/filemanager/:/tmp/:/usr/share/php/) in /srv/www/vhcs2/gui/tools/filemanager/ftp.php on line 108
Code:
nano /etc/apache2/sites-available/vhcs2.conf
Delete the slash at the end :/tmp Also do the same for below, if you already created sites then delete the slash after the :/tmp on all of the entries.
Code:
nano /etc/vhcs2/apache/parts/vhcs2_base.tpl
After this you need to restart vhcs, I just reboot the machine. Admins choice..
arche
|

06-28-2007, 02:54 PM
|
|
Disabled
|
|
Join Date: Jun 2007
Posts: 5
|
|
Very nice, good job. I like how descriptive you were, this should help out alot of people. Thank you for taking the time to post it.
|

08-08-2007, 04:12 PM
|
|
Newbie
|
|
Join Date: Aug 2007
Posts: 6
|
|
|

10-04-2007, 07:09 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
Thank you, its a good job. I have a problem when i try to enter to my webmail because i modified de lines 153 and 154 in the inc.php but i have the same error:
Parse error: syntax error, unexpected T_STRING in /var/www/vhcs2/gui/tools/webmail/inc/inc.php on line 153
Can i help me?
THNX
|

10-04-2007, 07:21 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
Quote:
Originally Posted by iagsistemas
Thank you, its a good job. I have a problem when i try to enter to my webmail because i modified de lines 153 and 154 in the inc.php but i have the same error:
Parse error: syntax error, unexpected T_STRING in /var/www/vhcs2/gui/tools/webmail/inc/inc.php on line 153
Can i help me?
THNX
|
unexpected T_STRING usually means a missing semicolon. Make sure you have the semicolon at the end of each line (i.e. ";")
|

10-04-2007, 07:25 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
The same thing happens to me with the server FTP who gives me that is DOWN when i login as admin.Thank you.
|

10-04-2007, 07:28 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
Quote:
Originally Posted by iagsistemas
The same thing happens to me with the server FTP who gives me that is DOWN when i login as admin.Thank you.
|
First fix the webmail then worry about the ftp. Did you look to make sure that you have included the semicolon? If you can't find any error post you php.inc here please.
|

10-04-2007, 07:28 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
Arche thanks for your reply. This is the file and i not view an error:
/*
Don't remove the fallowing lines, or you will be problems with browser's cache
*/
Header (" You expire: Wed, 11 Nov 1998 11:11: 11 GMT".
"Break-Control: not-break".
"Break-Control: must-revalidate");
$nocache = "
<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">
<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">";
I copy and paste from this manual.Thank you
|

10-04-2007, 07:31 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
Quote:
Originally Posted by iagsistemas
Arche thanks for your reply. This is the file and i not view an error:
/*
Don't remove the fallowing lines, or you will be problems with browser's cache
*/
Header (" You expire: Wed, 11 Nov 1998 11:11: 11 GMT".
"Break-Control: not-break".
"Break-Control: must-revalidate");
$nocache = "
<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">
<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">";
I copy and paste from this manual.Thank you
|
You going to have to look at my instructions look at the end of my first post, you must change this to what I posted..
locate the lines
This is the old config
Header (” You expire: Wed, 11 Nov 1998 11:11: 11 GMT \ r \ n”.
“Break-Control: \ n not-breaks \ r”.
“Break-Control: must-revalidate”);
Replace them with
This is the new config
Header (”You expire: Wed, 11 Nov 1998 11:11: 11 GMT”);
Header (”Break-Control: not-break”);
Header (”Break-Control: must-revalidate”);
|

10-04-2007, 07:32 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
where are the file php.inc? sorry i newbie and my english y very poor. THNX
|

10-04-2007, 07:34 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
I replaced them and not work. It appears the same error.
/*
Don't remove the fallowing lines, or you will be problems with browser's cache
*/
Header ("You expire: Wed, 11 Nov 1998 11:11: 11 GMT");
Header ("Break-Control: not-break");
Header ("Break-Control: must-revalidate");
$nocache = "
<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">
<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">";
|

10-04-2007, 07:35 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
Quote:
Originally Posted by iagsistemas
where are the file php.inc? sorry i newbie and my english y very poor. THNX
|
If you are looking on your server it should be somewhere around here:
/var/www/vhcs2/gui/tools/webmail/inc/
If you are looking at the unzipped folder it would be:
/vhcs2-2.4.7.1/vhcs2-2.4.7.1/gui/tools/webmail/inc/
You should find it in there.
|

10-04-2007, 07:40 PM
|
|
New Member
|
|
Join Date: Oct 2007
Posts: 0
|
|
i dont have any php.inc at this locations???
|

10-04-2007, 07:42 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Nov 2006
Location: Chicago, IL
Posts: 58
|
|
Quote:
Originally Posted by iagsistemas
i dont have any php.inc at this locations???
|
not php.inc it is inc.php
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|