2012年1月18日星期三

直接從資料庫改drupal7 的預設版型

UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';
TRUNCATE cache;

2011年11月20日星期日

Proxmox VM is locked (backup) 的解法

Proxmox如果備份到一半死掉,會導致服務起不來,可以先在終端機用指令qm start 108檢查,如果得到setting parameters failed - VM is locked (backup)的訊息,就可以考慮用qm unlock vmid來解除。

2011年10月11日星期二

dspace 更改資料的 URI

今天把virtual host的問題解後,就可以直接繞過tomcat的8080 port,但是這樣一來Dspace中已建立的資料的URI會維持原本的 XXX.XXX:8080 的版本,這樣反而會連不上,找了一下資料後,發現在dspace是有指令可以一起改 hadle server,但是已寫入資料庫的就不能更改了。

最後是採用將Postgres資料庫的「metadatavalue」資料表Dump出來後,透過文字編輯工具,一口氣改特定字串,然後再倒回去資料庫,不過Postgres倒回去前得先把「metadatavalue」資料表清空,且分析也要清空才行。

2011年10月10日星期一

ubuntu apache2 mod 載入法及Dspace 的 tomcat6 8080 port轉向及更動預設版型注意事項

ubuntu apache2 mod 載入法
ubuntu的apache2載入模組的方式與之前有所不同,
拆開成很多細小的部分,雖然比較麻煩,
不過我覺得這樣反而可以比較好管理。

參考:http://www.debuntu.org/2006/06/15/66-how-to-enable-apache-modules-under-debian-based-system

有兩個方法,一種手動下連結的方式,一種是跑內建小程式來達成:

  1. $cd /etc/apache2/mods-enabled
    $ sudo ln -s ../mods-available/mime_magic.conf mime_magic.conf
    $sudo ln -s ../mods-available/mime_magic.load mime_magic.load
  2. $sudo a2enmod
    Which module would you like to enable?
    Your choices are: actions asis auth_anon auth_dbm auth_digest auth_ldap cache cern_meta cgid cgi dav_fs dav deflate disk_cache expires ext_filter file_cache headers imap include info ldap mem_cache mime_magic php5 proxy_connect proxy_ftp proxy_http proxy rewrite speling ssl suexec unique_id userdir usertrack vhost_alias
    Module name? mime_magic
    Module mime_magic installed; run /etc/init.d/apache2 force-reload to enable.
完成後記得要 sudo /etc/init.d./apache2 restart
----------------------------------------------------------------------------------------------


Dspace 的 tomcat6 8080 port轉向及更動預設版型注意事項


另外如果是 Dspcae 要用這方式轉向,基本上 dspcae.cfg不用動,但是將紅色那一行關掉,主要是不在dspace這邊控制載入時的根目錄,而是在tomcat那邊控制:


# DSpace base host URL.  Include port number etc.

dspace.baseUrl = http://xxx.xxx.xxx:8080




# DSpace base URL.  Include port number etc., but NOT trailing slash

# Change to xmlui if you wish to use the xmlui as the default, or remove

# "/jspui" and set webapp of your choice as the "ROOT" webapp in

# the servlet engine.

#dspace.url = ${dspace.baseUrl}/xmlui



apache的也是一樣對應好:
ProxyPass / http://xxx.xxx.xxx:8080/
ProxyPassReverse / http://xxx.xxx.xxx:8080/

這樣一進到80 port的apache就會是由tomcat提供服務。

※後來發現tomcat的server.xml 可以直接改預設的port,那樣似乎會比較簡單,就不需管apache在那邊轉來轉去。(add at 20111121)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="8443" />


最後在 /etc/tomcat6/server.xml 中,如果當初是跟著官方手冊做,應該是長這樣:
1
2
3
4
5
6
      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

1
2
3
4
5
6
7
<!-- Define a new context path for all DSpace web apps -->
<Context path="/xmlui" docBase="/dspace/webapps/xmlui" allowLinking="true"/>
<Context path="/sword" docBase="/dspace/webapps/sword" allowLinking="true"/>
<Context path="/oai"   docBase="/dspace/webapps/oai"   allowLinking="true"/>
<Context path="/jspui" docBase="/dspace/webapps/jspui" allowLinking="true"/>
<Context path="/lni"   docBase="/dspace/webapps/lni"   allowLinking="true"/>
<Context path="/solr"  docBase="/dspace/webapps/solr"  allowLinking="true"/>



這時就把修改appbase,另外就是「xmlui」的位置改成對應到「 」
1
2
3
4
5
6
      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="/dspace/webapps/"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

1
2
3
4
5
6
7
<!-- Define a new context path for all DSpace web apps -->
<Context path="" docBase="xmlui" allowLinking="true"/>
<Context path="/sword" docBase="sword" allowLinking="true"/>
<Context path="/oai"   docBase="oai"   allowLinking="true"/>
<Context path="/jspui" docBase="jspui" allowLinking="true"/>
<Context path="/lni"   docBase="lni"   allowLinking="true"/>
<Context path="/solr"  docBase="solr"  allowLinking="true"/>


如此一來預設的dspace版式就會是xmlui。

2011年10月7日星期五

透過Apache的mod_proxy轉同台機器的IIS

同一台機器不能同樣都用80 port,
因此如果需要用到 ASP 的程式時,
可以考慮同時啟用 Apache 和 IIS,
但是IIS的port仍然要先避開 80。

之後可以參考用 apache 的 mod_proxy 功能,
轉換至

可以參考以下的做法:(引自)
#Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

# Put this with your other VirtualHosts, or at the bottom of the file
NameVirtualHost *

<VirtualHost *>
 #for apache original www
    ServerName confluence.example.com
    DocumentRoot d:\appserv\www
    ProxyRequests Off
</VirtualHost>    

<VirtualHost *>
 #for IIS mapping
    ServerName jira.example.com
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://jira-app-server.internal.example.com:8080/
    ProxyPassReverse / http://jira-app-server.internal.example.com:8080/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost

2011年10月5日星期三

dspace 1.7更改預設樣版

如果根據dspace wiki 來做,實在不清楚要幹嘛,且照著做也沒更換樣版。

最後參考 Making DSpace XMLUI Your Own 這個檔案,
Making DSpace XMLUI Your Own

View more presentations from Tim Donohue

其中提到要去修改「[dspace]/config/xmlui.xconf」中:將 themes 標遷中,要關閉的加上html 的注釋符號 ,相對要開啟的就拿掉。

在 Ubuntu 11.04 裝 dspace 的注意事項

在Dspace官網的wiki中,有一篇 Installing DSpace 1.7 on Ubuntu ,
裝在 Ubuntu 11.04 server 上是ok的,照著做即可,但是中間要並無要求使用者名稱為何,
如果安裝 Ubuntu 11.04 server時,不是 dspace 做為主要操作的使用者,會在以下遇到麻煩:

Create the dspace database

createdb -U dspace -E UNICODE dspace

 所以,要不就是login的使用者直接為 dspace ,不然就是修改 postgres 的 ident.id ?(有點忘了) :P

分頁小工具