LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1918|回复: 4

Gentoo 安装Typo --可定制性超强的Blog软件

[复制链接]
发表于 2006-8-22 11:10:28 | 显示全部楼层 |阅读模式
typo是一款基于Ruby的可定制性非常强的Blog软件。我在Gentoo下面成功的安装了一下,试了一下感觉还不错。期间碰到不少错误花了一些功夫才解决。现在把我的安装配置过程写出来和大家分享,希望看过这贴的兄弟可以少走弯路。我用的服务器是Lighttpd,Typo和Mediawiki一样后台管理用的是数据库,我用的数据库是MySQL.如果要通过服务器访问的话,还要fastcgi。
下面是要安装的软件:
* Ruby: 1.8.2 or higher; 1.8.4 or higher if using MySQL/Ruby drivers
* Rails: Since 2.6.0 Typo includes it's own version of Rails to take care of incompatibilities. Typo 4.0.0 comes with Rails 1.1.4 and Typo 2.6.0 comes with 1.0.0. Typoe 2.6.0 can also be used with Rails 0.13.1 or 0.14.0
* Database: MySQL 5.0.24
* Ruby DB Drivers: MySQL/Ruby (http://www.tmtm.org/en/mysql/ruby/)。
* Ruby-fcgi 0.8.6 (如果这个在启动Lighttpd的是候会出错)

一.安装软件
------------------------ 安装脚本 -------------------------
#/bin/bash
#emerge --sync
#emerge protage
emerge ruby
emerge rubygems
USE="fastcgi" emerge -v lighttpd
emerge ruby-fcgi
ACCEPT_KEYWORDS="~x86" emerge -v mysql
#启动MySQL数据库
#mysql_install_db
#mysqld_safe&
---------------------------------------------------------
下面来安装Typo你可以到网上下载压缩包,也可以直接到SVN上check out一份。建议用SVN check out,因为开发版也非常稳定。
下载开发包:http://rubyforge.org/frs/?group_id=555
SVN check out:
$ svn info svn://typosphere.org/typo/trunk
$ svn checkout svn://typosphere.org/typo/trunk typo

二.接下来配置MySQL数据库
如果还没装MySQL/Ruby Driver的话可以到http://www.tmtm.org/en/mysql/ruby 下载,解压。安装方法如下:

$ ruby extconf.rb
$ make
$ ruby ./test.rb $hostname $user $passwd $dbname
$ make install
创建数据库:
$ mysql -h localhost -u root -p
Enter password: ********
mysql> create database typo character set utf8;
Query OK, 1 row affected (0.01 sec)
mysql> grant all on typo.* to username@hostname identified by 'password';
mysql> quit

建表:
$ mysql mytypodb -h hostname -u username -p < db/schema.mysql.sql

这样基本上就安装好了.

三.运行
$ script/server -e production
默认端口是3000

四. 配置Lighttpd服务器。
如果你想通过服务器来访问的话那么还要配置Lighttpd服务器。
去掉
"mod_rewrite"
"mod_access"
"mod_fastcgi"
"mod_accesslog"
前面的注释,如果没有这自己加上。

在/etc/lighttpd/lighttpd.conf中加上
---------------------设置了Sub domain-------------------
$HTTP["host"] =~ "^(www.)?blog.yoursite.com" {
    server.document-root     = "/path/to/typo/public"
    server.error-handler-404 = "/dispatch.fcgi"
    server.indexfiles        = ("dispatch.fcgi")
    server.errorlog = "/var/log/log_path/error.log"
    url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
      
    fastcgi.server = (
        ".fcgi" => (
            "localhost" => (
                "socket" => "/tmp/lighttpd-typo-fcgi.socket",
                "bin-path" => "/path/to/typo/public/dispatch.fcgi",
                "bin-environment" => ( "RAILS_ENV" => "production" ),
                "max-load-per-proc" => 25,
                "min-procs" => 1,
                "max-procs" => 1,
                "idle-timeout" => 60,
            )
        )
    )
}
-------------------------------------------------------

---------------------不设置sub doamin-------------------
    fastcgi.server = (
        ".fcgi" => (
            "localhost" => (
                "socket" => "/tmp/lighttpd-typo-fcgi.socket"
                "bin-path" => "/path/to/typo/public/dispatch.fcgi",
                "bin-environment" => ( "RAILS_ENV" => "production" ),
                "max-load-per-proc" => 25,
                "min-procs" => 1,
                "max-procs" => 1,
                "idle-timeout" => 60,
            )
        )
    )
}
-------------------------------------------------------

五.添加验证
如果需要的的话可以在打开Blog页面的时候进行身份验证。
验证工具,Lighttpd支持htpasswd,plain,htdigest,ldap等验证。
如果系统里没有可到别处拷一个(附件中我上传了一个,方便大家)。我用的是htpasswd就以Lighttpd为例。
拷贝htpasswd到/usr/sbin/htpasswd,如果是用的时候提示缺少必要的库文件,可以到别处把这些拷到/usr/lib目录下面,再运行ldconfig.
创建用户加密文件
htpasswd -c /var/www/auth.passwd
具体设置如下:
去掉
"mod_auth"
前面注释,没有则自己加上。
去掉下面语句的注释,并加以修改
-------------------------------------------------------
auth.backend  = "htpasswd"
auth.backend.htpasswd.userfile = "/var/www/auth.passwd"
auth.require = ("/" =>
                     (
                       "method"  => "basic",
                       "realm"   => "trac",
                       "require" => "valid-user"
                   )
                   )
------------------------------------------------------
或者在$HTTP配置加上亦可
------------------------------------------------------
$HTTP["host"] =~ "^(www.)?blog.yoursite.com" {
    server.document-root     = "/path/to/typo/public"
              ......
    auth.backend  = "htpasswd"
    auth.backend.htpasswd.userfile = "/var/www/auth.passwd"
    auth.require = ("/" =>
                     (
                       "method"  => "basic",
                       "realm"   => "trac",
                       "require" => "valid-user"
                   )
                   )
    fastcgi.server = (
           .......
}
----------------------------------------------------------
重启就可以用web登录了。

六.错误处理
如果出现错误请检查
1.软件是否都安要求装好了
2.MySQL配置正确且MySQL正在运行
3.文件权限是否正确, chown -R lighttpd:lighttpd(具体看/etc/passwd) /path/to/typo
4.如果出现80端口错误,有Lighttpd或Apache在运行,如果是kill them(lighttpd可以用:killall lighttpd)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2006-8-22 12:10:12 | 显示全部楼层
建议放到wiki上,便于维护
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-22 12:19:33 | 显示全部楼层
请问怎么放上去?
回复 支持 反对

使用道具 举报

发表于 2006-8-22 14:37:20 | 显示全部楼层
gentoo-wiki.org
你去新建一个条目.以后软件升级或有什么漏洞修补的比较方便,也方便大家查找.
回复 支持 反对

使用道具 举报

发表于 2006-8-22 17:18:09 | 显示全部楼层
过些时间研究研究Ruby and Rails的web开发,谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表