CentOS+Apache+PHP+MYSQL+Python+Trac

这个是我给公司配服务器时候做的记录, 先占个位置, 以后补全.

CentOS 4.5

操作系统用的是CentOS 4.5 , 主要是因为CentOS不会有版权问题.

MYSQL 5.0.5la

root@localhost

shell> groupadd mysql
shell> useradd -g mysql mysql

shell> ./configure –prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe –user=mysql &

#echo '/usr/local/mysql/bin/mysqld_safe –user=mysql &' >> /etc/rc.local

Apache没有用2.2, 而是用了2.0, 比较稳定也足够用.

APACHE 2.0.63

DocumentRoot /usr/local/apache2/htdocs

shell> ./configure –prefix=/usr/local/apache2 –enable-dav –enable-dav-fs –enable-so –enable-rewrite
shell> make
shell> make install

PHP 5.2.5

shell> ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –prefix=/usr/local/php5

shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php5/lib/php.ini

shell> vim /usr/local/apache2/conf/httpd.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

DirectoryIndex index.php index.html index.htm

AllowOverride All

/etc/rc.d/rc5.d/S97lamp

/usr/local/mysql/bin/mysqld_safe –user=mysql &
/usr/local/apache2/bin/apachectl start

下面这些东西是给php提供gd支持的.

zlib 1.2.3

freetype 2.1.10

libpng 1.2.25

jpeg-6b

gd 2.0.33

tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure –prefix=/usr/local/modules/freetype
make
make install

tar zxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure
make
make install

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure –prefix=/usr/local/modules/jpeg6 –enable-shared –enable-static
make
make install

tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure –prefix=/usr/local/modules/gd –with-jpeg=/usr/local/modules/jpeg6 –with-png –with-zlib –with-freetype=/usr/local/modules/freetype
make
make install

先把目录建了, 要不编译的时候会找不到文件夹.

mkdir jpeg6

mkdir jpeg6/include

mkdir jpeg6/lib

mkdir jpeg6/bin

mkdir jpeg6/man

mkdir jpeg6/man/man1

shell> ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –prefix=/usr/local/php5 –with-iconv –with-mbstring –enable-mbstring –with-jpeg-dir=/usr/local/jpeg6/ –with-zlib –with-png –with-freetype-dir=/usr/local/freetype/ –with-gd=/usr/local/gd/

Subversion 1.4.6

shell>./configure –prefix=/usr/local/subversion

一开始打算用mysql来存放账号密码的, 建好了数据表但是没有用.

CREATE DATABASE svn;
CREATE TABLE user (
username varchar(25) collate utf8_unicode_ci NOT NULL default ‘’,
passwd varchar(25) collate utf8_unicode_ci NOT NULL default ‘’,
groups varchar(25) collate utf8_unicode_ci NOT NULL default ‘’,
PRIMARY KEY (username),
KEY groups (groups)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

mod_python 3.3.1

./configure –with-apxs=/usr/local/apache2/bin/apx
make
make install

clearsilver-0.10.5

shell>./configure –disable-apache –disable-csharp –disable-ruby –prefix=/usr/local/clearsliver –with-python

shell>make

shell>make install

shell>cd python/

PYTHON_SITE='python -C
“import sys; print [path for path in sys.path if path.find('site-packages') != -1][0]”'

shell>python setup.py install

mysql-python 1.2.2

set.cfg
修改mysql_config绝对路径
安全线程->false
shell>python setup.py build
shell>puthon setup.py install

trac 0.11b2

tar zxvf trac-0.10.4.tar.gz

python ./setup.py install

trac-admin /usr/local/trac/order initenv    (/usr/loca/trac 目录会自动创建)

#Project Name [My Project]> test
#Database connection string [sqlite:db/trac.db]> mysql://trac:trac@localhost/trac  //前面创建数据库所用的到信息
#Repository type [svn]>     //这里为空,直接回车
#Path to repository [/path/to/repos]> /var/svn/order   //SVN仓库地址

<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /usr/local/trac
SetEnv PYTHON_EGG_CACHE /tmp
PythonOption TracUriRoot /trac
AuthType Basic
AuthName “test's trac”
AuthUserFile /var/svn/passwd
Require valid-user