Author Topic: migrate user on freebsd to freebsd os and compile kernel freebsd  (Read 10771 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
migrate user on freebsd to freebsd os and compile kernel freebsd
« on: มกราคม 23, 2011, 10:14:58 PM »
ไฟล์ที่ต้อง copy คือ

/etc/passwd
/etc/group
/etc/master.passwd

หรือถ้าเลือก user มาก็เลือกมาให้เหมือนกันด้วยน่ะครับ ทั้งสามไฟล์

เสร็จแล้วใช้คำสั่ง

pwd_mkdb -p /etc/master.passwd

เพื่อ rebuilld password .
« Last Edit: มกราคม 23, 2011, 10:27:43 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #1 on: มกราคม 23, 2011, 10:27:57 PM »
####Compile Kernel ของ FreeBSD

#ipfw show
ipfw: getsockopt(IP_FW_GET): Protocol not available

fix by แก้โดย


วันนี้มาลอง Compile Kernel ของ FreeBSD 7.0 กัน ตามนี้เลย

1.cd /usr/src/sys/i386/conf
2.cp GENERIC LAO


## edit LAO ##
เพิ่ม

options IPFIREWALL
options IPDIVERT
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPFIREWALL_FORWARD
options IPSTEALTH
options ACCEPT_FILTER_HTTP
options ACCEPT_FILTER_DATA

หลังจากเสร็จแล้ว

1.config LAO
2.cd /usr/src
3.make kernel KERNCONF=LAO
4.make installkernel KERNCONF=LAO

หลังจากนั้น แก้ /etc/rc.conf เพิ่ม

firewall_enable="YES"

firewall_type="/etc/ipfw.rules"
;
filewall_logging="YES"


แล้วอย่าลืมสร้าง ipfw.rules ล่ะครับ
หลังจากนั้นก็ Reboot เป็นอันเสร็จเรียบร้อย

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #2 on: มกราคม 23, 2011, 10:28:09 PM »
สำหรับการ config ตัว Pen ที่ใช้งานเป็น Load balance ให้พวก protocol ต่างๆ เช่น http , smtp , pop ,
imap เราต้องเปิด option "ipfilter" ใน kernel ไว้ด้วยน่ะครับ

1.cd /usr/src/sys/i386/conf
2.cp GENERIC PENBSD

options IPFILTER
options IPFILTER_LOG

หลังจากเสร็จแล้ว

1.config PENBSD
2.cd /usr/src
3.make kernel KERNCONF=PENBSD
4.make installkernel KERNCONF=PENBSD

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #3 on: มกราคม 23, 2011, 10:28:15 PM »
##update kernel from freebsd 7.0 to freebsd 7.1

ns1# freebsd-update update -r 7.1-RELEASE

ns1# freebsd-update upgrade -r 7.1-RELEASE

after finish please reboot

ns1#init 6
run install to finish
ns1# freebsd-update install

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #4 on: มกราคม 23, 2011, 10:28:47 PM »
##downgrade package in freebsd

FreeBSD Package Software Downgrade
สวัสดีครับ เจอกันอีกครั้งผมนายแจ็ค มาถึงฉบับที่ 4 แล้วนะครับ สำหรับ \"นิตยสาร ThaiAdmin
สาระแบ่งปัญสำหรับผู้ดูแลระบบ\" สำหรับ
เพื่อนๆ ที่ใช้งาน FreeBSD เป็น OS หลักในการทำงาน เคยบ้างไหมครับ ที่บางครั้งเราทำการ update ports
tree แบบ all แล้วติดตั้งซอฟแวร์
บางตัว ลงไปแล้ว แต่มาพบภายหลังว่ามี Bug หรือ ด้วยเหตุผลต่างๆ ไม่ว่าจะเป็นความเข้ากันได้ของ
ซอฟแวร์บางตัว หรือต้องการใช้ options
ที่มีอยู่ในเวอร์ชั่นเดิมๆ แล้วจำเป็นที่จะต้อง downgrade กลับไปใช้ version เก่า สำหรับปัญหานี้
ผมมีวิธีแก้อีก 1 วิธีสำหรับเป็นทางเลือก
สำหรับ FreeBSD Admin ได้นำไปประยุกต์ใช้งานกันครับ เอาละครับเริ่มกันเลย
ก่อนอื่นทำการติดตั้ง portdowngrade ก่อนครับ

# cd /usr/ports/ports-mgmt/portdowngrade/
# make DEFAULT_CVS_SERVER=\" anoncvs@anoncvs1.FreeBSD.org:/home/ncvs\"; install
clean

* ข้อสังเกตุ : ผมได้ระบุ DEFAULT_CVS_SERVER ซึ่งเป็นการระบุ anonymous cvs ครับผม ซึ่งสามารถ make
install clean เฉยๆ ซึ่ง
สามารถระบุตอนสั่ง downgrade ports ภายหลังก็ได้ แต่ผมขอระบุผ่านขั้นตอนติดตั้งเลยสะดวกดีครับ
หลังจากติดตั้งเสร็จการ downgrade สามารถสั่งง่ายๆ ครับ โดยการระบุ Category แล้วตามด้วย path ของ
ports
ที่ต้องการ downgrade
รูปแบบการสั่ง portdowngrade <portsname> <cvs server>
เช่นต้องการ ดาวน์เกรด mod_fcgid ก็สามารถระบุดังนี้
# portdowngrade www/mod_fcgid
ภาพที่ 1 แสดงข้อความตอบรับหลังจากสั่ง execute portdowngrade
หลังจากสั่งแล้วระบบจะถามว่าต้องการ connect หรือไม่ ตรงนี้ให้ตอบ yes ไปครับ จากนั้นก็จะเริ่ม connect
ไปยัง anonymous cvs และจะ
โชว์ผลลัพธ์มาให้เรา เอาละครับตรงจุดนี้ก็คือ เราสามารถเลือก version ที่จะ downgrade กลับไปได้แล้ว
โดยเลือกหมายเลข version ที่
ต้องการโดยการ Enter 1 ครั้งจากนั้นจะมีข้อความตอบกลับ
Enter version number to change port to (0: exit):
ภาพที่ 2 แสดง previous version ที่สามารถ downgrade ได้
ให้ใส่เลขหน้า เวอร์ชั่น ที่ต้องการ เช่น 2 แล้ว Enter อีกครั้ง จากนั้นระบบจะถามเพื่อความแน่ใจ
ให้เราตอบยืนยันโดยพิมพ์ yes แล้ว Enter อีก
ครั้งครับ
The port has been set to the selected version. Install it if you wish.
If you have portupgrade installed, you should run

#portsdb -Uu

now, to see the changes in the ports database. In any case

#portupgrade -f mod_fcgid

will install the changed port. Note: if you run cvsup, the port
is changed back to the choosen label!
ถ้าเจอข้อความนี้หมายถึงระบบทำการดาวน์โหลด ports version ที่เราเลือกมาแล้วครับ สามารถติดตั้งผ่าน
ports tree ได้ทันทีโดยระบบจะ
ติดตั้งเวอร์ชั่นเก่าที่เราเลือกมา โดยสามารถตรวจสอบก่อนการติดตั้งง่ายๆ โดยวิธี ตรวจ distinfo
ใช้คำสั่งดังนี้ครับ

# cat /usr/ports/www/mod_fcgid/distinfo
MD5 (mod_fcgid.2.0.tar.gz) = 3aa51f1e293e6d881028295a23021dae
SHA256 (mod_fcgid.2.0.tar.gz) = 714e2eac93807e768a8a81c9d157e02fd674eab472302211a137657c9241cef1
SIZE (mod_fcgid.2.0.tar.gz) = 274974
จะพบว่าระบบ จะแสดง ไฟล์ sourcecode เป็นเวอร์ชั่นที่เราทำการเลือกตอน downgrade สมใจอยากแล้ว
ทีนี้ถ้าจะติดตั้งก็สามารถทำได้
ปกติเหมือน ports ใน version อื่นๆ ครับ
เป็นยังไงบ้างครับสำหรับเทคนิคเล็กๆ น้อยๆ จากผมในครั้งนี้ ไม่ยากเลยใช่มั๊ยครับ

หมายเหตุ : สำหรับรายชื่อ anonymous cvs สามารถดูที่
http://www.freebsd.org/doc/en_US.ISO8859&#8208;
1/books/handbook/anoncvs.html

ขอบคุณพี่ jack แห่ง Thaiadmin ครับ

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #5 on: มกราคม 24, 2011, 11:21:08 AM »
#####change shell in freebsd bsd

#pw usermod useraccount -s /bin/sh

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: migrate user on freebsd to freebsd os and compile kernel freebsd
« Reply #6 on: สิงหาคม 16, 2015, 12:47:19 PM »
วันนี้มาลอง Compile Kernel ของ FreeBSD 10.1 กัน ตามนี้เลย ให้รองรับการทำงานของ ipfw internal firewall

1.cd /usr/src/sys/amd64/conf
2.cp GENERIC LAO


## edit LAO ##
เพิ่ม

options IPFIREWALL
options IPDIVERT
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPSTEALTH
options ACCEPT_FILTER_HTTP
options ACCEPT_FILTER_DATA

หลังจากเสร็จแล้ว

1.config LAO
2.cd /usr/src
3.make kernel KERNCONF=LAO
4.make installkernel KERNCONF=LAO

หลังจากนั้น แก้ /etc/rc.conf เพิ่ม

firewall_enable="YES"

firewall_type="/etc/ipfw.rules"
;
filewall_logging="YES"


แล้วอย่าลืมสร้าง ipfw.rules ล่ะครับ
หลังจากนั้นก็ Reboot เป็นอันเสร็จเรียบร้อย