วันพฤหัสบดีที่ 28 กุมภาพันธ์ พ.ศ. 2556

Install SVN Centos


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

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

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>

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

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


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 นั่นเอง

# Compile the c binary
make autoupdate
# Change the owner to the user that owns the website
chown username:username autoupdate
# Make the binary executable
chmod +s autoupdate
# Now change some files in your personal working copy and commit them to the repository so the executable can be tested
# Then run the executable, it should update the files that have changed since the checkout and print out which changes were made
./autoupdate

ไม่มีความคิดเห็น:

แสดงความคิดเห็น