ข้ามไปที่เนื้อหาหลัก

Alfresco from source

การติดตั้ง Alfresco นั้นมีหลายวิธีด้วยกัน ผมขอแยกเป็นสามกรณีดังนี้
  • ติดตั้งจากตัว Installer ซึ่งวิธีนี้ถือว่าสะดวกที่สุดครับ เนื่องจากตัว Alfresco นั้นเตรียมเครื่องมือที่จำเป็นไว้ให้เกือบหมดแล้ว (บน Windows นี่ถือว่าพร้อมกับการทำงานทีเดียว ส่วนบน Unix จะต้องติดตั้ง MySQL ,Swf2PDF ImageMagick และ OOo - OpenOffice เองครับ เนื่องจากไม่สามารถรันได้แบบวินโดว์)
  • ติดตั้งจากตัว Compiled Binary ซึ่งจะเป็นไฟล์ zip หรือ tarball ตามแต่ระบบปฏิบัติการ
  • วิธีสุดท้ายเป็นวิธีที่ผมจะนำเสนอในตอนนี้คือการ Compile Source จาก SVN ครับ

สองวิธีสุดท้ายนี้เราจำเป็นต้องหาพวก binary ของ third party มาลงเอง (แต่สำหรับ linux ไม่ว่าจะวิธีไหนเราก็ต้องหามาลงเองครับ)

เราสามารถ Check out Source จาก repository จาก Alfresco ได้หลายวิธีไม่ว่าจะ Check out จาก Eclipse โดยผ่าน Subclipse หรือ Netbeans หรือแม้กระทั่ง SVN command line ก็สามารถทำได้

ในที่นี้ผมจะขอเลือกใช้แบบ Command line ซึ่งเป็นวิธีที่สะดวกที่สุด เพราะมีมาให้กับ linux อยู่แล้วหรือหากใครใช้ Windows อยู่ ผมขอแนะนำให้ติดตั้ง SlikSVN 1.5.x เนื่องจากขั้นตอน build นั้นจำเป็นต้องใช้ svnant ในการ build และตัว lib ของ svnant นั้นจะเรียกใช้ SVN 1.5.x เท่านั้น หากใช้ version 1.6.x นั้นจะทำให้เกิด error ขึ้นตอน build file continuous.xml ครับ

ขั้นแรกให้ check out source ออกมาก่อน


svn co svn://svn.alfresco.com/alfresco/HEAD/root "Alfresco Source"


อธิบายคำสั่งของ svn

  • co คือ checkout ครับ
  • svn://svn.alfresco.com/alfresco/HEAD เป็น repository ครับ ส่วน root นั้นเป็น directory ของ project ครับ ซึ่งจะเป็นตัว source code ทั้งหมดของ project ส่วน "Alfresco Source" นั้นเป็นการตั้งชื่อให้กับ Directory ในเครื่องเราครับ หากเราไม่ใส่เราจะได้ Directory ชื่อ root มาแทน

ปล. svn:// protocal นั้นจะใช้ port 3690 หากใครโดน block port นี้ไว้ ก็ให้ใช้
svn co http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD แทนได้ครับ ให้เติม root ต่อท้ายด้วยก็ดีครับ
ปล2. Alfresco Community Edition 3.2 นั้น revision จะอยู่ที่ 15070 ให้เราใส่ parameter ไปด้วยเป็น -r 15070


svn co svn://svn.alfresco.com/alfresco/HEAD/root "Alfresco Source" -r 15070


หลังจากได้ code มาแล้วให้เราเซ็ท environment variable สามตัวหลักที่ต้องใช้คือ

  • TOMCAT_HOME
  • APP_TOMCAT_HOME
  • VIRTUAL_TOMCAT_HOME

ใน Windows เซ็ทโดยไปที่ Control Panel > System > Advanced > Environment Variables
ใน User Variable > New > Variable Name: TOMCAT_HOME > Variable Value:

ใน Linux ให้ set ดังนี้
export TOMCAT_HOME= เซ็ทให้ครบสามตัวเป็นอันเสร็จขั้นตอนเซ็ท Environment

ต่อไปเราจะเริ่ม build ให้เราลง ant ในระบบก่อน ในที่นี้สมมติว่าทุกคนลงเรียบร้อยแล้ว หากยังเอาไว้ผมจะเขียนขั้นตอนการลงไว้ให้ครับ สามารถดูที่ tag how to หรือ search เอาก็ได้ครับ

ให้เราเริ่ม ant build ใน folder Alfresco Source (ชื่อที่เราตั้งไว้ให้ หากไม่ได้ตั้งชื่อไว้ให้จะเป็น HEAD/root หรือ root แล้วแต่ท่านลงไว้ครับ


ant -f build.xml build-tomcat หรือ ant เฉยๆ


อธิบายคำสั่ง ant -f คือ file build ของ target ต่างๆ ที่เราเขียนไว้ คล้ายๆ make file ของ gnu ครับ build-tomcat คือ target ของ build หากไม่ใส่ไว้ตัว default จะเซ็ทไว้ที่ build-tomcat อยู่แล้ว โดยสามารถเข้าไปดูได้ที่ไฟล์ build.xml ครับ

เมื่อเสร็จแล้วเราจะได้ file ต่างๆ ใน folder ตาม TOMCAT_HOME ครับ ซึ่งจะพบว่ามีไฟล์ alfresco.war และ shared.war อยู่ใน directory tomcat/webapps ครับ จากนี้เราสามารถรัน tomcat ได้แล้วครับ ตัว tomcat จะ deploy webapps เราให้อัตโนมัติครับ

หากใครรันบน Windows แล้วไม่ผ่านให้ไปเปลี่ยน Locale ใน Control Panel > Regional and Language ก่อนครับ ให้เป็น en (en_US, en_EN)ครับเนื่องจากตัว Quartz (Job Schedule คล้ายๆ กับ crontab ใน unix ครับ) จะใช้ค่าแบบ locale เป็น en ครับ หากเจอภาษาไทยเข้าไปมันจะเอ๋อครับ

หลังจากนั้นก็ให้เข้า http://localhost:8080/alfresco หรือ http://localhost:8080/share ได้เลยครับ
ตัว share นั้นจะเปรียบได้กับ sharepoint ของ Microsoft เลยทีเดียว

สามารถดูเพิ่มเติมเกี่ยวกับการ build ได้ที่ Alfresco SVN Development Environment

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

หมดหวังกับรายการทีวีในประเทศไทย

ไม่ได้เขียน Blog มานานสกิลด้านเขียนไม่รู้จะยังดีเหมือนเดิมมั้ยนะครับ (หัวข้อก็จะ clickbait  ตามแนว Content ยุคใหม่) จริงๆ แล้ว คิดจะเขียนมาตั้งนานแล้วแต่ไม่รู้จะเขียนอะไร พอดีวันนี้อ่านเจอโพสต์ของเพื่อนในเฟสบุ๊คที่แชร์มา หัวข้อประมาณว่า ประเทศไทยมีความพยายามทำให้คนโง่ลง คือผมก็ติดตามข่าวมาเรื่อยๆ ช่วงไปอยู่จีนก็ยังติดตามอยู่ แต่มีความรู้สึกว่าข่าวของประเทศเรากับประเทศจีนนี่คือคนละขั้วเลย ที่จีนข่าวส่วนใหญ่จะเป็นข่าวที่ค่อนข้างมีสาระ และไม่มีข่าวงมงาย น่าจะเนื่องมาจากกฎหมายของประเทศไทยที่ค่อนข้างคุมเข้มกับสื่อ ย้อนกลับมาที่ไทย ประเทศเราไม่มีกฎหมายคุมเข้มสื่อเหมือนประเทศจีนขนาดนั้น สื่อประเทศเราค่อนข้างมีอิสระในการนำเสนอ แต่หลังๆ มานี่ผมเห็นแต่ข่าวอาชญากรรม หรือข่าวให้หวยซะส่วนใหญ่ ก็เข้าใจว่าต้องการยอดผู้ชม แต่การที่สื่อนำเสนอแบบนั้นนี่ไม่แน่ใจว่าจะดีต่ออนาคตประเทศชาติหรือไม่นะครับ คนดูข่าวเพื่อจะรอเลขเอาไปซื้อหวย ไม่แน่ใจว่าสนใจอะไรมากกว่าระหว่างหวยกับข่าว ตอนจะมีกฎหมายหวยออนไลน์ก็เห็นออกมาต่อต้านบอกมอมเมาประชาชน แต่สิ่งที่สื่อกำลังนำเสนออยู่นั้นมันย้อนแย้งในตัวเองชอบกล และ

Fluent NHibernate Configuration

I have a C# project which I have to develop for MS SQL Server, customer requirment, but since I do not have a license for it. Then I decide to go with NHibernate but NHibernate is relied on XML based configuration, which is not my preference, I research a little bit more, definitely I found out Fluent NHibernate is a good replacement for XML based configuration. I can map the entities with C# code that can reduce the errors prone in my code. I use Firebird database in the development, though it can be used in production, I define the mapping as normal NHibernate (also Hibernate in Java). But when I try to build the configure for Fluent NHibernate, it's not the same as SQLite example, I try to fine the solution one by one from StackOverflow and the steps below can solved my problem. Add the reference for NHibernate and its dependecies (NHibernate.dll, Iesi.Collections.dll) Add a reference for Fluent NHibernate (FluentNHibernate.dll), you can get it from nuget packacge manager

Standalone MySQL setup

Currently I am learning Spring Boot. I follow some tutorials but there is a part requires to use DBMS. So I decide to use MySQL as a database. But I don't want to install it as as service neither install with Windows installer. I decide to download an archive version to run it as standalone application. I expect it will be ready to use as the installer version but it is not as easy as I think. The first thing you have to do after extract the archive file is to copy my-default.ini to my.ini Open my.ini with notepad or text editor that you like, edit these lines as show below basedir = X:/<pat to your mysql folderh>/mysql-5.7.9-winx64 datadir = X:/<pat to your mysql folderh>/mysql-5.7.9-winx64/data Important!  Don't forget to create the folder data to the path they you refer in datadir  Second you have to mysql bin directory and then input the following command in command prompt mysqld --initialize --console --console is optional to see the verbose in