Home > Logs > July 2008 > This Entry
Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、HyperEstraier をインストールする
※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアAMD Opteron 1352) です。
HyperEstraier 専用にバーチャルホストを設定し、ブラウザから全文検索できるように設定します。
Ubuntu Server Edition への HyperEstraier のインストール
apt を使って HyperEstraier をインストールします。
sudo apt-get install hyperestraier
sudo apt-get install wv xlhtml ppthtml
起動時に Hyper Estraier を自動起動する設定にします。
sudo vi /etc/default/hyperestraier
NO_START=1 -> NO_START=0
cgi などのファイルを配置し、設定ファイルを編集します。
sudo cp /usr/lib/estraier/estseek.cgi /www/sites/hyperestraier.weeeblog.net/htdocs/estseek.cgi
sudo cp /usr/share/hyperestraier/locale/ja/estseek.* /www/sites/hyperestraier.weeeblog.net/htdocs/
sudo vi /www/sites/hyperestraier.weeeblog.net/htdocs/estseek.conf
indexname: /www/sites/hyperestraier.weeeblog.net/casket
replace: ^file:///www/sites/weeeblog.net/htdocs/{{!}}http://weeeblog.net/
deftitle: Weeeblog.net::HyperEstraier
アーカイブの拡張子を .html にしている場合は、以下のコマンドでインデックスを作成し、バーチャルホストの設定の項目に進みます。
cd /www/sites/hyperestraier.weeeblog.net
sudo estcmd gather -il ja -pc UTF-8 -sd casket /www/sites/weeeblog.net/htdocs
アーカイブの拡張子を .php にしている場合はインデックス対象に含まれないので、MT のアーカイブを利用して、インデックスのための文書ドラフトを吐かせるようにします(アーカイブの拡張子が .html の場合は以下は飛ばしてバーチャルホストの設定の項目に進んでください)。
@uri=<$MTBlogArchiveURL$><$MTEntryDate format="%y/%m/%d_%h%n"$><$MTBlogFileExtension$>
@title=<$MTEntryTitle$>
@author=<$MTEntryAuthor$>
@cdate=<$MTEntryDate format="%Y-%m-%dT%H:%M:%S+09:00"$>
@mdate=<$MTEntryModifiedDate format="%Y-%m-%dT%H:%M:%S+09:00"$>
<MTEntryIfTagged>category=<MTEntryTags glue=","><$MTTagName$></MTEntryTags></MTEntryIfTagged>
<$MTEntryBody addblogurl="1" addtext="1" remove_html="1">
<MTIfNonEmpty tag="EntryMore"><$MTEntryMore remove_html="1"$></MTIfNonEmpty>
<$MTEntryTitle$>
アーカイブマッピングは、「draft/%y/%m/%d_%h%n.est」のようにしておきます。優先アーカイブは、本来あったもののままにしておきます。
ここまでの設定ができたら、以下のコマンドでインデックスを作成します。
cd /www/sites/hyperestraier.weeeblog.net
sudo estcmd gather -il ja -pc UTF-8 casket /www/sites/weeeblog.net/htdocs/logs/draft
念のため、draft ディレクトリへの WEB アクセスができないようにしておきます。
sudo vi /www/sites/weeeblog.net/htdocs/logs/draft/.htaccess
deny from all
以下はおまけですが、ついでにステータスが 403 や 404 の場合に返すページを作っておきましょう。
sudo vi /etc/apache2/sites-enabled/weeeblog.net
# Options に -Indexes を追加すること
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
sudo vi /www/sites/weeeblog.net/htdocs/403.html
sudo vi /www/sites/weeeblog.net/htdocs/404.html
バーチャルホストの設定
sudo mkdir -p /www/sites/hyperestraier.weeeblog.net/htdocs
sudo chown -R www-data:www-data /www/sites/hyperestraier.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/hyperestraier.weeeblog.net
<virtualHost *>
ServerName hyperestraier.weeeblog.net
DocumentRoot /www/sites/hyperestraier.weeeblog.net/htdocs
ErrorLog /www/sites/hyperestraier.weeeblog.net/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
CustomLog /www/sites/hyperestraier.weeeblog.net/access.log combined
ServerSignature On
<Location />
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
DirectoryIndex index.phtml index.fcgi index.html index.cgi index.pl index.php index.xhtml
Options ExecCGI +Indexes FollowSymLinks MultiViews
# AllowOverride None
Order allow,deny
allow from all
</Location>
</virtualHost>
アクセス制限は適宜行ってください。また、ドキュメントルートを見せる必要がない場合はリダイレクト設定をしておきます。
sudo vi /www/sites/hyperestraier.weeeblog.net/htdocs/.htaccess
RewriteEngine on
RewriteRule ^$ /estseek.cgi
バーチャルホスト設定を書いたら、再起動して、ちゃんと設定ができているか確認します。
sudo /etc/init.d/apache2 restart
# ブラウザでアクセス
http://hyperestraier.weeeblog.net/
この時点では HyperEstraier のデフォルトのテンプレートなので、MT で HyperEstraier 用のテンプレートを作成します。
sudo mkdir -p /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier
sudo chown -R www-data:www-data /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier
インデックステンプレートで作成し、出力ファイル名を「tmpl/hyperestraier/estseek.tmpl」とします。
<MTSetVarBlock name="page_title">Search by HyperEstraier: <$MTBlogName$></MTSetVarBlock><$MTSetVar name="prev" value=""$><$MTSetVar name="next" value=""$><$MTInclude module="docHeaderforCGI"$>
<body id="hyperestraier">
<div id="container" style="top:0px;" onmouseover="naviSlider('out')">
<$MTInclude module="siteNavigation"$>
<!--[contents]-->
<div id="contents">
<hr class="docSeparate" />
<!--[mainContents]-->
<div id="mainContents">
<h2 id="aboutTitle" class="pageTitle">About</h2>
<!--[main]-->
<div id="main">
<h3 class="contentsTitle">Search by HyperEstraier</h3>
<style type="text/css">html {
margin: 0em 0em; padding: 0em 0em;
background: #ffffff none;
}
body {
margin: 0em 0em; padding: 0em 0em;
color: #111111;
}
div.estform {
margin: 0.8em 1.0em; padding: 0em 1.0em;
background: #eeeeff none; border: solid 1pt #bbbbcc;
-moz-border-radius: 0.4em;
}
div.form_navi {
position: absolute; top: 1.5em; right: 2em;
margin: 0em 0em; padding: 0em 0em; text-align: right;
font-size: smaller;
}
div.form_navi a,div.form_navi span {
display: block; margin: -0.1em 0em; padding: 0em 0em;
}
a.navilink {
color: #5588cc; text-decoration: none;
}
a.navilink:hover {
color: #4499ee; text-decoration: underline;
}
span.navivoid {
color: #99aaaa;
}
div.form_advanced {
margin: 0.4em 0em; padding: 0em 0em;
}
th.ilabel {
padding-right: 0.3em; text-align: right;
font-weight: normal; font-size: smaller;
}
td.ivalue input.submit {
width: 12em;
}
td.ivalue input.reset {
width: 5em;
}
div.form_basic {
margin: 0.4em 0em 0em 0em; padding: 0em 0em;
font-size: smaller;
}
input.submit:hover,select:hover {
cursor: pointer;
}
div.form_extension,div.form_genrecheck {
margin: 0.3em 0em 0.3em 0em; padding: 0em 0em;
font-size: smaller;
}
label.genrecheck {
margin-right: 0.5em;
}
span.inputunit {
margin: 0em 0.3em;
}
input.button {
margin: 0.1em 0.1em; padding: 0em 0.5em;
background: #dddddd none; border: solid 1pt #cccccc;
-moz-border-radius: 0.3em;
color: #888888;
}
input.button:hover {
cursor: pointer;
}
input.abutton {
background: #ccccdd none; border: inset 1pt #bbbbbb;
color: #222222;
}
input.wbutton {
width: 7.5em;
}
input.mbutton {
width: 6.0em;
}
input.nbutton {
width: 4.5em;
}
div.estresult {
margin: 1.0em 1.0em; padding: 0em 0em;
}
div.resinfo {
margin-right: 0.3em; text-align: right;
font-size: smaller;
}
div.hints {
margin-right: 0.8em; text-align: right;
font-size: smaller; color: #555555;
}
div.relkeys {
margin-right: 0.3em; text-align: right;
font-size: smaller; color: #555555;
opacity: 0.70;
}
div.relkeys a {
color: #007777; text-decoration: none;
}
div.relkeys a:hover {
color: #0066dd; text-decoration: underline;
}
dl.doc {
margin: 1.3em 0em;
}
dl.doc dd {
font-size: smaller; color: #222222;
}
a.doc_title {
color: #0011ee; text-decoration: underline;
}
a.doc_title:hover {
color: #0033ff; text-decoration: underline;
}
span.doc_score {
font-size: smaller; color: #555555;
}
span.doc_score:before {
content: "(";
}
span.doc_score:after {
content: ")";
}
span.doc_link {
color: #007744;
}
dd.doc_attr {
margin: 0em 0.8em;
}
span.doc_val {
color: #111111;
}
dd.doc_text {
margin: 0em 1.3em;
}
strong.key {
margin: 0em -0.1em; padding: 0em 0.1em;
color: #000011;
-moz-border-radius: 0.3em;
}
strong.key1 { background-color: #ffffcc; }
strong.key2 { background-color: #ffeeee; }
strong.key3 { background-color: #eeeeff; }
strong.key4 { background-color: #eeffdd; }
code.delim { color: #555555; letter-spacing: -0.1em; }
dd.doc_navi {
margin: 0em 1.1em;
}
div.doc_clip {
margin-left: 2.5em; margin-top: -0.6em;
}
div.doc_clip p {
font-size: smaller; color: #444444;
}
a.display,a.detail,a.similar,a.dir,a.include {
color: #007777; text-decoration: none;
}
a.display:hover,a.detail:hover,a.similar:hover,a.dir:hover,a.include:hover {
color: #0066dd; text-decoration: underline;
}
p.note {
margin: 3em 1.5em;
color: #444444;
}
div.paging {
margin: 2em 1em; text-align: right;
font-size: smaller;
}
a.navi {
margin: 0em 0.2em; padding: 0em 0.5em;
background: #eeeeff none; border: solid 1pt #bbbbcc;
-moz-border-radius: 0.25em;
color: #0022aa; text-decoration: none;
}
span.void {
margin: 0em 0.2em; padding: 0em 0.5em;
background: #eeeeee none; border: solid 1pt #bbbbcc;
-moz-border-radius: 0.25em;
color: #aaaaaa;
opacity: 0.70;
}
a.pnum {
margin: 0em 0em; padding: 0em 0.2em;
background: #eeeeff none; border: solid 1pt #bbbbcc;
-moz-border-radius: 0.25em;
font-size: smaller; color: #0022aa; text-decoration: none;
}
span.pnow {
margin: 0em 0em; padding: 0em 0.2em;
background: #ffeedd none; border: solid 1pt #bbbbcc;
-moz-border-radius: 0.25em;
}
div.estinfo {
margin: 1.5em 1.0em; padding: 0em 0em; text-align: right;
font-size: smaller; color: #555555;
opacity: 0.80;
}
div.estinfo a {
color: #555555; text-decoration: none;
}
div.logo {
margin: 15.0em 1em; text-align: center;
}
div.logo h1 {
color: #000000;
}
div.logo div.caption {
margin-top: -0.9em;
color: #222222;
}
div.help {
margin: 2em 4em; padding: 2em 2em;
background-color: #eeeeff; border: 2pt solid #ddddee;
-moz-border-radius: 0.8em;
}
div.help h1 {
margin: -1em 0em; padding: 0em 0em; text-align: right;
font-weight: normal; font-size: smaller;
}
div.help h2 {
margin-top: 1.2em;
}
div.help p {
line-height: 145%; text-indent: 0.8em;
}
div.help pre {
margin: 0em 2em; padding: 0em 0.2em;
background-color: #ffffff; border: 1pt solid #999999;
-moz-border-radius: 0.2em;
}
</style>
<script type="text/javascript">function startup(){
if((document.location + "").indexOf("#") != -1) return;
var elem = document.getElementById("phrase");
if(elem) elem.focus();
}
window.onload = startup;
function changemax(){
var elem = document.getElementById("form_self");
if(elem) elem.submit();
}
function changeclip(){
var elem = document.getElementById("form_self");
if(elem) elem.submit();
}
function changetarget(value){
var felem = document.getElementById("form_self");
if(felem){
var aelem = document.getElementById("attr");
if(aelem) aelem.value = value;
felem.submit();
}
}
function changeorder(value){
var felem = document.getElementById("form_self");
if(felem){
var oelem = document.getElementById("order");
if(oelem) oelem.value = value;
felem.submit();
}
}
</script>
<!--ESTFORM-->
<!--ESTRESULT-->
<!--ESTINFO-->
</div>
<!--/[main]-->
</div>
<!--/[mainContents]-->
<hr class="docSeparate" />
<$MTInclude module="navigation"$>
</div>
<!--/[contents]-->
<hr class="docSeparate" />
<$MTInclude module="footerNavigation"$>
</div>
<$MTInclude module="functions"$>
</body>
</html>
出力したファイルにシンボリックリンクを張ります。こうしておくと、MT でテンプレート管理できる上に、リンク先を維持できるので便利です。
cd /www/sites/hyperestraier.weeeblog.net/htdocs
sudo mv estseek.tmpl estseek.tmpl.original
sudo ln -s /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier/estseek.tmpl .
sudo ln -s /www/sites/weeeblog.net/htdocs/common .
再度ブラウザでアクセスして、ちゃんと設定できたかどうか確認します。
# ブラウザでアクセス
http://hyperestraier.weeeblog.net/
Post Comment