2012年5月30日星期三

LinuxでソースからCakePHPの開発環境構築


ソフトウェア リスト

【Webサーバ】
    ・httpd-2.2.22.tar.gz
  【開発言語】
    ・php-5.4.3.tar.gz
    ・cakephp-cakephp-2.1.1-0-g43cf2f0.zip
  【DBサーバ】
    ・mysql-5.5.24.tar.gz
  【バージョン管理サーバ】
    ・subversion-1.7.5.tar.gz
  

Apacheのインストール

  System Requirements

libtool
    autoconf
    Disk Space
    ANSI-C Compiler and Build System(The GNU C compiler (GCC)is recommended)
    Accurate time keeping
    Perl 5 [OPTIONAL]
    apr/apr-util >= 1.2
  

  Obtain the Apache HTTP server


  Build and install Apache

    gzip -d httpd-2_x_NN.tar.gz
    tar -xf httpd-2_x_NN.tar
    cd httpd-2_x_NN
    ./configure --enable-so
    make
    make install
  

  Setup httpd.conf


  Confirming or testing installation

    /usr/local/apache2/bin/httpd -t
    /usr/local/apache2/bin/apachectl start
    /usr/local/apache2/bin/apachectl stop
  


Installing MySQL from a Standard Source Distribution

Source Installation System Requirements

    CMake                ※http://www.cmake.org. 
    make※GNU make 3.75 or newer is recommended 
    ANSI C++ compiler    ※GCC 4.2.1 or later is recommended
    Perl                 ※is needed if you intend to run test scripts
    GNU gunzip
    GNU tar※is available from  
  

Preconfiguration setup

    shell> groupadd mysql
    shell> useradd -r -g mysql mysql

Beginning of source-build specific instructions

    shell> tar zxvf mysql-VERSION.tar.gz
    shell> cd mysql-VERSION
    shell> cmake .
    shell> make
    shell> make install
  

Beginning of source-build specific instructions

    shell> tar zxvf mysql-VERSION.tar.gz
    shell> cd mysql-VERSION
    shell> cmake .
    shell> make
    shell> make install
  

Postinstallation setup

    
    shell> cd /usr/local/mysql
    shell> chown -R mysql .
    shell> chgrp -R mysql .
    shell> scripts/mysql_install_db --user=mysql
    shell> chown -R root .
    shell> chown -R mysql data
  

Next command is optional

    
    shell> cp support-files/my-medium.cnf /etc/my.cnf
    shell> bin/mysqld_safe --user=mysql &
    shell> cp support-files/mysql.server /etc/init.d/mysql.server
  

Postinstallation Setup and Testing


PHPのインストール

  General Installation Considerations


    For what

    1.Websites and web applications (server-side scripting)  ○
    2.Command line scripting
    3.Desktop (GUI) applications
  

    Web server to use

    1.web server
      1-1.Apache    ○
      1-2.IIS
    2.web browser
  

    How to connect PHP to the server

    1.SAPI      ○
    2.ISAPI
    3.CGI、FastCGI    ※If PHP has no module support for your web server
  

  Configuration and Installation of PHP on Unix systems


    Prerequisite knowledge and software for compiling

    ・Basic Unix skills (being able to operate "make" and a C compiler) 
    ・An ANSI C compiler
    ・A web server
    ・Any module specific components (such as GD, PDF libs, etc.) 
  

    When building directly from SVN sources or after custom modifications you might also need

    ・autoconf: 2.13+ (for PHP < 5.4.0), 2.59+ (for PHP >= 5.4.0)
    ・automake: 1.4+
    ・libtool: 1.4.x+ (except 1.4.2)
    ・re2c: Version 0.13.4 or newer
    ・flex: Version 2.5.4 (for PHP <= 5.2)
    ・bison: Version 1.28 (preferred), 1.35, or 1.75
  

  Obtain the PHP source file


  Configure、Build and Install PHP

    gunzip php-NN.tar.gz
    tar -xf php-NN.tar
    cd ../php-NN
    ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
    make 
    make install ※will also install PEAR, various PHP tools such as phpize, install the PHP CLI, and more.
  

  Setup your php.ini

  
  cp php.ini-development /usr/local/lib/php.ini
  

  Edit your httpd.conf

    LoadModule php5_module modules/libphp5.so ※The make install from above may have already added this for you, but be sure to check. 
    <filesmatch .php$="">
      SetHandler application/x-httpd-php
    </filesmatch>
  


  Confirming or testing installation

    /usr/local/apache2/bin/httpd -t
    /usr/local/apache2/bin/apachectl start
    /usr/local/apache2/bin/apachectl stop
  

2011年1月10日星期一

笔记 Linux 网络配置

/etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1              localhost.localdomain localhost
192.168.11.22           Barcelona
::1             localhost6.localdomain6 localhost6

/etc/resolv.conf

search localdomain
nameserver 192.168.11.1

/etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=Barcelona

/etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:f3:01:3d
NETMASK=255.255.255.0
IPADDR=192.168.11.22
GATEWAY=192.168.11.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes


2011年1月9日星期日

Visual Studio 2008 错误

简单开发环境描述:
 ①数据库服务器:SQL Server 2008 Enterprise Edition
 ②集成开发工具:Visual Studio 2008 Professional Edition
 ※②在安装时候自带SQL Server 2005 
 ※①和②分别在网络上的不同主机上</div>

 
错误描述:
    This server version is not supported . only servers up to Microsoft SQL Server 2005 are supported.

 

 
解决方案:
 安装VS90sp1-KB945140-ENU.exe
 ※ 执行上面文件后下面组件将被追加到系统中,可以通过「开始→控制面板→添加和删除程序」确认。
  •     Visual Studio 2008 Service Pack 1 (SP1) 
  •     .NET Framework 3.5 SP1

2011年1月5日星期三

Apache Python Subversion Trac项目管理环境构筑 笔记



事前準備インストール
[root@localhost ~]# yum install gcc // for apache ○
[root@localhost ~]# yum install zlib-devel // for apache ○
[root@localhost ~]# yum install openssl-devel // for apached △
[root@localhost ~]# yum install libtool // for apache ○
[root@localhost ~]# yum update perl // for apache △
[root@localhost ~]# yum install gcc-c++ // for swig ○
[root@localhost ~]# yum install expat-devel // for subversion ○
[root@localhost ~]# yum install sqlite-devel // for python ○

Apacheインストール
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.2.16.tar.gz
[root@localhost src]# tar -vxzf httpd-2.2.16.tar.gz
[root@localhost src]# cd httpd-2.2.16
[root@localhost httpd-2.2.16]# ./configure --prefix=/usr/local/apache2 --enable-dav --enable-so --enable-ssl --with-perl --enable-mods-shared=all
[root@localhost httpd-2.2.16]# make
[root@localhost httpd-2.2.16]# make install

// Installed python version can be checked with the following commands

Pythonインストール
[root@localhost httpd-2.2.16]# cd /usr/local/src
[root@localhost src]# wget http://www.python.org/ftp/python/2.6/Python-2.6.tgz
[root@localhost src]# tar -zxvf Python-2.6.tgz
[root@localhost src]# cd Python-2.6
[root@localhost Python-2.6]# ./configure --prefix=/usr/local/python2.6
[root@localhost Python-2.6]# make
[root@localhost Python-2.6]# make install

// Installed python version can be checked with the following commands
[root@localhost Python-2.6]# /usr/local/python2.6/bin/python

Setuptoolsインストール
[root@localhost Python-2.6]# cd /usr/local/src
[root@localhost src]# wget http://peak.telecommunity.com/dist/ez_setup.py
[root@localhost src]# /usr/local/python2.6/bin/python ez_setup.py
----------------------------------------------------------------------
Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /usr/local/python2.6/lib/python2.6/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/python2.6/bin
Installing easy_install-2.6 script to /usr/local/python2.6/bin
Installed /usr/local/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
----------------------------------------------------------------------
[root@localhost src]# rm ez_setup.py

// Installed setuptools version can be checked with the following commands
[root@chealsea src]# /usr/local/python2.6/bin/python
Python 2.6 (r26:66714, Oct 10 2010, 23:56:21)
>>> import setuptools
>>> setuptools.__version__
'0.6c11'

Genshiインストール
[root@localhost src]# /usr/local/python2.6/bin/easy_install Genshi
----------------------------------------------------------------------
Searching for Genshi
Reading http://pypi.python.org/simple/Genshi/
Reading http://genshi.edgewall.org/
Reading http://genshi.edgewall.org/wiki/Download
Best match: Genshi 0.6
Downloading http://ftp.edgewall.com/pub/genshi/Genshi-0.6-py2.6.egg
Processing Genshi-0.6-py2.6.egg
Moving Genshi-0.6-py2.6.egg to /usr/local/python2.6/lib/python2.6/site-packages
Adding Genshi 0.6 to easy-install.pth file

Installed /usr/local/python2.6/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg
Processing dependencies for Genshi
Finished processing dependencies for Genshi
----------------------------------------------------------------------

swigインストール
[root@localhost src]# wget http://downloads.sourceforge.net/swig/swig-1.3.31.tar.gz
[root@localhost src]# tar -vxzf swig-1.3.31.tar.gz
[root@localhost src]# cd swig-1.3.31
[root@localhost swig-1.3.31]# ./configure --prefix=/usr/local/swig1.3 --with-python=/usr/local/python2.6/bin/
[root@localhost swig-1.3.31]# make
[root@localhost swig-1.3.31]# make install
[root@localhost swig-1.3.31]# /usr/local/swig1.3/bin/swig -version

Subversionインストール
[root@localhost swig-1.3.31]# cd /usr/local/src/
[root@localhost src]# wget http://subversion.tigris.org/downloads/subversion-1.6.12.tar.gz
[root@localhost src]# wget http://subversion.tigris.org/downloads/subversion-deps-1.6.12.tar.gz
[root@localhost src]# tar -zxvf subversion-1.6.12.tar.gz
[root@localhost src]# tar -zxvf subversion-deps-1.6.12.tar.gz
[root@localhost src]# cd subversion-1.6.12
[root@localhost subversion-1.6.12]# ./configure --prefix=/usr/local/subversion1.6 --with-apr=/usr/local/apache2/ --with-apr-util=/usr/local/apache2/ --with-ssl --with-apxs=/usr/local/apache2/bin/apxs PYTHON=/usr/local/python2.6/bin/python --with-swig=/usr/local/swig1.3/bin/swig
[root@localhost subversion-1.6.12]# make
[root@localhost subversion-1.6.12]# make install

Install Specific Language Bindings
[root@localhost subversion-1.6.12]# make swig-py
----------------------------------------------------------------------
mkdir /usr/local/src/subversion-1.6.12/subversion/bindings/swig/python/libsvn
----------------------------------------------------------------------
[root@localhost subversion-1.6.12]# make check-swig-py
[root@localhost subversion-1.6.12]# make install-swig-py

// リポジトリ作成
[root@localhost subversion-1.6.12]# mkdir -p /usr/local/svn
[root@localhost subversion-1.6.12]# /usr/local/subversion1.6/bin/svnadmin create --fs-type fsfs /usr/local/svn/test
[root@localhost subversion-1.6.12]# chown -R daemon:daemon /usr/local/svn

// リポジトリ認証用アカウント
[root@localhost subversion-1.6.12]# /usr/local/apache2/bin/htpasswd -c /usr/local/svn/.htpasswd weihu

httpd.conf設定
[root@localhost subversion-1.6.12]# vi /usr/local/apache2/conf/httpd.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Include conf/extra/httpd-svn.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// httpd-svn.conf設定
[root@localhost subversion-1.6.12]# vi /usr/local/apache2/conf/extra/httpd-svn.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<Location /svn>
DAV svn
SVNParentPath /usr/local/svn
AuthType Basic
AuthName "svn"
AuthUserFile /usr/local/svn/.htpasswd
Require valid-user
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// http.confファイルの正確性を確認
[root@localhost subversion-1.6.12]# /usr/local/apache2/bin/apachectl -t

// PATHを通す
[root@localhost subversion-1.6.12]# vi ~/.bash_profile
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SVN_HOME=/usr/local/subversion1.6
PYTHON_HOME=/usr/local/python2.6
PATH=$PYTHON_HOME/bin:$SVN_HOME/bin/:$PATH:$HOME/bin
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@localhost local]# source ~/.bash_profile
[root@localhost local]# env

// Pythonバージョン確認
[root@localhost subversion-1.6.12]# python -V

mod_pytonインストール
[root@localhost svn]# cd /usr/local/src/
[root@localhost src]# wget http://ftp.kddilabs.jp/infosystems/apache//httpd/modpython/mod_python-3.3.1.tgz
[root@localhost src]# tar -vxzf mod_python-3.3.1.tgz
[root@localhost src]# cd mod_python-3.3.1
[root@localhost mod_python-3.3.1]# ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/local/python2.6/bin/python --prefix=/usr/local/mod_python3.3
[root@localhost mod_python-3.3.1]# make
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// エラー発生(参考 http://issues.apache.org/jira/browse/MODPYTHON-249)
connobject.c: In function ‘_conn_read’:
connobject.c:142: error: request for member ‘next’ in something not a structure or union
apxs:Error: Command failed with rc=65536
.
make[1]: *** [mod_python.so] エラー 1
make[1]: ディレクトリ `/usr/local/src/mod_python-3.3.1/src' から出ます
make: *** [do_dso] エラー 2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[root@localhost mod_python-3.3.1]# vi /usr/local/src/mod_python-3.3.1/src/connobject.c +142
[root@localhost mod_python-3.3.1]# make
[root@localhost mod_python-3.3.1]# make install
----------------------------------------------------------------------
writing byte-compilation script '/tmp/tmpivgyHe.py'
/usr/local/python2.6/bin/python2.6 -OO /tmp/tmpivgyHe.py
removing /tmp/tmpivgyHe.py
running install_egg_info
Writing /usr/local/python2.6/lib/python2.6/site-packages/mod_python-3.3.1-py2.6.egg-info
----------------------------------------------------------------------

// apache設定
[root@localhost mod_python-3.3.1]# vi /usr/local/apache2/conf/httpd.conf
// 下記のコードを追加
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
LoadModule python_module modules/mod_python.so
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@localhost mod_python-3.3.1]# chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so

// http.confファイルの正確性を確認
[root@localhost mod_python-3.3.1]# /usr/local/apache2/bin/apachectl -t

tracインストール
[root@localhost mod_python-3.3.1]# /usr/local/python2.6/bin/easy_install http://svn.edgewall.org/repos/trac/tags/trac-0.11
----------------------------------------------------------------------
Downloading http://svn.edgewall.org/repos/trac/tags/trac-0.11
Doing subversion checkout from http://svn.edgewall.org/repos/trac/tags/trac-0.11 to /tmp/easy_install-1dRcRN/trac-0.11
Processing trac-0.11
Running setup.py -q bdist_egg --dist-dir /tmp/easy_install-1dRcRN/trac-0.11/egg-dist-tmp-TgP2FP
Adding Trac 0.11 to easy-install.pth file
Installing trac-admin script to /usr/local/python2.6/bin
Installing tracd script to /usr/local/python2.6/bin

Installed /usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg
Processing dependencies for Trac==0.11
Finished processing dependencies for Trac==0.11
----------------------------------------------------------------------

// tracリポジトリの作成
[root@localhost mod_python-3.3.1]# mkdir -p /usr/local/trac
[root@localhost mod_python-3.3.1]# trac-admin /usr/local/trac/test initenv
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Creating and Initializing Project
Failed to create environment. global name 'sqlite' is not defined
Traceback (most recent call last):
File "/usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg/trac/admin/console.py", line 543, in do_initenv
options=options)
File "/usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg/trac/env.py", line 188, in __init__
self.create(options)
File "/usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg/trac/env.py", line 311, in create
DatabaseManager(self).init_db()
File "/usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg/trac/db/api.py", line 70, in init_db
connector.init_db(**args)
File "/usr/local/python2.6/lib/python2.6/site-packages/Trac-0.11-py2.6.egg/trac/db/sqlite_backend.py", line 136, in init_db
cnx = sqlite.connect(path, timeout=int(params.get('timeout', 10000)))
NameError: global name 'sqlite' is not defined
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[root@localhost mod_python-3.3.1]# chown -R daemon:daemon /usr/local/trac/test
[root@localhost mod_python-3.3.1]# mkdir -p /usr/local/trac_cache/.egg-cache
[root@localhost mod_python-3.3.1]# chown -R daemon:daemon /usr/local/trac_cache/.egg-cache

// Tracdを起動し、IEで確認
[root@localhost mod_python-3.3.1]# tracd --port 8000 /usr/local/trac/test
website:
http://trac.edgewall.org/

// httpd.conf設定
[root@localhost mod_python-3.3.1]# vi /usr/local/apache2/conf/httpd.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Include conf/extra/httpd-trac.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// httpd-trac.conf設定
[root@localhost subversion-1.6.12]# vi /usr/local/apache2/conf/extra/httpd-trac.conf
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /usr/local/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /usr/local/trac_cache/.egg-cache

AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /usr/local/svn/.htpasswd
Require valid-user

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// http.confファイルの正確性を確認
[root@localhost mod_python-3.3.1]# /usr/local/apache2/bin/apachectl -t
// Httpdを再起動
[root@chealsea mod_python-3.3.1]# /usr/local/apache2/bin/apachectl restart