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

ติดตั้ง SVN Server บน CentOS (ตอนหนึ่ง)

SVN หรือ Versioning Control ซึ่งจะสะดวกมาในการทำงานเป็นทีมและสามารถเลือกได้ว่าเราจะอัพเดตไปยัง Revision ไหน(เวอร์ชั่นไหน) โดยหลักๆ เราจะแบ่งโครงการออกเป็นสามส่วนคือ trunk branch และ tags โดยแต่ละส่วนจะมีการกำหนดดังนี้

  • Trunk เป็นส่วน Core ของโปรเจ็ค หรือเรียกง่ายๆ ว่าอะไรที่ Stable แล้วเราจะใส่ไว้ในส่วนนี้
  • Branch เป็นส่วนที่เป็น Feature ที่เราจะทำการเพิ่มเติมขึ้นมา ส่วนใหญ่เมื่อผ่านพ้นช่วงทดสอบต่างๆ และเป็นที่ยอมรับของทีมแล้ว เราก็จะนำเข้าไปไว้ใน Trunk
  • Tags จะเป็นตัวแบ่งเวอร์ชั่นออกจากกันเช่นเมื่อเราออกเวอร์ชั่น Stable แล้วเราก็จะ copy มาใส่ไว้ใน Tags เพื่อที่จะได้มีหลายเวอร์ชั่นให้ผู้พัฒนาได้เลือก

เริ่มการติดตั้ง SVN Server บน CentOS กันดีกว่าครับ ใช้เครื่องมือที่เราคุ้นเคยกันดี

yum install httpd
chkconfig httpd on

ซึ่ง chkconfig จะทำให้ตัว httpd server เริ่มต้นอัตโนมัติเมื่อเริ่มระบบ
หลังจากนั้นทำการแก้ไขไฟล์ httpd.conf
vim /etc/httpd/conf/httpd.conf
แก้ไขตามความต้องการหากต้องการเปลี่ยน Port ก็เปลี่ยนได้เลยครับ
หลังจากนั้นทำการแก้ไขไฟล์ subversion.conf
vim /etc/httpd/conf.d/subversion.conf
ทำการ uncomment บรรทัดต่อไปนี้

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<location /repos>
   DAV svn
   SVNParentPath /var/www/svn/repos
   # Limit write permission to list of valid users.
   #<limitexcept>
      # Require SSL connection for password protection.
      # SSLRequireSSL
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /etc/svn-auth-conf
      Require valid-user
   #</limitexcept>
</location>


เวลาเข้าผ่าน Browser สามารถเข้าได้ผ่าน URL http://<hostname>/repos

หลังจากนั้นจะเป็นการติดตั้ง User ที่จะใช้งาน


htpasswd -cm /etc/svn-auth-conf yourusername
ระบบจะให้ใส่รหัสสำหรับ User
สองครั้ง

หากหลังจากนี้ต้องการเพิ่ม user ให้ใช้แค่คำสั่ง htpasswd -m /etc/svn-auth-conf เพราะไฟล์ svn-auth-conf นั้นได้ถูกสร้างไว้แล้ว (-c หมายถึงให้สร้างไฟล์ htpasswd ขึ้น)

และขั้นตอนสุดท้ายเป็นการสร้าง directory สำหรับ svn

mkdir /var/www/svn
cd /var/www/svn
svnadmin create repos
chown -R apache.apache repos
service httpd restart


svnadmin เป็นการใช้ svnadmin สร้าง directory repos และ chown เป็นการโดนสิทธิ์ให้กับ apache ซึ่งอยู่ในกลุ่ม apache (apache.apache <-- ตัวแรกหมายถึงกลุ่ม ตัวหลังหมายถึง user ของระบบ ไม่ใช่ของ svn นะครับ) หลังจากนั้นเป็นคำสั่งรีสตาร์ท apache server นั่นเอง

ความคิดเห็น

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

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

ไม่ได้เขียน 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