練功房推薦書單

  • 猛虎出柙雙劍合璧版--最新 OCA / OCP Java SE 7 Programmer 專業認證 (電子書)
  • 流浪教師存零股存到3000萬(全新增修版)(書+DVD)
  • 開始在關西自助旅行(京都‧大阪‧神戶‧奈良)(全新增訂版)
  • 不敗教主的300張股票存股術

Java-based 部落格架設--roller篇 RSS feed
Forum Index » 架站軟體 Web-based Application
Author Message
andowson

七段學員
[Avatar]

Joined: 2007/1/2
Messages: 709
Location: 台北
Offline
現在流行的架站方式已經開始朝weblog方式了,於是我花了點時間安裝並整理了roller的自動安裝步驟,可以copy & paste方式完成一部份,剩下來的修改就得自己動手了。

底下整段copy下來,貼到root的shell
SETUP_DIR=/home/yoursite/download
INSTALL_DIR=/home/yoursite/www
CATALINA_HOME=/var/tomcat5
cd $SETUP_DIR
wget http://people.apache.org/dist/incubator/roller/apache-roller-3.0-incubating.tar.gz
tar zxvf apache-roller-3.0-incubating.tar.gz
export ROLLER=$SETUP_DIR/apache-roller-3.0-incubating/webapp/roller
wget https://roller.dev.java.net/files/documents/190/40575/required-jars-roller-3.0-incubating.tar.gz
tar zxvf required-jars-roller-3.0-incubating.tar.gz
cd $CATALINA_HOME/common/lib
wget http://jdbc.postgresql.org/download/postgresql-8.2-504.jdbc3.jar
mkdir -p $ROLLER/roller_data/uploads
mkdir -p $ROLLER/roller_data/search-index
echo 'uploads.dir='$INSTALL_DIR'/roller/roller_data/uploads
search.index.dir='$INSTALL_DIR'/roller/roller_data/search-index' > $ROLLER/WEB-INF/classes/roller-custom.properties

su postgres
psql -c "create user scott createdb;" template1
psql -c "create database roller with encoding 'unicode';" -U scott template1
psql -c "alter user scott nocreatedb;" template1
psql -c "alter user scott with encrypted password 'tiger';" template1

psql roller scott -f $ROLLER/WEB-INF/dbscripts/postgresql/createdb.sql
exit

cp -rf $ROLLER $INSTALL_DIR/roller
chown -R yoursite:tomcat $INSTALL_DIR/roller
chmod g+w $INSTALL_DIR/roller
chmod -R g+w $INSTALL_DIR/roller/roller_data

修改server.xml中的Connector,加上
URIEncoding="UTF-8"

編輯/var/robust/worker1/conf/Catalina/www.yoursite.com/roller.xml
<Context path="/roller" docBase="roller" debug="0" reloadable="true">
<Resource name="jdbc/rollerdb" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/roller"
username="scott"
password="tiger"
maxActive="20"
maxIdle="3"
removeAbandoned="true"
maxWait="3000" />
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session" mail.smtp.host="smtp.yoursite.com" />
</Context>

修改/home/yoursite/www/roller/WEB-INF/classes/hibernate.cfg.xml
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>

修改/etc/httpd/conf.d/mod_jk.conf,加上
JkMount /roller/* loadbalancer

重新啟動Tomcat和Apache

分享經驗 累積智慧
[WWW]
andowson

七段學員
[Avatar]

Joined: 2007/1/2
Messages: 709
Location: 台北
Offline
升級Roller 3.0到Roller 4.0

簡單的步驟如下:
1.下載檔案及解壓縮
cd ~/download
wget http://apache.ntu.edu.tw/roller/roller-4/v4.0.0/bin/apache-roller-4.0.zip
unzip apache-roller-4.0.zip

2.修改升級用的dbscripts
cd ~/download/apache-roller-4.0/webapp/roller/WEB-INF/classes/dbscripts/postgresql
vi 300-to-310-migration.sql
將底下這一行加在檔尾
update roller_properties set value='310' where name='roller.database.version';


vi 310-to-400-migration.sql
將第159行的
drop table if exists rollerconfig;

修改為
drop table rollerconfig;

然後一樣將底下這一行加在檔尾
update roller_properties set value='400' where name='roller.database.version';


3.關閉Application Server例如Tomcat
sudo /etc/init.d/tomcat stop

4.將現有的roller搬移(備份)到/tmp下
mv ~/www/roller /tmp/roller-3.0

5.複製新的程式到網站目錄下:
cp -rf ~/download/apache-roller-4.0/webapp/roller ~/www/roller

6.備份資料庫:
sudo pg_dump -U scott roller > /tmp/roller_300-2008-09-06.bak

7.手動升級資料庫到3.1
sudo psql -U scott roller -f /home/yoursite/www/roller/WEB-INF/classes/dbscripts/postgresql/300-to-310-migration.sql

8.編輯設定檔roller-custom.properties
vi ~/www/roller/WEB-INF/classes/roller-custom.properties
installation.type=auto
database.configurationType=jdbc
database.jdbc.driverClass=org.postgresql.Driver
database.jdbc.connectionURL=jdbc:postgresql://localhost:5432/roller
database.jdbc.username=scott
database.jdbc.password=tiger
mail.configurationType=properties
mail.hostname=smtp.yoursite.com
uploads.dir=/home/yoursite/www/data/roller_data/uploads
search.index.dir=/home/yoursite/www/data/roller_data/search-index
passwds.encryption.enabled=false

smilie 注意到Roller 4.0起使用者密碼預設為使用SHA加密,如果是升級上來的要將這個功能取消,否則將無法登入

9.變更檔案及目錄權限:
chown -R yoursite:tomcat ~/www/roller
chmod g+w ~/www/roller

10.刪除暫存檔案
rm -rf /var/robust/worker1/work/Catalina/www.yoursite.com/roller

11.啟動Application Server
sudo /etc/init.d/tomcat start

12.開啟網頁到http://www.yoursite.com/roller,會自動詢問是否要升級資料庫,選擇是

13.升級完成後,將設定檔roller-custom.properties裡面的installation.type改為manual
vi ~/www/roller/WEB-INF/classes/roller-custom.properties
installation.type=manual

分享經驗 累積智慧
[WWW]
 
Forum Index » 架站軟體 Web-based Application
Go to:   
Mobile view