TileCache for Windows Revisited

January 17th, 2007 rupert Comments off

1. Downloaded TileCache1.8 from http://www.tilecache.org/

2. Get the current releases of python and mod_python.
http://www.python.org/download/releases/2.5/

http://httpd.apache.org/modules/python-download.cgi -> click on win32 binaries. Get the mod_python-3.3.1.win32-py2.5-Apache2.2.exe if your Apache is running on 2.2.

http://www.pythonware.com/products/pil/

http://effbot.org/downloads/PIL-1.1.6.win32-py2.5.exe

3. Install python2.5

4. Install mod_python and python_imaging.

5. Edit httpd.conf

LoadModule python_module modules/mod_python.so
 
<directory>
AddHandler python-program .py
PythonHandler test
PythonDebug On
</directory>
 
<directory>
	AddHandler python-program .py .cgi
	PythonHandler TileCache.Service
	PythonOption TileCacheConfig /wwwroot/tilecache/tilecache.cfg
	PythonDebug On
</directory>
 
ScriptInterpreterSource Registry
SetEnv PYTHONUNBUFFERED 1
PassEnv PYTHONPATH

6. run regedit. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4\PythonPath. Append “E:\wwwroot\tilecache” to PYTHONPATH

D:\Python24\Lib;D:\Python24\DLLs;D:\Python24\Lib\lib-tk;E:\wwwroot\tilecache;

7. Put D:\Python24 in your WINDOWS PATH

8. Test if apache could read python by http://127.0.0.1/pytest/test.py

9. http://127.0.0.1/tilecache/test1.cfm

10. tilecache_seed.py “http://127.0.0.1/tilecache/tilecache.py” roads 12 17 “116.28229,39.85291,116.48657,39.98783″

Installing MS4W, Python2.4, ColdFusion6.1

January 17th, 2007 rupert Comments off

For Windows:

A. Installing MS4W
1. Download ms4w2.2 from maptools.org

2. Extract ms4w2.2 into your root drive (E:\)

3. Run E:\ms4w\apache-install.bat. This would install apache2.2 as a service.

4. Edit E:\ms4w\Apache\conf\httpd.conf to reflect your webroot in “DocumentRoot” (E:\wwwroot\)

149 DocumentRoot "/wwwroot"
...
....
177 <directory>
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
 
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
 
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
205 </directory>
....
....
212 DirectoryIndex index.html index.html.var index.php index.phtml index.php3 index.cfm
....
....

5. Test apache, navigate to “http://127.0.0.1/”.

B. Configuring Apache2.2 with ColdFusion6.1
6. Since Apache2.2 was released after CF6.1 and CF7.0 then, it would only bind with Apache2.0.x. We need a new wsconfig.jar that would bind with Apache2.2.x. Read more about the technote:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8001e97

Alternatively, you could download wsconfig.jar from http://www.adobe.com/support/coldfusion/ts/documents/8001e97/wsconfig.zip

7. Backup your existing wsconfig.jar to wsconfig.jar.bak. Replace the wsconfig.jar.

8. Restart ColdFusion.

9. Remove existing connectors from D:\CFusionMX\bin\connectors\Remove_ALL_connectors.bat

10. Execute D:\CFusionMX\bin\connectors\Apache_connector.bat

@echo off
echo WARNING!  This will install the ColdFusion MX Apache Connector.
echo Press Control+C to abort.
pause
SETLOCAL
PATH=..\..\runtime\jre\bin;%PATH%
java -jar ..\..\runtime\lib\wsconfig.jar  -ws apache -bin "e:\\ms4w\Apache\bin\httpd.exe" -dir "e:\\ms4w\apache\conf" -map .cfm,.cfc,.cfml -coldfusion -v
ENDLOCAL

11. Restart Apache and ColdFusion. Browse to http://127.0.0.1/cfide/administrator/index.cfm

C. Installing Python2.4
1. Read Reference document from maptools.org install site

2. Download Python2.4 from http://www.python.org/ftp/python/2.4/python-2.4.msi. Download mod_python from mod_python-3.3.0b.win32-py2.4-Apache2.2.exe

3. Install Python2.4 in your root drive. (D:\)

4. Install mod_python-3.3.0b.win32-py2.4-Apache2.2.exe

5. Edit your Windows Environment Variables (System Variable: PATH) to include “D:\Python23″

6. Edit E:\ms4w\Apache\conf\httpd.conf

#For Python
LoadModule python_module modules/mod_python.so
 
<directory>
	AddHandler python-program .py
	PythonHandler test
	PythonDebug On
</directory>
 
ScriptInterpreterSource Registry
SetEnv PYTHONUNBUFFERED 1
PassEnv PYTHONPATH

7. Restart Apache and test from http://127.0.0.1/pytest/test.py. If you see a “Hello World” web page from python then you are good to go. Sample python test page “test.py”:
E:\wwwroot\pytest\test.py

from mod_python import apache
 
def handler(req):
	req.content_type = 'text/plain'
	req.write("Hello World!")
	return apache.OK
Categories: mapserver, ms4w Tags: , ,

WordPress Plugins: CodeHighlight and DBBackup

January 16th, 2007 rupert 1 comment

1. I am currently using dean lee code highlighting for wordpress. Code is as follows:

echo "hello world";
?&gt;

To edit the code-highlight options go to: OPTIONS > Code Highlight

2. Download WP-DBManager. Extract it in the wp plugins directory and your good to go. Options for configuring can be found in “DATABASE” link in the Admin Site. Remember to change the Database options as follows:

for windows:

Path To mysqldump: mysqldump.exe
Path To mysql: mysql.exe
Path To Backup: E:\\wwwroot\wordpress\wp-content\backup-db

for linux:

Path To mysqldump: mysqldump
Path To mysql: mysql
Path To Backup: /usr/local/apache2/htdocs/wordpress/wp-content/backup-db

Categories: WordPress Tags:

Installing myhightman plugin in MySQL

January 15th, 2007 rupert Comments off

1. You need a fresh linux machine without mysql installed. You could follow the instructions from
here

2. Download myhightman.tar.gz which I already compiled.
myhightman.tar.gz

Extracting…

-rw-r--r-- 1 root root 377 Jan 12 17:00 bash_profile
drwxr-xr-x 2 1001 wheel 4096 Sep 14 00:30 ft_hightman
-rw-r--r-- 1 1001 wheel 4171 Sep 14 00:25 ft-hightman-M5-0.1.patch
-rw-r--r-- 1 root root 17955 Jan 11 18:52 ft-hightman-M5-0.1.tgz
-rw-r--r-- 1 root root 2051 Jan 12 17:00 install.sh
-rw-r--r-- 1 root root 574 Jan 11 19:19 my.cnf
drwx--x--x 2 root root 4096 Jan 11 19:37 mysql
-rw-r--r-- 1 root root 22265695 Jan 11 18:52 mysql-5.1.11-hi1.tgz
-rw-r--r-- 1 1001 wheel 3450 Sep 14 00:31 README.hightman_parser
-rw-r--r-- 1 root root 0 Jan 11 18:52 stopwords-gbk.txt
-rw-r--r-- 1 root root 3 Jan 11 18:52 stopwords-utf8.txt
-rw-r--r-- 1 root root 1466369 Jan 11 18:52 wordlist-gbk.txt
-rw-r--r-- 1 root root 1907299 Jan 11 18:52 wordlist-utf8.txt

3. install.sh:

#!/bin/sh
mysql_install_dir="./mysql-5.1.11-hi1"
mysql_base_dir="/usr/local/mysql"
hightman_patch="./ft-hightman-M5-0.1.patch"
stopword="stopwords-utf8.txt"
wordlist="wordlist-utf8.txt"
data_dir="/data/mysqldata"
temp_dir="/data/temp_dir"
 
echo "removing previous installation"
rm -rf $mysql_install_dir
 
echo "unpacking $mysql_install_dir"
tar -zxvf $mysql_install_dir.tar.gz
 
echo "copying ft_hightman to $mysql_install_dir/plugin"
cp -Rf ft_hightman $mysql_install_dir/plugin/
 
echo "copying $hightman_patch to $mysql_install_dir"
cp $hightman_patch $mysql_install_dir/
 
echo "patching please answer y to all..."
cd $mysql_install_dir
patch -p1 &lt; $hightman_patch
 
echo "patching again..."
patch -p1 &lt; $hightman_patch
 
echo "processing......."
 
echo "aclocal......."
aclocal
 
echo "automake......."
automake
 
echo "autoconf......."
autoconf
 
echo "configuring..."
./configure --prefix=$mysql_base_dir --with-charset=utf8 --with-extra-charsets=all --with-plugins=fthightman
 
echo "make..."
make
 
echo "make install..."
make install
 
echo "copying wordlist and stoplist to $mysql_base_dir/share/mysql"
cd ..
cp -Rf $stopword $mysql_base_dir/share/mysql/
cp -Rf $wordlist $mysql_base_dir/share/mysql/
 
echo "making mysql datadir on $data_dir"
rm -rf $data_dir
rm -rf $temp_dir
mkdir -p $data_dir
mkdir -p $temp_dir
 
echo "copying my.cnf default file to /etc"
cp -Rf my.cnf /etc/my.cnf
 
echo "copying custom mysql database to $data_dir"
cp -Rf mysql $data_dir
 
echo "changing ownership..."
useradd mysql
useradd -g mysql mysql
chown -Rf mysql:mysql $data_dir
chown -Rf mysql:mysql $temp_dir
 
echo "linking myhightman.so..."
ln -s /usr/local/mysql/lib/mysql/myhightman.so /usr/lib/myhightman.so
 
echo "creating startup scripts..."
cp -rf $mysql_base_dir/share/mysql/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
/sbin/chkconfig --add mysql
/sbin/chkconfig --level 345 mysql on
/etc/init.d/mysql start
 
echo "YOU HAVE SUCCESSFULLY INSTALLED mysql5 with HIGHTMAN. please add this to your path..."
echo "export PATH=$PATH:$mysql_base_dir/bin"

4. CREATE FUNCTION segment RETURNS STRING SONAME ‘myhightman.so’;

5. SET NAMES ‘utf8′;

Categories: mysql Tags:

Preparing your linux machine

January 15th, 2007 rupert Comments off

1. For production servers, you need to install CentOS4.4 minimal.
- Create partitions as follow:
/boot – 100
swap – 2x as the memory, if the memory is 2GB, then your swap should be 4096MB
/ – assign the rest for root
/data – if needs be
- Choose GRUB as boot loader.
- Disable SELINUX
- Enable httpd, sshd
- Choose minimal

2. Get connected to your network. Modify your network as needed. Network configuration scripts are found in

/etc/sysconfig/network-scripts/

You should see at least the ff, depending on how many ethernet interfaces you have:

ifcfg-eth0
ifcfg-lo

Edit ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=static
HWADDR=00:16:96:10:F3:2B
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.168.1.105
GATEWAY=192.168.1.1

3. Edit your hostname:

#vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=rupert-linux

4. Edit your hosts:

# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 rupert-linux localhost.localdomain localhost
192.168.1.10 appserver
192.168.1.11 dbserver1
192.168.1.12 svnserver

Providing ip addreses on your hosts can make network access faster, depending on the routes.

5. Edit your path to reflect the ff:

#vi /etc/skel/.bash_profile
PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin
export HTDOCS=/usr/local/apache2/htdocs
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib

cp -Rf /etc/skel/.bash_profile /home/rupert/
cp -Rf /etc/skel/.bash_profile /home/tan/
cp -Rf /etc/skel/.bash_profile /root/
6. Copy the centos packages into your harddisk, so you don’t need the CD’s later on. Reboot.

7. Install the ff rpms:

#install gcc
echo "installing gcc"
rpm -ivh cpp-3.4.6-3.i386.rpm
rpm -ivh glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
rpm -ivh glibc-headers-2.3.4-2.25.i386.rpm
rpm -ivh glibc-devel-2.3.4-2.25.i386.rpm
rpm -ivh gcc-3.4.6-3.i386.rpm

echo “installing gcc++”
rpm -ivh compat-libstdc++-33-3.2.3-47.3
rpm -ivh compat-libstdc++-296-2.96-132.7.2
rpm -ivh libstdc++-3.4.6-3
rpm -ivh gcc-c++-3.4.6-3

#installing other utilies
rpm -ivh apr-0.9.4-24.5.c4.2.i386.rpm
rpm -ivh apr-util-0.9.4-21.i386.rpm
rpm -ivh neon-0.24.7-4.i386.rpm
rpm -ivh perl-URI-1.30-4.noarch.rpm
rpm -ivh umb-scheme-3.2-36.EL4.i386.rpm
rpm -ivh guile-1.6.4-14.i386.rpm
rpm -ivh swig-1.3.21-6.i386.rpm
rpm -ivh subversion-1.1.4-2.ent.i386.rpm
rpm -ivh perl-DBI-1.40-8.i386.rpm
rpm -ivh nmap-3.70-1.i386.rpm
rpm -ivh vim-common-6.3.046-0.40E.7.i386.rpm
rpm -ivh vim-enhanced-6.3.046-0.40E.7.i386.rpm
rpm -ivh binutils-2.15.92.0.2-21.i386.rpm
8. Disable unneeded services.

chkconfig bluetooth off
chkconfig cups off
chkconfig irda off
chkconfig isdn off
chkconfig netdump off
chkconfig netfs off
chkconfig nfs off
chkconfig nfslock off
chkconfig nscd off
chkconfig openibd off
chkconfig pand off
chkconfig pcmcia off
chkconfig portmap off
chkconfig rhnsd off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig rpcsvcgssd off
chkconfig sendmail off
chkconfig syslog off
chkconfig xfs off
chkconfig xinetd off
chkconfig ypbind off
chkconfig yum off

Categories: linux Tags: