Subversion + Trac インストール
会社で使っているSubversionがとても便利なのと、いちいち変更したファイルを同期するのが面倒なので、導入することに。
Subversionのインストール
$ yum -y install mod_dav_svn
レポジトリを'/var/www/svn'としました。
プロジェクト名は'test'です。
$ mkdir -p /var/www/svn $ svnadmin create /var/www/svn/test
トランク、タグ、ブランチ用のディレクトリを作成。
$ svn mkdir file:///var/www/svn/test/trunk file:///var/www/svn/test/tags file:///var/www/svn/test/branches -m "init repository layout (trunk,tags,branches)"
apacheからファイルの書き込みができるようにパーミッションを変更。
$ chown -R apache.apache /var/www/svn/test
Basic認証の設定ファイルを作成
$ htpasswd -c /var/www/.htpasswd ユーザ名
apacheの設定変更。/etc/httpd/conf.d 以下に subversion.conf が出来ているので、編集する。
$ vim /etc/httpd/conf.d/subversion.conf <Location /svn> DAV svn SVNParentPath /var/www/svn # Limit write permission to list of valid users. <LimitExcept GET PROPFIND OPTIONS REPORT> # Require SSL connection for password protection. # SSLRequireSSL AuthType Basic AuthName "Authorization Realm" AuthUserFile /var/www/.htpasswd Require valid-user </LimitExcept> </Location>
Tracのインストール
yumで簡単に入れたいところだが、CentOSの標準レポジトリにTracは含まれていないので、依存ライブラリをDAGからインストールするために、サードパーティーのレポジトリであるDAGレポジトリ(rpmforge)というものをインストールする。$ wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm $ rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
DAGレポジトリは標準でOFFなので、ONにする。DAGレポジトリの設定ファイルを編集する。enabled = 0 にする。
$ vim /etc/yum.repos.d/rpmforge.repo ・・・ enabled = 0 ・・・
そしてTracが依存しているライブラリをDAGからインストール
yum --enablerepo=rpmforge install -y python-clearsilver
ついでにmod_pythonも必要なので入れる。
yum install -y mod_python
日本語版をダウンロードして、解凍してインストール。
$ wget http://www.i-act.co.jp/project/products/downloads/Trac-0.11.6.ja1.zip $ unzip Trac-0.11.6.ja1.zip $ cd Trac-0.11.6.ja1 $ python setup.py install
このように出力された↓ん??
Traceback (most recent call last): File "setup.py", line 15, in ? from setuptools import setup, find_packages ImportError: No module named setuptools
どうやら、pythonのパッケージをもっていないらしいのでyumする
$ yum install -y python-setuptools
でもう一度、インストール
$ python setup.py install
成功した。
$ mkdir /var/www/trac
Tracプロジェクトの作成。こちらもsubversionのプロジェクト名と同じ'test'とする。
$ trac-admin /var/www/trac/test initenv
またもエラーらしき出力をされた。↓
Traceback (most recent call last): File "/usr/bin/trac-admin", line 5, in ? from pkg_resources import load_entry_point File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2479, in ? working_set.require(__requires__) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 585, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: Genshi>=0.5
Googleさんに聞いて、解決。またpythonの何かが足りないらしいので、yum。
$ yum install -y python-genshi
そして、再度、Tracプロジェクトの作成。
$ trac-admin /var/www/trac/test initenv
大丈夫みたい。いろいろ聞かれる↓以下のように答えた。2,3質問はそのままEnter!した。
Project Name [My Project]> test Database connection string [sqlite:db/trac.db]> Repository type [svn]> Path to repository [/path/to/repos]> /var/www/svn/test
で、完了したので。Apacheで動作するように設定。
$ chown -R apache:apache test
/etc/httpd/conf.d/trac.confファイルを以下のように作成
$ vim /etc/httpd/conf.d/trac.conf <Location /trac> SetHandler mod_python PythonDebug On PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /var/www/trac PythonOption TracUriRoot /trac </Location> <LocationMatch "/trac/.*/login"> AuthType Basic AuthName "trac" AuthUserFile "/var/www/.htpasswd" Require valid-user </LocationMatch>
で再読み込みして、設定を反映させる。
$ /etc/rc.d/init.d/httpd reload
で http://サーバのアドレス/trac/testにアクセスして確認。
Tracのheaderの設定
デフォルトだと画面の左上の画像が指定されていないので、/var/www/trac/test/conf/trac.iniを指定した。事前にtracの画像を/var/www/icons/trac/trac_logo.pngに保存しておいた。$ vim /var/www/trac/test/conf/trac.ini ・・・・・ [header_logo] alt = trac_logo height = 61 link = ../ src = /icons/trac/trac_logo.png width = 214 ・・・・・
これで終了。↓
参考
ゼミサーバにもPEAR:Pagerをインストールする
PEAR:Pagerを使いたかったので導入することに。
まず以下のサイトでダウンロードして最新の安定バージョンPager-2.4.8.tgzを入手。
http://pear.php.net/package/Pager/download/
その後、解凍して、pearのディレクトリに移すだけの処理。
$ tar xvfz Pager-2.4.8.tgz $ mv Pager-2.4.8 /usr/share/pear/PEAR/Pager
終了。これだけw
ゼミサーバにもSmartyを導入しておく
pearに続いてSmartyも導入しておくことに。
まず、公式サイトからLatest Stable ReleaseのバージョンのSmarty-2.6.26.tar.gzを入手。
http://www.smarty.net/download.php
で解凍して、/usr/local/include/php/Smartyに場所を移動。
$ tar xvfz Smarty-2.6.26.tar.gz $ mv Smarty-2.6.26 /usr/local/include/php/Smarty
そのあと、include_pathに追加するために、/etc/php.iniに以下を追記。
include_path=".:/usr/local/include/php"
※ついでにちょっと/etc/php.iniを編集
default_charset = "UTF-8" mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.http_output = pass mbstring.encoding_translation = Off mbstring.detect_order = SJIS,EUC-JP,JIS,UTF-8,ASCII mbstring.substitute_character = "none"
でリロードして
$ /etc/rc.d/init.d/httpd reload
phpinfo();で確認して、変更されていればOK。
参考
ゼミのサーバにもPEARを導入した。その時のメモ
pearをいれるために、php-develを入れる必要があるらしいので。
php-devel-5.3.0-2.el5.remi.2.i386.rpmをダウロードして。
$ rpm -Uvh php-devel-5.3.0-2.el5.remi.2.i386.rpm
実行したら、依存性のエラーが出た・・・。autoconfとautomakeが必要らしいので。rpmを入手して、
$ rpm -Uvh rpm -Uvh autoconf-2.61-8.fc7.noarch.rpm
したら、また依存性のエラー。今度はimakeが必要らしい。なので、rpmを入手して、
$ rpm -Uvh imake-1.0.2-3.i386.rpm
をした。で、
$ rpm -Uvh automake-1.9.6-2.1.noarch.rpm $ rpm -Uvh autoconf-2.61-8.fc7.noarch.rpm $ rpm -Uvh php-devel-5.3.0-2.el5.remi.2.i386.rpm
で無事に入った。
でphp-develが入ったので、PEARを入れるために
■手順1 go-pear.php を用意
http://pear.php.net/go-pear
でソースをコピーしてgo-pear.phpとして保存。
■手順2 実行
$ php go-pear.php
そしてインストールするディレクトリを決めて、(ここでは/usr/share/pearとした)流れに沿って、/etc/php.iniにへのinclude_pathの追加を許可して、pearの導入終了。
しかし、このままじゃ、フルパスで実行しないといけないので、パスを通すために~/.bashrcに以下を追記。
export PATH="$PATH:/usr/share/pear/bin"
で.bashrcを再読み込みして、pearコマンドを実行してみると...
$ pear Commands: build Build an Extension From C Source bundle Unpacks a Pecl Package channel-add Add a Channel channel-alias Specify an alias to a channel name channel-delete Remove a Channel From the List channel-discover Initialize a Channel from its server channel-info Retrieve Information on a Channel channel-login Connects and authenticates to remote channel server channel-logout Logs out from the remote channel server channel-update Update an Existing Channel clear-cache Clear Web Services Cache config-create Create a Default configuration file config-get Show One Setting config-help Show Information About Setting config-set Change Setting config-show Show All Settings convert Convert a package.xml 1.0 to package.xml 2.0 format cvsdiff Run a "cvs diff" for all files in a package cvstag Set CVS Release Tag download Download Package download-all Downloads each available package from the default channel info Display information about a package install Install Package list List Installed Packages In The Default Channel list-all List All Packages list-categories List All Categories list-category List All Packages of a Category list-channels List Available Channels list-files List Files In Installed Package list-packages List All Packages of a Channel list-upgrades List Available Upgrades login Connects and authenticates to remote server [Deprecated in favor of channel-login] logout Logs out from the remote server [Deprecated in favor of channel-logout] makerpm Builds an RPM spec file from a PEAR package package Build Package package-dependencies Show package dependencies package-validate Validate Package Consistency pickle Build PECL Package remote-info Information About Remote Packages remote-list List Remote Packages run-scripts Run Post-Install Scripts bundled with a package run-tests Run Regression Tests search Search remote package database shell-test Shell Script Test sign Sign a package distribution file svntag Set SVN Release Tag uninstall Un-install Package update-channels Update the Channel List upgrade Upgrade Package upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters] Usage: pear [options] command [command-options] <parameters> Type "pear help options" to list all options. Type "pear help shortcuts" to list all command shortcuts. Type "pear help <command>" to get the help for the specified command.
動いた・・・。どうにかインストール終了。
今回、phpのバージョンとインストールするrpmのphp-develのバージョンを一緒にしないとインストールできないことを再認識した。覚えておこう。
※気になった点
pearのインストール時に以下のような警告がたくさん出たが、
Deprecated: Function set_magic_quotes_runtime() is deprecated in /usr/share/pear/temp/PEAR/Registry.php on line ○○○
set_majic_quotes_runtime()などの非推奨の関数を使っているらしいので警告が出ているらしい。なんか警告が出るのは気持ち悪いが、解決法がわからなかったので、とりあえず動くので、現状維持。
NTPサーバ構築
現在時刻を確認したら、かなり間違っていたので、これでは作るアプリケーションに影響が出ると思い、どうしたらちゃんとした時刻になるか調べたら、NTPサーバというのを作ればいいらしいのでやってみた。その時のメモ。
とりあえずyumでインストール
$ yum -y install ntp
/etc/ntpd.confで設定ファイルを編集する
$ vim /etc/ntp.conf
以下を追記
#追加1 内部からの時刻同期を許可 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap #追記2 時刻同期先NTPサーバーを変更 server -4 ntp.nict.jp # 日本標準時を提供しているNTPサーバー(stratum 1) server -4 ntp.jst.mfeed.ad.jp # 上記サーバーと直接同期しているNTPサーバー(stratum 2) server -4 orion.asahi-net.or.jp # ASAHI-net(※)
※自分が契約しているプロバイダがNTPサーバーを提供している場合はプロバイダのNTPサーバーを指定するするといいらしい。(以下のサイトを参考に) ISP別公開NTPサーバー一覧
その後、大幅に時間がずれていると、ntpdが起動できないらしいので、ntpdateコマンドで手動設定した後に、ntpdを起動させて、自動起動設定をONにする。
$ ntpdate ntp.nict.jp $ /etc/rc.d/init.d/ntpd start $ chkconfig ntpd on
NTPサーバー名の前が空白の場合は時刻同期中の状態を知るために、
$ ntpd -p remote refid st t when poll reach delay offset jitter ============================================================================== ns2.ktroad.net 210.173.160.27 3 u 1 64 1 20.289 12.048 0.001 felixx.tsn.or.j 133.243.238.163 2 u 1 64 1 12.545 14.172 0.001 www.4koma.com 133.243.238.243 2 u - 64 1 149.740 83.985 0.001 210.171.226.40 .NICT. 1 u - 64 1 8.881 13.125 0.001 ntp1.jst.mfeed. .INIT. 16 u - 64 0 0.000 0.000 0.001 orion.asahi-net .INIT. 16 u - 64 0 0.000 0.000 0.001 LOCAL(0) .LOCL. 10 l - 64 0 0.000 0.000 0.001
約10分後に同期できているかどうかを確認。
$ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== -ns2.ktroad.net 210.173.160.87 3 u 83 256 377 16.139 1.114 1.385 -felixx.tsn.or.j 133.243.238.163 2 u 12 256 377 12.316 2.476 0.967 -www.4koma.com 133.243.238.243 2 u 86 256 377 23.427 17.659 1.146 *210.171.226.40 .NICT. 1 u 140 256 377 7.713 -0.039 0.330 +ntp1.jst.mfeed. 210.173.160.86 2 u 75 256 377 6.513 1.058 0.828 +orion.asahi-net 133.243.238.244 2 u 78 256 377 7.361 0.343 0.773 LOCAL(0) .LOCL. 10 l 49 64 377 0.000 0.000 0.001
この表の意味については以下を参照に。
http://www.oiden.net/Flets/bangai02/ntpq_output
なんだかよくわからないけど、できてるからいっか。
参考サイト
CentOSにtmux1.1をインストール
初ブログ、今日から本格的に始めます。
しかし、ブログの装飾の仕方がわからん・・・。もっと勉強して、みやすい日記にしていきたい。頑張ります。
バイト先のubuntuには以前に入れて、とても便利だったので自宅のCentOSに入れることに。CentOS環境でのtmuxの記事が見つからなかったので、これを見て、設定が助かった人が出てくると嬉しいですね。
まずtmuxのmakeが途中でとまってしまうのでncursesを入れておく
・ncurses
$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz $ tar zxvf ncurses-5.7.tar.gz $ cd ncurses-5.7 $ ./configure --without-cxx-binding $ make install
・tmux
$ wget http://downloads.sourceforge.net/sourceforge/tmux/tmux-1.1/tmux-1.1.tar.gz $ tar xvfz tmux-1.1.tar.gz $ cd tmux-1.1 $ ./configure $ make && make install
インストール終わり、確認↓
$ tmux
で動いた。
設定ファイルの.tmux.confは
http://d.hatena.ne.jp/tmatsuu/20090709/1247150771
からコピペした。
参考
インストール
.tmux.confの設定
- http://bytebucket.org/ns9tks/tmux-ja/wiki/tmux-ja.html
- http://d.hatena.ne.jp/ns9tks/20091016/1255691027#
- http://d.hatena.ne.jp/tmatsuu/20090710/1247179550
- http://akisute.com/2009/09/tmuxconftmuxprefix.html