N.B: a maintained version of this howto can be found here
Hello,
Q.what is VHCS?
vhcs (Virtual Hosting Control System) is a software solution to run a webserver, mailserver, DNSserver, FTP server on linux (the current supported OS for now)
Q.How to install it
Just follow the HOWTO below:
First begin by instaling ubuntu (don't need to choose server option, i will give you solutions to tweak it also, but if you don't want to use X at all then choose server).. after ubuntu is installed, Do the following:
Now you have the solution to either install it manually by following the silver text down there or follow the automatic method below:
Code:
wget http://wael.nasreddine.com/files/vhcs/vhcs.sh
now type
Code:
sudo -s -H
<enter password>
sh vhcs.sh
and follow the inline instructions
NOTE: You are not authorised to modify/remove the license that is inside the script 2 times, it's 15 line and must be always the same 15 line, but you can modify the script and/or redestribute it without changing those licence lines, thank you
0. make sure you have all needed repository, tested with /etc/apt/sources.list
Code:
#ubuntu archive
deb http://fr.archive.ubuntu.com/ubuntu/ breezy universe main restricted multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ breezy universe main restricted multiverse
# ubuntu updates
deb http://fr.archive.ubuntu.com/ubuntu breezy-updates main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu breezy main restricted universe multiverse
#ubuntu security
deb http://security.ubuntu.com/ubuntu breezy-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu breezy-security main restricted universe multiverse
1-making temp directories (you can change them to anything but we just need a folder to drop the files in it to make vhcs)
Code:
sudo mkdir /tmp/vhcs_tmp
sudo mkdir /tmp/vhcs_tmp/install
cd /root/vhcs_tmp/install
2- we update the current installed system
Code:
sudo apt-get update
sudo apt-get upgrade -y
3-removing some uneeded packages, which can also cause the system not to function properly
Code:
sudo apt-get remove -y lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
4-removing some service from /etc/inetd.conf file
Code:
sudo update-inetd --remove daytime
sudo update-inetd --remove telnet
sudo update-inetd --remove time
sudo update-inetd --remove finger
sudo update-inetd --remove talk
sudo update-inetd --remove ntalk
sudo update-inetd --remove ftp
sudo update-inetd --remove discard
5-installing all needed packages
Code:
sudo apt-get install -assume-yes --force-yes ssh postfix postfix-tls proftpd-mysql 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-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 mysql-client mysql-common mysql-server patch php4 php4-mcrypt php4-mysql php4-pear procmail tar original-awk libterm-readpassword-perl libsasl2-modules libsasl2 sasl2-bin apache2 apache2-common apache2-mpm-prefork libapache2-mod-php4 bzip2
6-getting vhcs archive file from vhcs.net (this is for the current 2.4.6.2version, visit http://www.vhcs.net for the current/latest version)
7-exctracting the archive, and entering into the vhcs sources directory
Code:
tar xjvf vhcs2.4.tar.bz2
cd ./vhcs2
8-installing the vhcs
8.1-make install vhcs which will put all the file into /tmp/vhcs2 folder
8.2-copying all the files into their real directory
Code:
sudo cp -R /tmp/vhcs2/etc/* /etc
sudo cp -R /tmp/vhcs2/var/* /var
sudo cp -R /tmp/vhcs2/usr/* /usr
ok now vhcs files are in place, we proceed to the configuration now,
9-so first we change/create the mysql root password
Code:
mysqladmin -u root -p password "new password here"
10-after the vhcs has been installed, and the mysql root has been changed let's make sure we are in the latest packages
Code:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get clean
11-ok, this is the time to make vhcs installed and fully operational,
Code:
sudo /var/www/vhcs2/engine/setup/vhcs2-setup
here you will be asked about passwords, ip etc... it's recommanded that you use private ip of the server
12-VHCS installed, now you need to include the apache configuration file and to restart apache
so open /etc/apache2/httpd.conf
Code:
sudo pico /etc/apache2/httpd.conf
and append the following instruction at the end of the file
Code:
Include /etc/apache2/sites-available/vhcs2.conf
restart apache
Code:
/etc/init.d/apache2 restart
13-finally we add the daemon to boot on ubuntu startup
Code:
sudo update-rc.d vhcs2_daemon defaults
sudo update-rc.d vhcs2_network defaults
now visit http://whatever.the.servers.ip.is/vhcs2/ or http://127.0.0.1/vhcs2/ and begin by creating a reseller, then a hosting template to add a domain
F.A.Q
Q.How to make ubuntu start without X server, to have more free RAM
from a terminal remove gdm, xdm and kdm (normally only gdm is installed but just to make sure)
Code:
sudo apt-get remove gdm
sudo apt-get remove xdm
sudo apt-get remove kdm
Q.How to make it possible that the user use .htaccess file (normally can't be used, give ERROR 500)
edit /etc/vhcs2/apache/working/vhcs2.conf file
search for in the domain you need to give the rights to use .htaccess file
Code:
AllowOverride AuthConfig
replace with
replace the file /etc/apache2/sites-available/vhcs2.conf with this one
Code:
sudo cp /etc/vhcs2/apache/working/vhcs2.conf /etc/apache2/sites-available/vhcs2.conf
restart apache2
Code:
sudo /etc/init.d/apache2 restart
Q.is it possible to make it by default .htaccess can be used
Yes. Open /etc/vhcs2/apache/parts/{prefix}_entry.tpl where {prefix} is "als" and "dmn" and "sub" without quotes
search for
Code:
AllowOverride AuthConfig
replace with
edit also /etc/vhcs2/apache/working/vhcs2.conf to enable it for the current registered domains
replace all occurences of:
Code:
AllowOverride AuthConfig
with
copy this file to /etc/apache2/sites-available/
Code:
sudo cp /etc/vhcs2/apache/working/vhcs2.conf /etc/apache2/sites-available/vhcs2.conf
restart apache2
Code:
sudo /etc/init.d/apache2 restart
Q.mysql root password is stored in /etc/proftpd.conf in clear text, can i hide it?
you can only hide it from normal users, but unfortunately it will be always visibe to sudoers users
Code:
sudo chmod 0600 /etc/proftpd.conf
Q.how to change mysql password
changing the mysql root passwors is easy, just follow this four steps
1. begin by changing the mysql root password with
Code:
mysqladmin -u root -p password "new password here"
2. go to /var/www/vhcs2/engine and execute vhcs2-db-password
Code:
cd /var/www/vhcs2/engine
sudo ./vhcs2-db-password
follow the screen instructions,
3. restart proftpd
Code:
/etc/init.d/proftpd restart
that's it
--== new questions will be added later also keep checking this topic ==--
Troublesshooting
Q.When i run /var/www/vhcs2/engine/setup/vhcs2-setup file, i get errors something about mysql error
this error has occured because your mysql password contains non alpha-numeric charachters, this can be solved by editing /var/www/vhcs2/engine/setup/vhcs2-setup, so:
Code:
sudo pico /var/www/vhcs2/engine/setup/vhcs2-setup
Ctrl + w to search, type "setup_sql" without quotes
go down and find the line
Code:
my $cmd = "$main::cfg{'CMD_MYSQL'} --user=$main::db_user --pass=$main::db_pwd < /tmp/db.sql 1>/tmp/db.sql.stdout 2>/tmp/db.sql.stderr";
replace in it
Code:
--pass=$main::db_pwd
with
Code:
--pass=\"$main::db_pwd\"
so it will look like this
Code:
my $cmd = "$main::cfg{'CMD_MYSQL'} --user=$main::db_user --pass=\"$main::db_pwd\" < /tmp/db.sql 1>/tmp/db.sql.stdout 2>/tmp/db.sql.stderr";
run /var/www/vhcs2/engine/setup/vhcs2-setup again
Q.my ips are resolving private to the outside (dnsreport.com report private ips instead of public ones)
There's two methods to solve this problem, i will state one now, the second one will be added later
this method consist of reinstalling VHCS with public IP, and solve apache resolving problem (when public ip is used, apache will no longer resolve domains)
first you need to remove all added users (go to vhcs2 database in mysql and see the uid in admin table)
Code:
sudo userdel vu200X
where X is the user number (vhcs2 will begin with 1)
remove the added groups
Code:
sudo groupdel vu200X
where X is the group number (vhcs2 will begin with 1)
remove the working conf files
Code:
sudo rm /etc/vhcs2/apache/working/vhcs2.conf
sudo rm /etc/vhcs2/bind/working/*
sudo rm /etc/apache2/sites-available/vhcs2.conf
sudo rm /var/cache/bind/*
now you're ready to install, repeat only step 11 but use public ip this time
now proceed to edit the apache files to resolve correctly
Open /etc/vhcs2/apache/parts/{prefix}_entry.tpl where {prefix} is "als", "dmn" and "sub" without quotes
replace
Code:
<VirtualHost {DMN_NAME}>
with
recreate reseller, etc... now
Q.FTP always give authetifications incorrect!!!
Code:
sudo pico /etc/proftpd.conf
search for
Code:
SQLConnectInfo vhcs2@localhost root
mysql root password must be in clear text right after root in the aboce text, if not add it and
Code:
sudo /etc/init.d/proftpd restart
Any suggestion about a step, or any question to be added to the F.A.Q/Troubleshooting is appreciated
Thanks to alexkotov, BeeEmm, Ico Dimov, Dimitri Tarassenko, Nigel Jones, Markus Petzsch, Tassoman, developpers of VHCS open source project
Version History
------------------------
Version [ Date ] Changes
--------------------------------------
1.0 [ 21-12-2005 ] First Version Imported from my hoary script
Bookmarks