10/21/2007

Macintosh10.4.8 apache2 php5 mediawiki1.8

#install mysql
cd ~/mysql-5.027
./configure --prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/run/mysql_socket \
--with-mysqld-user=mysql \
--with-comment \
--with-debug
make
sudo make install
sudo make clean
sudo /usr/local/mysql/bin/mysql_install_db --force
sudo mkdir /usr/local/mysql/run
sudo chgrp -R mysql /usr/lcoal/mysql
sudo chown -R mysql /usr/local/mysql/run /usr/local/mysql/var
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/mysql/bin/mysqladmin -u root password picb
sudo mkdir /var/mysql
cd /var/mysql
sudo ln -s /usr/local/run/mysql_socket ./mysql.sock

#istall apache2
cd ~/httpd-2.2.3
./configure --prefix=/usr/local/apache2 \
--enable-module=most \
--enable-shared=max
make
sudo make install
sudo make clean
sudo /usr/local/apache2/bin/apachectl start

#install GD (before this we should have installed or have to install libxml2,zlib,libpngjpeg,
#freetype please check it, my OS no need to install libxml2 & zlib, but can install as follow: )

#install libxml2
cd ~/libxml2-2.6.27
./configure
make
sudo make install
sudo makeclean

#install zlib
cd ~/zlib-1.2.3
./configure
make
sudo make install
sudo makeclean

#install libpng
cd ~libpng-1.2.14
cp scripts/makefile.darwin Makefile
vi makefile
# Where the zlib library and include files are located
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
make
sudo make install
sudo make clean

#install jpeg
cd ~/jpeg-6b/
ln -s /usr/bin/glibtool ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.4
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --prefix=/usr/local/jpeg6 \
--enable-shared
make
sudo mkdir /usr/localjpeg6
sudo mkdir /usr/localjpeg6/include
sudo mkdir /usr/localjpeg6/lib
sudo mkdir /usr/localjpeg6/bin
sudo mkdir /usr/localjpeg6/man
sudo mkdir /usr/localjpeg6/man/man1
sudo make install-lib
sudo make install
sudo make clean

#install freetype2
cd ../freetype-2.2.1
/*edit the file include/freetype/config/ftoption.h and uncomment line 439 to read:
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
*/
./configure --prefix=/usr/local/freetype2
make
sudo make install
sudo make clean

#install GD
sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include
cd ~/gd-2.0.33
./configure --prefix=/usr/local/gd2 \
--with-zlib \
--with-png=/usr/local/libpng2 \
--with-jpeg=/usr/local/jpeg6 \
--with-freetype=/usr/local/freetype2
make
sudo make install
sudo make clean

#install libiconv
cd ~/libiconv-1.11
./configure --prefix=/usr/local/libiconv
make
sudo make install
sudo make clean

#install php5
cd ~/php-5.2.0
cd ./ext/iconv
ln -s /usr/local/libiconv/include/iconv.h iconv.h
./configure --prefix=/usr/local/php \
--with-zlib --with-xml \
--with-ldap=/usr \
--with-mysql=/usr/local/mysql \
--with-gd \
--with-jpeg-dir=/usr/local/jpeg6 \
--with-png-dir=/usr/local/libpng2 \
--with-iconv=/usr/local/libiconv \
--with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-exif \
--enable-ftp --enable-mbstring \
--enable-dbx --enable-sockets \
--with-iodbc=/usr --with-curl=/usr
make
sudo make install
sudo make clean
sudo cp php.ini-dist /usr/lcoal/php/lib/php.ini
vi apache2/conf/httpd.conf
/* add these lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php

LoadModule php5_module modules/libphp5.so (if not work add it)
LoadModule mod_php5 /usr/local/php/libphp5.so (if not work add it)
*/


#setup mediawiki
WiKi name picb
contactmail andy@picb.ac.cn
language en-English
license no liense metadata
Adminname WikiSysop
password picb
share M no cache
Database Type MySOL
Database host localhost
DB name wikidb
DB usrname wikiuser
password picb
super acco root
password picb

mv ~/config/LocalSettings.php ~/
rm -rf ~/config

#wiki Localsetting.php configure
#use EmEditor to edit this file and save in type of UTF-8 and erase tickle of "Add a Unicode Signature(BOM)"
change $wgEnableUploads =true; #allow user to upload file

add $wgLocalTZoffset = 8; #set time zone

require_once( 'LdapAuthentication.php' ); #set ldap
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array( "icb.ac.cn" );
$wgLDAPServerNames = array( "icb.ac.cn"=>"10.10.118.2");
$wgLDAPSearchStrings = array( "icb.ac.cn"=>"uid=USER-NAME,cn=users,dc=pdc,dc=icb,dc=ac,dc=cn");
$wgLDAPUseSSL = false;
$wgLDAPUseLocal = true;
$wgLDAPAddLDAPUsers = false;
$wgLDAPUpdateLDAP = false;
$wgLDAPMailPassword = false;
$wgLDAPRetrievePrefs = false;
$wgMinimalPasswordLength = 1;

#authenticat upload file type
$wgShowIPinHeader = false; #restrict user right to create account
$wgGroupPermissions['*' ]['createaccount'] = false;
$wgGroupPermissions['*' ]['edit'] = false;

$wgWhitelistRead = array( "Main Page", "Special:Userlogin" ); #anonymousr only can reae main page
$wgGroupPermissions['*' ]['read'] = false;

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'ppt', 'zip', 'rar', 'doc', 'avi', 'mp3', 'rm', 'txt', 'rmvb', 'mpg', 'csv', 'xls' );
/** Files with these extensions will never be allowed as uploads. */
$wgFileBlacklist = array(
# HTML may contain cookie-stealing JavaScript and web bugs
'html', 'htm', 'js', 'jsb',
# PHP scripts may execute arbitrary code on the server
'php', 'phtml', 'php3', 'php4', 'phps',
# Other types that may be interpreted by some servers
'shtml', 'jhtml', 'pl', 'py', 'cgi',
# May contain harmful executables for Windows victims
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );

cp LdapAuthentication.php to ~/wiki/includes
chomod a+w+r ~/wiki/images
#to support show formula through latex
download and install ocaml & mactex
cd ~/mediawiki/math
make
and then we can see the texvc be install under directory math, however the apache use it so we should add it to PATH
export PATH=$PATH;~/mediawiki/math
enable $wgUseTeX in LocalSettings.php

0 comments: