** [[Trac]]のインストール [#z4be5c07]

#setlinebreak(on);

とりあえず、依存モジュールが多い!
全てのモジュールをインストールするのにかなり時間がかかった。

◆参照URL
#html(<table><tr><td width="20"></td><td style="border:1px solid #000000">)
http&#58;//weekbuild.sakura.ne.jp/trac/wiki/TracDoc/SakuraInternet
http&#58;//www.i-act.co.jp/project/products/products.html
http&#58;//takanory.net/server/trac/
http&#58;//tach.arege.net/trac/wiki/TracInstall
http&#58;//d.hatena.ne.jp/akiyan/20060822/p1
http&#58;//trac.edgewall.org/wiki/TracOnRedhat9HomeDir
http&#58;//trac.edgewall.org/wiki/TracDownload
http&#58;//journal.mycom.co.jp/special/2006/trac/002.html
#html(</td></tr></table>)

(1) ファイルの取得

 [Trac(日本語版)]
  http&#58;//www.i-act.co.jp/project/products/products.html より trac-0.10.4-ja-1.zip をダウンロード
  ※下記の依存モジュールについては、zipを展開してできた INSTALL ファイルに従ったバージョンをインストールする。

 [Python および 日本語Codec]
  http&#58;//www.python.jp/Zope/download から Python-2.3.tgz、JapaneseCodecs-1.4.10.tar.gz を取得

 [Tcl]
  http&#58;//www.tcl.tk/software/tcltk/downloadnow83.html より tcl8.3.5-src.tar.gz を取得

 [Swig]
  http&#58;//prdownloads.sourceforge.net/swig/swig-1.3.21.tar.gz?download より swig-1.3.21.tar.gz を取得

 [Sqlite]
  http&#58;//www.sqlite.org/download.html より sqlite-3.5.4.tar.gz を取得

 [SilverCity]
  http&#58;//sourceforge.net/projects/silvercity/ より SilverCity-0.9.5.tar.gz を取得
  http&#58;//sourceforge.net/project/showfiles.php?group_id=45693

 [Clearsilver]
  http&#58;//www.clearsilver.net/downloads/ より clearsilver-0.9.3.tar.gz を取得

 [Pysqlite]
  http&#58;//initd.org/pub/software/pysqlite/releases/ より pysqlite-2.3.5.tar.gz を取得 

(2) インストール

 ◆Apacheのリコンパイル
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
cd httpd-2.0.52
make distclean
./configure --enable-module="so ssl dav" --enable-dav --enable-rewrite=shared --enable-ssl --with-ssl=/usr/local/ssl
make
make install
#html(</td></tr></table>)

 ◆Pythonのインストール
   [[こちらを参照>Pythonのインストール]]

 ◆Tclのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv tcl8.3.5-src.tar.gz
cd tcl8.3.5/unix
./configure
make
make install
/sbin/ldconfig
#html(</td></tr></table>)

 ◆Swigのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar xzf swig-1.3.21.tar.gz
cd SWIG-1.3.21
./configure
make
make install
make -k runtime
make install-runtime
/sbin/ldconfig
#html(</td></tr></table>)

 ◆Subversionのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar xzf subversion-1.4.4.tar.gz
cd subversion-1.4.4
./configure --prefix=/usr/local \
&#45;-disable-mod-activation \
&#45;-enable-swig-bindings=python \
&#45;-with-apr=/usr/local/apache2/bin/apr-config \
&#45;-with-apr-util=/usr/local/apache2/bin/apu-config  \
&#45;-with-apxs=/usr/local/apache2/bin/apxs \
&#45;-without-berkeley-db \
&#45;-with-zlib \
&#45;-with-swig=/usr/local

configure: error: invalid apr version found

と怒られるので

http&#58;//subversion.tigris.org/servlets/ProjectDocumentList?folderID=7495&expandFolder=7495&folderID=260 から
依存モジュール( subversion-deps-1.4.4.tar.gz ) をダウンロード、展開して再度 configure 

./configure --prefix=/usr/local \
&#45;-disable-mod-activation \
&#45;-enable-swig-bindings=python \
&#45;-with-apr=./apr/apr-config \
&#45;-with-apr-util=./apr-util/apu-config  \
&#45;-with-apxs=/usr/local/apache2/bin/apxs \
&#45;-without-berkeley-db \
&#45;-with-zlib \
&#45;-with-swig=/usr/local
make
make install

# mod_dav_svn と mod_authz_svn がないと怒られるので、
# ソースディレクトリからコピーして再度 make install
cp ./subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/apache2/modules
cp ./subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/apache2/modules/
make install

make swig-py
make install-swig-py
/sbin/ldconfig
#html(</td></tr></table>)

 ◆SQLiteのインストール
  (OSがTCLに対応しておらずエラーになったのでTCLの機能を無効にする)
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv sqlite-3.5.4.tar.gz
cd sqlite-3.5.4
.configure --disable-tcl
make
make install
/sbin/ldconfig
#html(</td></tr></table>)

 ◆SilverCityのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv SilverCity-0.9.5.tar.gz
cd SilverCity-0.9.5
python setup.py build
python setup.py install
/sbin/ldconfig
#html(</td></tr></table>)


 ◆Clearsilverのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv clearsilver-0.9.3.tar.gz
cd clearsilver-0.9.3
./configure --with-python=/usr/local/bin/python --with-apache=/usr/local/apache2
make

# makeでコケルので java ruby 等を無効にして再度 configure 
make distclean
./configure --with-python=/usr/local/bin/python --with-apache=/usr/local/apache2 --disable-ruby --disable-java --disable-perl
make
make install
/sbin/ldconfig
#html(</td></tr></table>)


 ◆Pysqliteのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv pysqlite-2.3.5.tar.gz
cd pysqlite-2.3.5
python setup.py build
python setup.py install
/sbin/ldconfig
#html(</td></tr></table>)

 ◆Tracのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
unzip trac-0.10.4-ja-1.zip
cd trac-0.10.4-ja-1
python setup.py build
python setup.py install
/sbin/ldconfig
#html(</td></tr></table>)

 ◆Trac日本語Codecのインストール
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv JapaneseCodecs-1.4.10.tar.gz
cd JapaneseCodecs-1.4.10
python ./setup.py install
#html(</td></tr></table>)


 ◆残りの設定作業
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
cd /usr/local/lib/python2.3/site-packages
ln -s /usr/local/lib/svn-python svn-python
ln -s /usr/local/lib/svn-python/svn svn
ln -s /usr/local/lib/svn-python/libsvn libsvn
#html(</td></tr></table>)


(3) プロジェクトの作成

 ◆SVNリポジトリの作成
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
svnadmin create --fs-type=fsfs /path/to/svn_rep
#html(</td></tr></table>)

 ◆Tracプロジェクトの作成
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
trac-admin /path/to/myproject initenv

Creating a new Trac environment at /path/to/myproject

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]>

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]>

 Please specify the type of version control system,
 By default, it will be svn.

 If you don't want to use Trac with version control integration,
 choose the default here and don't specify a repository directory.
 in the next question.

Repository type [svn]>

 Please specify the absolute path to the version control
 repository, or leave it blank to use Trac without a repository.
 You can also set the repository location later.

Path to repository [/path/to/repos]> /path/to/svn_repos

 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.

Templates directory [/usr/local/share/trac/templates]>

Creating and Initializing Project
 Installing default wiki pages
 /usr/local/share/trac/wiki-default/CamelCase => CamelCase
 /usr/local/share/trac/wiki-default/InterMapTxt => InterMapTxt
 /usr/local/share/trac/wiki-default/InterTrac => InterTrac
 /usr/local/share/trac/wiki-default/InterWiki => InterWiki
 /usr/local/share/trac/wiki-default/RecentChanges => RecentChanges
 /usr/local/share/trac/wiki-default/SandBox => SandBox
 /usr/local/share/trac/wiki-default/TitleIndex => TitleIndex
 /usr/local/share/trac/wiki-default/TracAccessibility => TracAccessibility
 /usr/local/share/trac/wiki-default/TracAdmin => TracAdmin
 /usr/local/share/trac/wiki-default/TracBackup => TracBackup
 /usr/local/share/trac/wiki-default/TracBrowser => TracBrowser
 /usr/local/share/trac/wiki-default/TracCgi => TracCgi
 /usr/local/share/trac/wiki-default/TracChangeset => TracChangeset
 /usr/local/share/trac/wiki-default/TracEnvironment => TracEnvironment
 /usr/local/share/trac/wiki-default/TracFastCgi => TracFastCgi
 /usr/local/share/trac/wiki-default/TracGuide => TracGuide
 /usr/local/share/trac/wiki-default/TracImport => TracImport
 /usr/local/share/trac/wiki-default/TracIni => TracIni
 /usr/local/share/trac/wiki-default/TracInstall => TracInstall
 /usr/local/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization
 /usr/local/share/trac/wiki-default/TracJa => TracJa
 /usr/local/share/trac/wiki-default/TracLinks => TracLinks
 /usr/local/share/trac/wiki-default/TracLogging => TracLogging
 /usr/local/share/trac/wiki-default/TracModPython => TracModPython
 /usr/local/share/trac/wiki-default/TracNotification => TracNotification
 /usr/local/share/trac/wiki-default/TracPermissions => TracPermissions
 /usr/local/share/trac/wiki-default/TracPlugins => TracPlugins
 /usr/local/share/trac/wiki-default/TracQuery => TracQuery
 /usr/local/share/trac/wiki-default/TracReports => TracReports
 /usr/local/share/trac/wiki-default/TracRevisionLog => TracRevisionLog
 /usr/local/share/trac/wiki-default/TracRoadmap => TracRoadmap
 /usr/local/share/trac/wiki-default/TracRss => TracRss
 /usr/local/share/trac/wiki-default/TracSearch => TracSearch
 /usr/local/share/trac/wiki-default/TracStandalone => TracStandalone
 /usr/local/share/trac/wiki-default/TracSupport => TracSupport
 /usr/local/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring
 /usr/local/share/trac/wiki-default/TracTermsJa => TracTermsJa
 /usr/local/share/trac/wiki-default/TracTickets => TracTickets
 /usr/local/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields
 /usr/local/share/trac/wiki-default/TracTimeline => TracTimeline
 /usr/local/share/trac/wiki-default/TracUnicode => TracUnicode
 /usr/local/share/trac/wiki-default/TracUpgrade => TracUpgrade
 /usr/local/share/trac/wiki-default/TracWiki => TracWiki
 /usr/local/share/trac/wiki-default/WikiDeletePage => WikiDeletePage
 /usr/local/share/trac/wiki-default/WikiFormatting => WikiFormatting
 /usr/local/share/trac/wiki-default/WikiHtml => WikiHtml
 /usr/local/share/trac/wiki-default/WikiMacros => WikiMacros
 /usr/local/share/trac/wiki-default/WikiNewPage => WikiNewPage
 /usr/local/share/trac/wiki-default/WikiPageNames => WikiPageNames
 /usr/local/share/trac/wiki-default/WikiProcessors => WikiProcessors
 /usr/local/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText
 /usr/local/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks
 /usr/local/share/trac/wiki-default/WikiStart => WikiStart
 Indexing repository
 [58]
---------------------------------------------------------------------
Project environment for 'My Project' created.

You may now configure the environment by editing the file:

  /path/to/myproject/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 /path/to/myproject

Then point your browser to http&#58;//localhost:8000/myproject.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

  http://trac.edgewall.org/

Congratulations!

#html(</td></tr></table>)


(4) サーバの起動と停止(スタンドアロン)
 [起動]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tracd --daemonize --port 8000 /path/to/myproject
#html(</td></tr></table>)

 [停止]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
killall tracd
#html(</td></tr></table>)

 [起動・停止スクリプト]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
&#35;!/bin/sh
&#35; description: Start/stop tracd
&#35; chkconfig: 345 91 09
&#35;
&#35;##########################################################
DAEMON=/usr/local/bin/tracd
PORT=8000
OPTION="--daemonize --port $PORT"
PROJECT="/path/to/myproject"
&#35;##########################################################

ARGV="$@"

case $ARGV in
start)
&nbsp;   $DAEMON $OPTION $PROJECT
&nbsp;   ERROR=$?
&nbsp;   ;;
stop)
&nbsp;   killall tracd
&nbsp;   ERROR=$?
&nbsp;   ;;
restart)
&nbsp;   killall tracd
&nbsp;   $DAEMON $OPTION $PROJECT
&nbsp;   ERROR=$?
&nbsp;   ;;
&#42;)
&nbsp;   echo "Error! ( Argment : $ARGV )"
&nbsp;   ERROR=1
esac

exit $ERROR
#html(</td></tr></table>)

(5) Apahceで動かす場合

 [mod_pythonの取得]

  http&#58;//httpd.apache.org/modules/python-download.cgi から mod_python-3.3.1.tgz をダウンロード

 [mod_pythonのインストール]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
tar zxfv mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/local/bin/python
make
make install
#html(</td></tr></table>)

 [httpd.confに設定追加]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
LoadModule python_module modules/mod_python.so
LoadModule dav_svn_module     modules/mod_dav_svn.so



&#35; SVNリポジトリ用の設定
&lt;Location /svn/myproject&gt;
&nbsp;  DAV svn
&nbsp;  SVNPath /path/to/svn_repos

&nbsp;  #Basic認証の設定
&nbsp;  AuthType Basic
&nbsp;  AuthName "Subversion repository"
&nbsp;  AuthUserFile /path/to/myproject/.htpasswd
&nbsp;  Require valid-user
&lt;/Location&gt;

&#35; Tracプロジェクト用の設定
&lt;Location /projects/myproject&gt;
&nbsp;  SetHandler mod_python
&nbsp;  PythonHandler trac.web.modpython_frontend
&nbsp;  PythonOption TracEnv /path/to/myproject
&nbsp;  PythonOption TracUriRoot /projects/myproject
&lt;/Location&gt;

&#35; Tracプロジェクトへのログイン時のパスワードファイルの指定
&lt;Location "/projects/myproject/login"&gt;
&nbsp;  AuthType Basic
&nbsp;  AuthName "myproject"
&nbsp; AuthUserFile /path/to/myproject/.htpasswd
&nbsp; Require valid-user
&lt;/Location&gt;
#html(</td></tr></table>)

 [Tracユーザの作成(SVNユーザと兼用)]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
htpasswd -c /path/to/myproject/.htpasswd ユーザ名
#html(</td></tr></table>)

 [Apacheの再起動]
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
/etc/init.d/httpd restart
#html(</td></tr></table>)

 [ブラウザから httpd://xxx.xxx.xxx.xxx/projects/myproject にアクセス]
 The user xxxxx requires read _and_ write permission to the database file /path/to/myproject/db/trac.db and the directory it is located in.
 アクセス権がないと怒られるので、Tracプロジェクトの所有者をApacheの実行ユーザに変更
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
chown -R httpd:httpd /home/system/trac_project
#html(</td></tr></table>)

 [再度ブラウザからアクセス]
 SubversionException: ("Can't open file '/path/to/svn_rep/format': Permission denied", 13)

 今度はSVNのアクセス権がないと怒られるので、SVNリポジトリのアクセス権を変更
 (たぶん format というファイルを apahceの実行ユーザが読めればいいだけなので、下記はやりすぎかもしれない。)
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)
chmod 777 /path/to/svn_rep
#html(</td></tr></table>)

(99) メモ
#html(<table><tr><td width="20"></td><td style="background:#000000;color:white;">)

&#35;ユーザの作成
htpasswd -c /path/to/.htpasswd ユーザ名

&#35;設定されている権限の確認 
trac-admin /path/to/myproject permission list

&#35;anonymousユーザからすべての権限を剥奪 
trac-admin /path/to/myproject permission remove anonymous *

#作成したユーザに権限を与える 
trac-admin /path/to/myproject permission add ユーザ名 TRAC_ADMIN

#html(</td></tr></table>)

// tracd --daemonize --port 8000 --basic-auth /home/system/trac_project/myproject/,/home/system/trac_project/myproject/.htpasswd,mycompany.com /home/system/trac_project/myproject


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS