OldSchoolDSL
02-27-2011, 06:36 PM
Not everyone knows how to setup their own VPS or Dedicated Server. And it's a lot cheaper to order one without a control panel. So for those who want to do so & need a control panel.... Here is the "how to do it".
IMPORTANT: This must be done "IN ORDER". Do not skip around. Also, this works for me and that does not mean that it will work for you... Only that it can work for you.
I used nano to edit files. So to edit using nano you would type:
Nano / PATH / File NAME
(nano, space, path to file, and then name of file)
Use your arrow keys or page up & page down keys to move within the document (file).
Ctrl O = Save
Ctrl X = Exit.
Install / Setup a fresh copy of CentOS (either VPS or Dedicated Server) and then...
STEP 1
yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update *
yum upgrade *
yum update *
reboot
STEP 2
You have to disable SELinux by editing /etc/sysconfig/selinux and changing the line to selinux=disabled. This will keep SELinux from being enabled on your server next boot.
Run this command in SSH.
su - root
setenforce 0
If you are unsure this procedure worked, you can run /usr/sbin/sestatus to check its status. Failure to correctly disable SELinux will render your Kloxo install useless and an OS reload may be required to properly reinstall it.
Also, make sure the ports 7778/tcp and 7777/tcp are open in your server firewall or you won't be able to connect to Kloxo web panel when the install completes. On most web host, these ports are open by default.
Type the following commands with SSH
su - root
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-install-master.sh
# sh ./kloxo-install-master.sh
*Fix before Kloxo 6.1.4 version release:
Type the following commands with SSH
cd /
sed -i 's/^;zend_/zend_/' /usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/php.ini
sh /script/upcp
sh /script/fixmail
sh /script/fixwebmail
service courier-imap stop
service qmail stop
service courier-imap start
service qmail start
Edit: /home/kloxo/httpd/webmail/horde/lib/Horde.php
if (($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime'] * 60) < time()) {
TO:
if ((($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime']) * 60) < time()) {
Log-in change default password & user name (As soon as possible)
Change SSH Port (As soon as possible)
Change httpd to lighttpd
Change bind to djbdns (tiny dns)
DO NOT YET SETUP DNS
DO NOT YET SETUP Domains
Do not yet setup accounts
Change no other setting except for above.
STEP 3
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
/bin/rm epel-release-5-4.noarch.rpm remi-release-5.rpm
perl -pi -e 's/enabled=0/enabled=1/g' /etc/yum.repos.d/remi.repo
yum update *
Step 4
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
yum --enablerepo=webtatic update *
yum --enablerepo=webtatic upgrade *
STEP 5
Log into Kloxo
Apply changes as needed & make domains as needed.
STEP 6 -Help prevent SYN flooding DOS attack
Edit /etc/sysctl.conf and add:
#securing tcp connections
net.ipv4.tcp_syncookies=1
#reducing timed out to 30
net.netfilter.nf_conntrack_tcp_timeout_syn_recv=30
Run the following commands in SSH:
This wil create new chains
iptables -N syn-flood
this will limits incoming packets
iptables -A syn-flood -m limit --limit 10/second --limit-burst 50 -j RETURN
this will log attacks
iptables -A syn-flood -j LOG --log-prefix "SYN flood: "
this will silently drop the rest
iptables -A syn-flood -j DROP
service iptables restart
STEP 7
Install memcached
yum install php-pecl-memcache memcached
Then, configure the memcached by editing the file /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="512" <- Amount of memory to use (in MB)
OPTIONS="
Run the following:
chkconfig memcached on
service memcached start
You could try to increase mysql performance by enabling query cache feature.
Edit your /etc/my.cnf and add the following under [mysqld]
query-cache-size=50M (or whatever you think is enough)
Run the exact same queries and then, on mysql console, check on query cache status:
mysql> show status like '%qcache%';
Finally, you need to remove Qmail and IMAP. They seem not to work so well with this setup and vBulletin alone does not need it. But if you do... You can use a few alternatives.
yum remove qmail courier-imap
chkconfig courier-imap --level 0123456 off
chkconfig courier-imap --level 0123456 --del
Now lets do some house cleaning. Run these commands 1 by 1 in SSH
yum clean all
su -c 'yum clean headers'
su -c 'yum clean packages'
su -c 'yum clean metadata'
DONE.
You should now have the latest versions (MySQL, PHP) and all working under Kloxo. Upload and install / restore your copy of vBulletin.
I recommend MySQL Dumber for backups and restores.
http://www.mysqldumper.net
Also if you want to learn more about server management, you may want to attempt a go with Webmin.
--------------- Added 1298868625 at 1298868625 ---------------
Someone sent me a message:
Question: How would you go about installing ImageMagick?
Answer: GD is already installed by default. So ImageMagick isn't truly 100% needed. But if you truly want it, please do the following.
Installing ImageMagick (optional )
In SSH run the following commands:
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
yum install make
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.7-10.tar.gz
tar xvfz ImageMagick-6.6.7-10.tar.gz
cd ImageMagick-6.6.7-10/
./configure && make && make install
This will take some time (just sit want wait). Now you will need to edit the following, but using the following command.
nano /etc/clamd.conf
Look for:
# Don't fork into background.
# Default: no
Foreground yes
And change it to:
# Don't fork into background.
# Default: no
Foreground no
Save ( Ctrl O )
Exit ( Ctrl X )
To add ImageMagick PHP extension, run the following command:
pecl install imagick
Now edit your Php.ini file and add the following under extensions
extension=imagick.so
When you create a new domain in Kloxo you can limit the number of fastcgi processes. By default it is set to unlimited. It is recommended you create a resource plan that limits the number of fastcgi processes based on the type of VPS purchased.
If these solutions do not resolve your memory issues it is likely that your application is using all resources and you may want to consider upgrading your VPS package.
IMPORTANT: This must be done "IN ORDER". Do not skip around. Also, this works for me and that does not mean that it will work for you... Only that it can work for you.
I used nano to edit files. So to edit using nano you would type:
Nano / PATH / File NAME
(nano, space, path to file, and then name of file)
Use your arrow keys or page up & page down keys to move within the document (file).
Ctrl O = Save
Ctrl X = Exit.
Install / Setup a fresh copy of CentOS (either VPS or Dedicated Server) and then...
STEP 1
yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update *
yum upgrade *
yum update *
reboot
STEP 2
You have to disable SELinux by editing /etc/sysconfig/selinux and changing the line to selinux=disabled. This will keep SELinux from being enabled on your server next boot.
Run this command in SSH.
su - root
setenforce 0
If you are unsure this procedure worked, you can run /usr/sbin/sestatus to check its status. Failure to correctly disable SELinux will render your Kloxo install useless and an OS reload may be required to properly reinstall it.
Also, make sure the ports 7778/tcp and 7777/tcp are open in your server firewall or you won't be able to connect to Kloxo web panel when the install completes. On most web host, these ports are open by default.
Type the following commands with SSH
su - root
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-install-master.sh
# sh ./kloxo-install-master.sh
*Fix before Kloxo 6.1.4 version release:
Type the following commands with SSH
cd /
sed -i 's/^;zend_/zend_/' /usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/php.ini
sh /script/upcp
sh /script/fixmail
sh /script/fixwebmail
service courier-imap stop
service qmail stop
service courier-imap start
service qmail start
Edit: /home/kloxo/httpd/webmail/horde/lib/Horde.php
if (($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime'] * 60) < time()) {
TO:
if ((($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime']) * 60) < time()) {
Log-in change default password & user name (As soon as possible)
Change SSH Port (As soon as possible)
Change httpd to lighttpd
Change bind to djbdns (tiny dns)
DO NOT YET SETUP DNS
DO NOT YET SETUP Domains
Do not yet setup accounts
Change no other setting except for above.
STEP 3
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
/bin/rm epel-release-5-4.noarch.rpm remi-release-5.rpm
perl -pi -e 's/enabled=0/enabled=1/g' /etc/yum.repos.d/remi.repo
yum update *
Step 4
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
yum --enablerepo=webtatic update *
yum --enablerepo=webtatic upgrade *
STEP 5
Log into Kloxo
Apply changes as needed & make domains as needed.
STEP 6 -Help prevent SYN flooding DOS attack
Edit /etc/sysctl.conf and add:
#securing tcp connections
net.ipv4.tcp_syncookies=1
#reducing timed out to 30
net.netfilter.nf_conntrack_tcp_timeout_syn_recv=30
Run the following commands in SSH:
This wil create new chains
iptables -N syn-flood
this will limits incoming packets
iptables -A syn-flood -m limit --limit 10/second --limit-burst 50 -j RETURN
this will log attacks
iptables -A syn-flood -j LOG --log-prefix "SYN flood: "
this will silently drop the rest
iptables -A syn-flood -j DROP
service iptables restart
STEP 7
Install memcached
yum install php-pecl-memcache memcached
Then, configure the memcached by editing the file /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="512" <- Amount of memory to use (in MB)
OPTIONS="
Run the following:
chkconfig memcached on
service memcached start
You could try to increase mysql performance by enabling query cache feature.
Edit your /etc/my.cnf and add the following under [mysqld]
query-cache-size=50M (or whatever you think is enough)
Run the exact same queries and then, on mysql console, check on query cache status:
mysql> show status like '%qcache%';
Finally, you need to remove Qmail and IMAP. They seem not to work so well with this setup and vBulletin alone does not need it. But if you do... You can use a few alternatives.
yum remove qmail courier-imap
chkconfig courier-imap --level 0123456 off
chkconfig courier-imap --level 0123456 --del
Now lets do some house cleaning. Run these commands 1 by 1 in SSH
yum clean all
su -c 'yum clean headers'
su -c 'yum clean packages'
su -c 'yum clean metadata'
DONE.
You should now have the latest versions (MySQL, PHP) and all working under Kloxo. Upload and install / restore your copy of vBulletin.
I recommend MySQL Dumber for backups and restores.
http://www.mysqldumper.net
Also if you want to learn more about server management, you may want to attempt a go with Webmin.
--------------- Added 1298868625 at 1298868625 ---------------
Someone sent me a message:
Question: How would you go about installing ImageMagick?
Answer: GD is already installed by default. So ImageMagick isn't truly 100% needed. But if you truly want it, please do the following.
Installing ImageMagick (optional )
In SSH run the following commands:
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
yum install make
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.7-10.tar.gz
tar xvfz ImageMagick-6.6.7-10.tar.gz
cd ImageMagick-6.6.7-10/
./configure && make && make install
This will take some time (just sit want wait). Now you will need to edit the following, but using the following command.
nano /etc/clamd.conf
Look for:
# Don't fork into background.
# Default: no
Foreground yes
And change it to:
# Don't fork into background.
# Default: no
Foreground no
Save ( Ctrl O )
Exit ( Ctrl X )
To add ImageMagick PHP extension, run the following command:
pecl install imagick
Now edit your Php.ini file and add the following under extensions
extension=imagick.so
When you create a new domain in Kloxo you can limit the number of fastcgi processes. By default it is set to unlimited. It is recommended you create a resource plan that limits the number of fastcgi processes based on the type of VPS purchased.
If these solutions do not resolve your memory issues it is likely that your application is using all resources and you may want to consider upgrading your VPS package.