在ubuntu11.04安装solr

princy | June 2nd, 2011 - 14:22:22

1 在ubuntu11.04下安装tomcat 6
sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
sudo apt-get install libmysql-java

2.下载apache-solr-1.4.1.zip并解压
cd ~/
wget -c http://ftp.riken.jp/net/apache//lucene/solr/1.4.1/apache-solr-1.4.1.zip
unzip apache-solr-1.4.1.zip
sudo cp ~/apache-solr-1.4.1/dist/apache-solr-1.4.1.war /var/lib/tomcat6/webapps/solr.war
sudo cp -R ~/apache-solr-1.4.1/example/solr/ /var/lib/tomcat6/solr/

3. 在tomcat6里面设置solr环境
sudo vim /etc/tomcat6/Catalina/localhost/solr.xml

加入如下内容

<Context docBase=”/var/lib/tomcat6/webapps/solr.war” debug=”0″ privileged=”true” allowLinking=”true” crossContext=”true”> <Environment name=”solr/home” type=”java.lang.String” value=”/var/lib/tomcat6/solr” override=”true” /> </Context>

4. 设置solrconfig.xml环境,并建立data文件夹
mkdir /var/lib/tomcat6/solr/data

设置tomcat6访问data的权限

chown -R tomcat6:tomcat6 /var/lib/tomcat6/solr/data/

通过solr/conf/solrconfig.xml来设置data路径
<– Used to specify an alternate directory to hold all index data other than the default ./data under the Solr home. If replication is in use, this should match the replication configuration. –>
/var/lib/tomcat6/solr/data

5. 重启tomcat后进入solr
sudo service tomcat6 restart
http://localhost:8080/solr/admin

Done

在ubuntu上安装rails

princy | June 2nd, 2011 - 13:46:37
1 安装以下软件

apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

2 用RVM来安装ruby1.9.2
bash &lt; &lt;( curl https://rvm.beginrescueend.com/releases/rvm-install-head )

添加到默认路径里面
<pre><code>echo '[[ -s "/home/&lt;yourhome&gt;/.rvm/scripts/rvm" ]] &amp;&amp; source "/home/&lt;yourhome&gt;/.rvm/scripts/rvm"' &gt;&gt; ~/.bashrc </code>

重新登入终端后用一下命令测试

rvm notes

用rvm来安装ruby 1.9.2

rvm install 1.9.2

设定默认的ruby版本

rvm --default ruby-1.9.2

查看新设定的版本

ruby -v

3 安装rails

gem install rails

查看版本

rails -v 

Rails 3.0.7

4 安装自带的数据库

安装数据库

apt-get install sqlite3 libsqlite3-dev

用gem来设定数据库

gem install sqlite3-ruby

5  例子测试

rails new myproject

cd myproject

rails server

=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-02 22:44:07] INFO  WEBrick 1.3.1
[2011-06-02 22:44:07] INFO  ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-06-02 22:44:07] INFO  WEBrick::HTTPServer#start: pid=18129 port=3000

进入以下页面查看

http://localhost:3000

成功