Rebuild apache rpm on Centos4

Download src rpm
http://ftp.riken.jp/Linux/centos/4.7/centosplus/SRPMS/
httpd-2.0.63-2.el4s1.centos.2.src.rpm

Install src rpm
ns2 ~ # rpm -ivh httpd-2.0.63-2.el4s1.centos.2.src.rpm
ns2 ~ # cd /usr/src/redhat/SPECS
ns2 SPECS # vim httpd.spec
%define contentdir /var/www -> %define contentdir /home
ns2 SPECS # rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec
error: Failed build dependencies:
xmlto >= 0.0.11 is needed by httpd-2.0.63-2.el4s1.centos.2.i386
apr-devel >= 0.9.4-20 is needed by httpd-2.0.63-2.el4s1.centos.2.i386
apr-util-devel is needed by httpd-2.0.63-2.el4s1.centos.2.i386
distcache-devel is needed by httpd-2.0.63-2.el4s1.centos.2.i386
Install missing packages
ns2 SPECS # yum install xmlto apr-devel apr-util-devel distcache-devel
ns2 SPECS # rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec
ns2 SPECS # cd ../RPMS
ns2 RPMS # rpm -ivh –force httpd-2.0.63-2.el4s1.centos.2.i386.rpm
ns2 ~ # /etc/init.d/httpd restart
ns2 ~ # suexec -V

Install Proftpd on gentoo

1, add “ftp” use flag to /etc/make.conf

ns2 ~ # emerge proftpd
ns2 ~ # cd /etc/proftpd
ns2 proftpd # cp proftpd.conf.distrib proftpd.conf
ns2 proftpd # vim proftpd.conf
ServerName “ProFTPD Default Installation” -> ServerName “ftp.ns2.example.local”
#DefaultRoot ~ -> comment out
if you like to enable root login: add
RootLogin on
change Server Identification: add
ServerIndent on  ” Ftp Server at …..”
ns2 proftpd # /etc/init.d/proftpd start && rc-update add proftpd default
ns2 etc # vim ftpusers
Comment out root 

install Apache2 + php5 + mysql on gentoo

Install apache2 with php, mysql and ssl

1, Modify /etc/make.conf
add those use flag : apache2 ssl pam xml xml2 pcre session unicode php mysql innodb berkdb

ns2 ~ # emerge apache mysql php
……… when it done
ns2 ~ # /usr/bin/mysql_install_db
ns2 ~ # /etc/init.d/apache restart && rc-update add apache default

Vmware Server2 shutdown guest when shutdown/reboot host on gentoo

1, Setup vmware to suspend or shutdown from Edit virtual machine startup/shutdown settings

2. add “/etc/init.d/vmware stop” into /etc/conf.d/local.stop

 

Refrence : http://www.wiredrevolution.com/gentoo/run-a-command-at-boot-with-gentoo

Normally in Gentoo you would want to create an init script via rc-update to start a service at boot. However if there are a few miscellaneous commands you would like to run you can add them to local.start.

The local.start init script is similar to rc.local in other distributions. It is the last init script to be run after all other services have been started at the end of the boot process.

Add your commands to local.start file located here.
/etc/conf.d/local.start

You can also make commands run when the system is shutdown. These commands should be placed in local.stop located here.
/etc/conf.d/local.stop

Vmware Server2 console not popup on gentoo

When Vmware server2 console not popup with those error

ns2 ~ # firefox
No running windows found
/root/.mozilla/firefox/t0qxjlxh.default/extensions/VMwareVMRC@vmware.com/plugins/bin/
vmware-vmrc: symbol lookup error
/root/.mozilla/firefox/t0qxjlxh.default/extensions/VMwareVMRC@vmware.com/plugins/lib/
libvmwareui.so.0/libvmwareui.so.0: undefined symbol: _ZThn16_N3Gtk5TableD1Ev

try

ns2 ~ # VMWARE_USE_SHIPPED_GTK=yes firefox

updating kernel on gentoo

ns2 ~ # emerge –sync
ns2 ~ # emerge –update –deep -p world

to check?

ns2 ~ # emerge –update –deep world

if no prob
or

ns2 ~ # emerge kernel-source

change symbolic link
Eg., /usr/src/linux -> linux-2.6.26-gentoo-r4/ must point latest kernel source

make config for kernel
Eg., copy old .config to new kernel and run

ns2 linux # make oldconfig

compile kernel, set grub

if using nvidia for graphic must re-compile nvidia modules else X not startup.
Eg., run “module-rebuild rebuild”. Need sys-kernel/module-rebuild or

ns2 ~ # emerge ndivia-drivers
ns2 ~ # ldmod | grep nvidia && rmmod nvidia
ns2 ~ # modprobe nvidia
ns2 ~ # update-modules

gentoo emerge note

ns2 ~ # emerge –sync
ns2 ~ # emerge –update –deep world

Blocked Packages

Code Listing 4.1: Portage warning about blocked packages (with –pretend)
[blocks B     ] mail-mta/ssmtp (is blocking mail-mta/postfix-2.2.2-r1)

Code Listing 4.2: Portage warning about blocked packages (without –pretend)
!!! Error: the mail-mta/postfix package conflicts with another package.
!!!        both can’t be installed on the same system together.
!!!        Please use ’emerge –pretend’ to determine blockers.

Ebuilds contain specific fields that inform Portage about its dependencies. There are two possible dependencies: build dependencies, declared in DEPEND and run-time dependencies, declared in RDEPEND. When one of these dependencies explicitly marks a package or virtual as being not compatible, it triggers a blockage.
To fix a blockage, you can choose to not install the package or unmerge the conflicting package first. In the given example, you can opt not to install postfix or to remove ssmtp first.

Show maintenance page with apahce

.htaccess can redirect http request.
This is one of example how to show maintenance page.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR}       !^192\.168\.1\.100$ #ignore this setting if access from 192.168.1.100
RewriteBase / #any access below http://www.sample.local/ directory
RewriteRule (.*)$ /maintenance.html #reloaded pages is… 
</IfModule> 

To use this, you must install mod_rewrite.

free web log analyzer “Visitors” 10000 line in 1 seconds

Visitors – fast web log analyzer
http://www.hping.org/visitors/

 

How To install

wget http://www.hping.org/visitors/visitors-0.7.tar.gz
tar xvzf visitors-0.7.tar.gz
cd visitors_0.7
make
cp visitors /usr/bin/

 

Usege

like: visitors -A -m 30 access.log -o html > report.htm
like: visitors -A -m 30 access.log -o html –trails –prefix http://howto.net > report.html 

 

make flowchart with Graphviz
http://www.graphviz.org/Download..php

 

How To install

wget http://dag.wieers.com/rpm/packages/graphviz/graphviz-2.2-1.2.el4.rf.i386.rpm

rpm -ivh graphviz-2.2-1.2.el4.rf.i386.rpm 

 

Usege

1, make graph.dot
visitors access.log –prefix http://sample.net -V > graph.dot

2, make PNG image
dot -Tpng graph.dot > graph.png

 

for better use
visitors -GKZWMRDXYS -m 30 access_log –trails –prefix http://sample.net -o html > `date –date ‘1 day ago’ +%Y%m%d`report.html

visitors access_log –prefix http://gigazine.net -V > graph.dot

dot -Tpng graph.dot > `date –date ‘1 day ago’ +%Y%m%d`graph.png