Install GlusterFS on Centos 6 Virtuozzo Container

Preparation


yum install bison automake flex libtool gcc fuse fuse-libs python-ctypes rsync readline-devel compat-readline5
yum remove rsync
cd /usr/local/src
wget http://packages.sw.be/rsync/rsync-3.0.7-1.el5.rfx.x86_64.rpm
rpm -Uvh rsync-3.0.7-1.el5.rfx.x86_64.rpm

Continue reading

Posted in General, Linux, Virtuozzo | Tagged , | Leave a comment

Install NGINX & PHP 5.3 with FPM on Centos 6 (2)

Install mysql, mysql-devel, & mysql-libs with yum. Then add rpmforge repo because we’re going to install libmcrypt-devel that doesn’t available on standard Centos Repo.

rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

or you can follow direction here
Dont forget to disable RPMForge because all we need from there is just libmcrypt.

nano /etc/yum.repos.d/rpmforge.repo

Edit line contain “enabled=1″ and change it to 0 :

enabled = 0

Install libmcrypt-devel & other dependencies:

yum --enablerepo=rpmforge install libmcrypt-devel
yum install libc-client-devel

Continue reading

Posted in General, Linux, nginx | 1 Comment

Install NGINX & PHP 5.3 with FPM on Centos 6 (1)

Install NGINX Dependency
NGINX depend on PCRE :

yum install pcre-devel

Continue reading

Posted in Linux, nginx, Technical Standard | Tagged , | Leave a comment

Parallels Virtuozzo 4.7 Install Guide for Centos 6 Minimal Installation

After finishing install Centos 6 with minimal option, add packages required by Virtuozzo 4.7 :

yum install pkgconfig bind bind-utils make gcc kernel-headers glibc perl ntpdate openssh-clients bc ed wget

A lot of customer are using Virtuozzo for OpenVPN, so it will need tun module to be loaded before vz services started :

echo modprobe tun >> /etc/rc.modules
echo modprobe fuse >> /etc/rc.modules
chmod +x /etc/rc.modules

Now you can start install Virtuozzo. Looking for Virtuozzo installation howto? Just visit their website :)
After succesfully installing Virtuozzo, we’ll add iptables module so that any container need it can use them :
nano /etc/vz/vz.conf
replace IPTABLES line with :

IPTABLES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ip_conntrack_ftp ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp"

Centos 6 by default are using ext4 filesystem. According to Parallels recommendation, /vz partition must be mount should be customized with following option :
defaults,noatime,data=writeback,barrier=0
Edit /etc/fstab and add that option to the mounting option of /vz partition.

That’s it :)

Posted in Linux, Virtuozzo | Leave a comment

Make Virtuozzo Container be Able to Run ConfigServer Firewall (CSF)

This has to be done on Virtuozzo Hardware Node. Edit file /etc/vz/vz.conf :

IPTABLES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ip_conntrack_ftp ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp xt_state ipt_recent"

Edit file /etc/sysconfig/iptables-config :

IPTABLES_MODULES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ip_conntrack_ftp ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp xt_state ipt_recent"
Posted in Linux, Virtuozzo | Leave a comment

How to Install NGINX, PHP with PHP-FPM, and MySQL on Centos 5.5 (2)

OK now let’s add PHP and MySQL Support. I assume we already got MySQL on our system. If you dont, you can find somewhere else about how to install MySQL.

Get latest PHP source and PHP-fpm patch somewhere and put it on /usr/local/src folder. Proceed :


yum install libc-client-devel curl-devel libmcrypt-devel libmhash-devel yum install libevent-devel
cd /usr/local/src
tar -zxvf php-5.2.16.tar.gz
gzip -cd php-5.2.16-fpm-0.5.14.diff.gz | patch -d php-5.2.16 -p1
cd php-5.2.16
nano konfig

Paste this configure option :


./configure --enable-fastcgi --enable-fpm --with-mcrypt --enable-bcmath --enable-calendar --enable-exif --with-mysql --with-libdir=lib64 --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-soap \
--enable-sockets --enable-zip --prefix=/usr --with-curl=/usr --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-gettext --with-imap --with-imap-ssl=/usr --with-kerberos --with-jpeg-dir=/usr --with-libexpat-dir=/usr \
--with-libxml-dir=/usr --with-mysqli --with-openssl=/usr --with-openssl-dir=/usr --with-pic --with-png-dir=/usr --with-pspell --with-ttf --with-xmlrpc --with-xpm-dir=/usr --with-xsl --with-zlib --with-zlib-dir=/usr \
--enable-inline-optimization --with-bz2 --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-sqlite=shared --enable-wddx --with-mhash --enable-sysvsem --enable-sysvshm --enable-mbregex

then chmod konfig to add executable permission and compile PHP :


chmod +x konfig
./konfig
make
make install
pecl install memcache
cp /usr/local/src/php-5.2.16/php.ini-dist /usr/lib/php.ini
mkdir /etc/php/
ln -s /usr/lib/php.ini /etc/php/
ln -s /usr/etc/php-fpm.conf /etc/php/

Give php-fpm.conf a little touch on the default configuration on the process user & group part :


nano /etc/php/php-fpm.conf

Uncomment these line :


nobody
nobody

Then edit nginx default site configuration on /etc/sites/default.conf


        location ~ \.php$
        {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_index index.php;
                include /usr/local/nginx/conf/fastcgi_params;
        }
}

Now restart NGINX

Posted in Linux, nginx | Leave a comment

How to Install NGINX, PHP with PHP-FPM, and MySQL on Centos 5.5 (1)

This article is for my personal note. I wont write about dependency softwares installation. I assume you already have them. If you dont, during installation you will know what softwares must be installed first as dependency.


cd /usr/local/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx-0.8.54.tar.gz
cd nginx-0.8.54
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module
make
make install
ln -s /usr/local/nginx/conf /etc/nginx

Continue reading

Posted in Linux, nginx | Tagged , | 2 Comments

Install Munin on cPanel

I always have problem when installing cPanel’s Munin through WHM. Solution is quite simple. Just run :
/scripts/checkperlmodules --force
then try re-install it through WHM.

Posted in CPANEL, Hosting | Tagged , , | 1 Comment

Mount /tmp with noexec,nosuid options on Openvz

Simply do this :


# mount -t tmpfs -o noexec,nosuid tmpfs /tmp/
# cat /proc/mounts
simfs / simfs rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
tmpfs /tmp tmpfs rw,nosuid,noexec 0 0

and dont forget to insert to /etc/fstab :

tmpfs /tmp tmpfs noexec,nosuid 0 0
tmpfs /var/tmp tmpfs noexec,nosuid 0 0

Posted in Linux | Tagged , , | Leave a comment

Creating OpenVZ OSTemplate

Actually this article is not about creating OS template. Well, it’s about when you done customizing some OS Template and you want to backup or make it as a new pre-configured OS template :

  1. Shutdown your OpenVZ container : vzctl stop {CTID}
  2. As root, go to /vz/private/{CTID} and launch : tar -cvzf /vz/template/cache/{OSTemplate-Name}.tar.gz .
Posted in Linux | Tagged , , | Leave a comment