--------------------- Apache เริ่มเลย -------------------------
กำหนด ชื่อเครื่อง หรือ DNS ให้เรียบร้อยก่อนติดตั้ง
# ee /etc/hosts
::1 localhost localhost.name.com
127.0.0.1 localhost localhost.name.com
192.168.1.10 host.name.com
#ee /etc/resolve.conf
nameserver 127.0.0.1
1 # cd /usr/ports/www/apache22
2 # make WITH_SSL_MODULES=yes WITH_THREADS=yes WITH_AUTHN_ALIAS=yes WITH_LOG_FORENSIC=yes WITH_CGI=yes WITH_USERTRACK=yes WITH_CERN_META=yes WITH_EXPIRES=yes WITH_MIME_MAGIC=yes WITH_REWRITE=yes WITH_VHOST_ALIAS=yes WITH_HEADERS=yes install clean
====== หรือ force to install
# make WITH_FORCE_PKG_REGISTER=yes WITH_SSL_MODULES=yes WITH_THREADS=yes WITH_AUTHN_ALIAS=yes WITH_LOG_FORENSIC=yes WITH_CGI=yes WITH_USERTRACK=yes WITH_CERN_META=yes WITH_EXPIRES=yes WITH_MIME_MAGIC=yes WITH_REWRITE=yes WITH_VHOST_ALIAS=yes WITH_HEADERS=yes install clean
======
3 # rehash
5 # ee /etc/rc.conf
apache22_enable="YES"
apache22_http_accept_enable="YES"
6 # cp /usr/local/etc/apache22/httpd.conf /usr/local/etc/apache22/httpd.conf-original
7 # ee /usr/local/etc/apache22/httpd.conf
ServerAdmin noomloveu@name.com ;(~140)
ServerName n1.name.com:80 ;(~149),
Include etc/apache22/extra/httpd-ssl.conf ;(~451)
!Remark
Include etc/apache22/extra/httpd-ssl.conf
¶éÒ config äÁè¶Ù¡·ÓãËé error wanning fail to start ä´é
# ee /usr/local/etc/apache22/extra/httpd-ssl.conf
ServerName host.example.com:443 ;(~78)
ServerAdmin you@example.com
SSLCertificateFile /usr/local/openssl/certs/orchid3.siamnk.net-cert.pem ;(~99)
SSLCertificateKeyFile /usr/local/openssl/certs/orchid3.siamnk.net-unencrypted-key.pem ;(~107)
== Loading the accf_http module
On FreeBSD you must load the accf_module before you can start apache,
otherwise you are sure to get an httpready error.
# kldload accf_http
If it loaded successfully then it will not give any errors or output.
To have it load on boot
#ee /boot/loader.conf
accf_http_load="YES"
== Starting Apache
ก่อน restarting หรือ starting Apache ควรใช้คำสั่ง configtest เพื่อ check errors ใน httpd.conf
# apachectl configtest
Apache is controlled with apachectl
# apachectl start
# apachectl restart
# apachectl graceful
# apachectl stop
# /usr/local/etc/rc.d/apache22 onestart
# /usr/local/etc/rc.d/apache22 restart
== Test
# telnet localhost 80
# openssl s_client -connect localhost:443
วันศุกร์ที่ 27 เมษายน พ.ศ. 2555
FreeBSD: Mysql55-Server
------------------- เริ่มเลย ------
[1] ติดตั้ง
# cd /usr/ports/databases/mysql55-server
-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ UTF8 ---------------
# make WITH_CHARSET=utf8 WITH_xCHARSET=all WITH_CALLATION=utf8_general_ci WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean
-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ tis620--------------
# make WITH_CHARSET=tis620 WITH_xCHARSET=all WITH_CALLATION=tis620_thai_ci WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean
************************************************************************
Remember to run mysql_upgrade (with the optional --datadir= flag)
the first time you start the MySQL server after an upgrade from an
earlier version.
************************** ผลการติดตั้ง ***********************************
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.mysql.com/
------------------------ ตรวจสอบผลการติดตั้ง ------------------
-- ตรวจสอบ user ที่มีขึ้นมาใหม่
# cat /etc/passwd
mysql:*:88:88:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin
-- ตรวจสอบ Package ที่ติดตั้ง
# pkg_info |grep mysql
mysql-client-5.1.48 Multithreaded SQL database (client)
mysql-server-5.1.48 Multithreaded SQL database (server)
--------------------- Config [system] -------------
# ee /etc.rc.conf
mysql_enable ="YES"
# cp /usr/local/share/mysql/my-large.cnf /etc/my.cnf
#ll /etc/my.cnf
-rw-r--r-- 1 root wheel 4649 Jul 16 06:41 /etc/my.cnf
เปลี่ยน group
# chown root:sys /etc/my.cnf
# ls -l /etc/my.cnf
-rw--r--r-- 1 root sys 4757 Oct 6 21:29 /etc/my.cnf
หรือ
# chmod 644 /etc/my.cnf
# ls -l /etc/my.cnf
-rw-r--r-- 1 root sys 4757 Oct 6 21:29 /etc/my.cnf
# rehash
--------------------- Start Mysql Deamon -------
# mysqld_safe & ; To initial MySQL daemon
#/usr/local/etc/rc.d/mysql-server start ; To start the MySQL daemon
--------------------- Monitor ---------------------
# ps waux | grep mysql ; check process
mysql 13771 0.0 0.6 3632 1352 ?? Is 7:32PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf
mysql 13851 0.0 18.0 188616 44204 ?? I 7:32PM 0:01.00 [mysqld]
# mysqlshow -p ; display database
Enter password: ; ยังไม่มี password ให้ enter ผ่าน
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
--------- Kill process ----------------
# killall mysqld
--------------------- Config [database] -----------
# mysql_install_db --user=mysql ; Installing MySQL system tables.
# mysqladmin -u root password 'password' ; To set a password for root user
# mysqladmin -u root -h n1.name.com password 'password'
----------------------------- Test-----------------------------------
# mysql -u root -p
mysql> status;
mysql> \s
mysql> create database noomdb;
mysql> grant all privileges on noomdb.* to noom@24.0.1.122;
mysql> grant usage on noomdb.* to noom@24.0.1.122 identified by 'noomdbpassword';
==== Add user ŧ㹠mysql:user table ¾ÃéÍÁ¡Ó˹´ÊÔ·¸Ô
mysql> \? add ; help for add
mysql>
mysql> use mysql
mysql> select User,Password,Grant_priv from user;
+-----------+-------------------------------------------+------------+
| User | Password | Grant_priv |
+-----------+-------------------------------------------+------------+
| root | *85E26B8AB29FEE8453201A3511DAE24A24059109 | Y |
| root | | Y |
| root | | Y |
| root | | Y |
| | | N |
| | | N |
+-----------+-------------------------------------------+------------+
mysql> update user set password=password('password') where user='root';
mysql> flush privileges;
mysql> grant all on *.* to noomloveu@localhost identified by 'password';
mysql> grant all on *.* to noomloveu identified by 'password';
mysql> grant all on *.* to noomloveu@localhost;
mysql> update user set grant_priv='Y' where user='noomloveu';
mysql> select User,Password,Grant_priv from user;
+-----------+-------------------------------------------+------------+
| User | Password | Grant_priv |
+-----------+-------------------------------------------+------------+
| root | *85E26B8AB29FEE8453201A3511DAE24A24059109 | Y |
| root | | Y |
| root | | Y |
| root | | Y |
| | | N |
| | | N |
| noomloveu | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |Y |
+-----------+-------------------------------------------+------------+
[1] ติดตั้ง
# cd /usr/ports/databases/mysql55-server
-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ UTF8 ---------------
# make WITH_CHARSET=utf8 WITH_xCHARSET=all WITH_CALLATION=utf8_general_ci WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean
-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ tis620--------------
# make WITH_CHARSET=tis620 WITH_xCHARSET=all WITH_CALLATION=tis620_thai_ci WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean
************************************************************************
Remember to run mysql_upgrade (with the optional --datadir=
the first time you start the MySQL server after an upgrade from an
earlier version.
************************** ผลการติดตั้ง ***********************************
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.mysql.com/
------------------------ ตรวจสอบผลการติดตั้ง ------------------
-- ตรวจสอบ user ที่มีขึ้นมาใหม่
# cat /etc/passwd
mysql:*:88:88:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin
-- ตรวจสอบ Package ที่ติดตั้ง
# pkg_info |grep mysql
mysql-client-5.1.48 Multithreaded SQL database (client)
mysql-server-5.1.48 Multithreaded SQL database (server)
--------------------- Config [system] -------------
# ee /etc.rc.conf
mysql_enable ="YES"
# cp /usr/local/share/mysql/my-large.cnf /etc/my.cnf
#ll /etc/my.cnf
-rw-r--r-- 1 root wheel 4649 Jul 16 06:41 /etc/my.cnf
เปลี่ยน group
# chown root:sys /etc/my.cnf
# ls -l /etc/my.cnf
-rw--r--r-- 1 root sys 4757 Oct 6 21:29 /etc/my.cnf
หรือ
# chmod 644 /etc/my.cnf
# ls -l /etc/my.cnf
-rw-r--r-- 1 root sys 4757 Oct 6 21:29 /etc/my.cnf
# rehash
--------------------- Start Mysql Deamon -------
# mysqld_safe & ; To initial MySQL daemon
#/usr/local/etc/rc.d/mysql-server start ; To start the MySQL daemon
--------------------- Monitor ---------------------
# ps waux | grep mysql ; check process
mysql 13771 0.0 0.6 3632 1352 ?? Is 7:32PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf
mysql 13851 0.0 18.0 188616 44204 ?? I 7:32PM 0:01.00 [mysqld]
# mysqlshow -p ; display database
Enter password: ; ยังไม่มี password ให้ enter ผ่าน
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
--------- Kill process ----------------
# killall mysqld
--------------------- Config [database] -----------
# mysql_install_db --user=mysql ; Installing MySQL system tables.
# mysqladmin -u root password 'password' ; To set a password for root user
# mysqladmin -u root -h n1.name.com password 'password'
----------------------------- Test-----------------------------------
# mysql -u root -p
mysql> status;
mysql> \s
mysql> create database noomdb;
mysql> grant all privileges on noomdb.* to noom@24.0.1.122;
mysql> grant usage on noomdb.* to noom@24.0.1.122 identified by 'noomdbpassword';
==== Add user ŧ㹠mysql:user table ¾ÃéÍÁ¡Ó˹´ÊÔ·¸Ô
mysql> \? add ; help for add
mysql>
mysql> use mysql
mysql> select User,Password,Grant_priv from user;
+-----------+-------------------------------------------+------------+
| User | Password | Grant_priv |
+-----------+-------------------------------------------+------------+
| root | *85E26B8AB29FEE8453201A3511DAE24A24059109 | Y |
| root | | Y |
| root | | Y |
| root | | Y |
| | | N |
| | | N |
+-----------+-------------------------------------------+------------+
mysql> update user set password=password('password') where user='root';
mysql> flush privileges;
mysql> grant all on *.* to noomloveu@localhost identified by 'password';
mysql> grant all on *.* to noomloveu identified by 'password';
mysql> grant all on *.* to noomloveu@localhost;
mysql> update user set grant_priv='Y' where user='noomloveu';
mysql> select User,Password,Grant_priv from user;
+-----------+-------------------------------------------+------------+
| User | Password | Grant_priv |
+-----------+-------------------------------------------+------------+
| root | *85E26B8AB29FEE8453201A3511DAE24A24059109 | Y |
| root | | Y |
| root | | Y |
| root | | Y |
| | | N |
| | | N |
| noomloveu | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |Y |
+-----------+-------------------------------------------+------------+
FreeBSD: Name Server
ขั้นตอนกำหนดค่า Name Server
1. ตรวจสอบ ว่าติดตั้ง Name Server แล้วหรือยัง (ปกติ จะมีติดตั้งมาพร้อมกับ OS)
# named -v
BIND 9.8.1-P1
---------- สำหรับ ป้องกันคำสั่ง make ไม่ไให้ build BIND เป็น base version --------------------
กรณีที่ rebuild FreeBSD จาก source
#cp /etc/make.conf /etc/make.conf-original
#echo "NO_BIND = YES" >> /etc/make.conf
------------- Backup config file ------------------
# cd /var/named/etc/namedb
# cp named.conf named.conf-original
-------------- กำหนดชื่อแบบ Local host ------------------
#/ee /etc/hosts
::1 localhost localhost.aculala.com
127.0.0.1 localhost localhost.aculala.com
------------ Generate Key ให้กับ Name Server ----------
# rndc-confgen -a
# cat rndc.key >> named.conf
--------------- กำนด ชื่ออ้างอิงและที่อยู่ไฟล์อ้างอิง -------
# ee /var/named/etc/namedb/named.conf
// line 21 comment
// listen-on { 127.0.0.1; };
//line (~43-47)
forwarders {
8.8.8.8; 203.144.255.71; 203.144.255.71;
};
// ------- เพิ่ม Zone file ท้ายไฟล์
zone "name.com" {
type master;
file "/etc/namedb/master/name.com";
allow-transfer { localhost; };
allow-update { key rndc-key; };
};
zone "1.0.24.in-addr.arpa" {
type master;
file "/etc/namedb/master/name.com.rev";
allow-transfer { localhost; };
allow-update { key rndc-key; };
};
-----------------------------------------------
# cd /var/named/etc/namedb/master
# ee name.com
$TTL 3600
name.com. IN SOA n1.name.com. root.name.com. (
1 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
;DNS Servers
name.com. IN NS n1.name.com.
;Machine Names
n1.name.com. IN A 24.0.1.25
;Aliases
www IN CNAME n1.name.com.
;MX Record
name.com. IN MX 10 n1.name.com.
------------ Reverse lookup file --------------------------------------
# ee name.com.rev
$TTL 3600
1.0.24.in-addr.arpa. IN SOA n1.name.com. root.name.com. (
1 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
;DNS Servers
1.0.24.in-addr.arpa. IN NS n1.name.com.
;Machine IPs
11 IN PTR n1.name.com.
11 IN PTR www.name.com.
----------------------------------------------------------------------
# cd /var/named/etc/namedb/master
# cp name.com ../dynamic
# cp name.com.rev ../dynamic
# chown -R bind /var/named/etc/namedb/dynamic
------------ กำหนดชื่อ Domain Name Server สำหรับการค้นหาชื่อ Domain
# ee /etc/resolv.conf
domain noomloveu.com
nameserver 127.0.0.1
nameserver 24.0.1.1
nameserver 8.8.8.8
------------ สั่งให้ Start Name Server เมื่อ Boot เครื่อง -------------
#echo named_enable="YES" >> /etc/rc.conf
# /etc/rc.d/named onestart
# /etc/rc.d/named status
------------ทดสอบ ---------------------
# dig google.com
; <<>> DiG 9.8.1-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26857
;; flags: qr rd; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 106 IN A 173.194.38.130
google.com. 106 IN A 173.194.38.131
google.com. 106 IN A 173.194.38.132
google.com. 106 IN A 173.194.38.133
google.com. 106 IN A 173.194.38.134
google.com. 106 IN A 173.194.38.135
google.com. 106 IN A 173.194.38.136
google.com. 106 IN A 173.194.38.137
google.com. 106 IN A 173.194.38.142
google.com. 106 IN A 173.194.38.128
google.com. 106 IN A 173.194.38.129
;; Query time: 43 msec
;; SERVER: 24.0.1.1#53(24.0.1.1)
;; WHEN: Fri Apr 27 00:12:09 2012
;; MSG SIZE rcvd: 204
# dig name.com axfr
1. ตรวจสอบ ว่าติดตั้ง Name Server แล้วหรือยัง (ปกติ จะมีติดตั้งมาพร้อมกับ OS)
# named -v
BIND 9.8.1-P1
---------- สำหรับ ป้องกันคำสั่ง make ไม่ไให้ build BIND เป็น base version --------------------
กรณีที่ rebuild FreeBSD จาก source
#cp /etc/make.conf /etc/make.conf-original
#echo "NO_BIND = YES" >> /etc/make.conf
------------- Backup config file ------------------
# cd /var/named/etc/namedb
# cp named.conf named.conf-original
-------------- กำหนดชื่อแบบ Local host ------------------
#/ee /etc/hosts
::1 localhost localhost.aculala.com
127.0.0.1 localhost localhost.aculala.com
------------ Generate Key ให้กับ Name Server ----------
# rndc-confgen -a
# cat rndc.key >> named.conf
--------------- กำนด ชื่ออ้างอิงและที่อยู่ไฟล์อ้างอิง -------
# ee /var/named/etc/namedb/named.conf
// line 21 comment
// listen-on { 127.0.0.1; };
//line (~43-47)
forwarders {
8.8.8.8; 203.144.255.71; 203.144.255.71;
};
// ------- เพิ่ม Zone file ท้ายไฟล์
zone "name.com" {
type master;
file "/etc/namedb/master/name.com";
allow-transfer { localhost; };
allow-update { key rndc-key; };
};
zone "1.0.24.in-addr.arpa" {
type master;
file "/etc/namedb/master/name.com.rev";
allow-transfer { localhost; };
allow-update { key rndc-key; };
};
-----------------------------------------------
# cd /var/named/etc/namedb/master
# ee name.com
$TTL 3600
name.com. IN SOA n1.name.com. root.name.com. (
1 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
;DNS Servers
name.com. IN NS n1.name.com.
;Machine Names
n1.name.com. IN A 24.0.1.25
;Aliases
www IN CNAME n1.name.com.
;MX Record
name.com. IN MX 10 n1.name.com.
------------ Reverse lookup file --------------------------------------
# ee name.com.rev
$TTL 3600
1.0.24.in-addr.arpa. IN SOA n1.name.com. root.name.com. (
1 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
;DNS Servers
1.0.24.in-addr.arpa. IN NS n1.name.com.
;Machine IPs
11 IN PTR n1.name.com.
11 IN PTR www.name.com.
----------------------------------------------------------------------
# cd /var/named/etc/namedb/master
# cp name.com ../dynamic
# cp name.com.rev ../dynamic
# chown -R bind /var/named/etc/namedb/dynamic
------------ กำหนดชื่อ Domain Name Server สำหรับการค้นหาชื่อ Domain
# ee /etc/resolv.conf
domain noomloveu.com
nameserver 127.0.0.1
nameserver 24.0.1.1
nameserver 8.8.8.8
------------ สั่งให้ Start Name Server เมื่อ Boot เครื่อง -------------
#echo named_enable="YES" >> /etc/rc.conf
# /etc/rc.d/named onestart
# /etc/rc.d/named status
------------ทดสอบ ---------------------
# dig google.com
; <<>> DiG 9.8.1-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26857
;; flags: qr rd; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 106 IN A 173.194.38.130
google.com. 106 IN A 173.194.38.131
google.com. 106 IN A 173.194.38.132
google.com. 106 IN A 173.194.38.133
google.com. 106 IN A 173.194.38.134
google.com. 106 IN A 173.194.38.135
google.com. 106 IN A 173.194.38.136
google.com. 106 IN A 173.194.38.137
google.com. 106 IN A 173.194.38.142
google.com. 106 IN A 173.194.38.128
google.com. 106 IN A 173.194.38.129
;; Query time: 43 msec
;; SERVER: 24.0.1.1#53(24.0.1.1)
;; WHEN: Fri Apr 27 00:12:09 2012
;; MSG SIZE rcvd: 204
# dig name.com axfr
วันจันทร์ที่ 23 เมษายน พ.ศ. 2555
FreeBSD: Kernel compile
Kernel compile
ตรวจ Kernel source ว่ามีหรือไม่:
1. ดูว่ามีไดเรคทรอรี /usr/src/sys หรือไม่ ถ้าไม่มีให้ติดตั้ง
# cd /usr/src/sys/i386/conf/
# mkdir /root/kernels
# cp GENERIC /root/kernels/NewKernel
# ln -s /root/kernels/NewKernel
2. แก้ไข option ที่ต้องการให้รองรับ สำหรับ Kernel ใหม่
# ee NewKernel
#cpu I486_CPU
#cpu I586_CPU
cpu I686_CPU
ident Kernel_with_NAT
#<-- ถ้าต้องการเพิ่ม option NAT
options IPDIVERT # enable NAT
#<<-- Firewall
options IPFIREWALL # enable Firewall
options IPFIREWALL_VERBOSE # ipfw logging
options IPFIREWALL_VERBOSE_LIMIT=120 # limit to 120 identical log entri
options IPFIREWALL_DEFAULT_TO_ACCEPT #
options IPFIREWALL_FORWARD # port forward
options MROUTING
options QUOTA
options HZ=100 # origial HZ=1000 : reduce high CPU consume
options DEVICE_POLLING
#<-- ถ้าต้องการเพิ่ม Traffic Shaping
options DUMMYNET
options ALTQ
options ALTQ_CBQ # class Bases Queuing(CBQ)
options ALTQ_RED # Random Early Detection (RED)
options ALTQ_RIO # RED in/out
options ALTQ_HFSC # Hierachical Packet Scheduler (HFSC)
options ALTQ_PRIQ # Priority Queuing(PRIQ)
options ALTQ_NOPCC # Required for SMP build
#<-- ถ้าต้องการเพิ่ม Packet Filter
device pf
device pflog
device pfsync
----------------------------------------------------------------------
เริ่ม Compile
# config NoomKernel
# cd /usr/src/sys/i386/compile/NewKernel
# make; make install
# make cleandepend && make depend
# reboot
# uname -a
FreeBSD a1.aculala.com 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Thu Jul 21 12:54:15 ICT 2011
pee@a1.aculala.com:/usr/src/sys/i386/compile/NewKernel i386
ตรวจ Kernel source ว่ามีหรือไม่:
1. ดูว่ามีไดเรคทรอรี /usr/src/sys หรือไม่ ถ้าไม่มีให้ติดตั้ง
# cd /usr/src/sys/i386/conf/
# mkdir /root/kernels
# cp GENERIC /root/kernels/NewKernel
# ln -s /root/kernels/NewKernel
2. แก้ไข option ที่ต้องการให้รองรับ สำหรับ Kernel ใหม่
# ee NewKernel
#cpu I486_CPU
#cpu I586_CPU
cpu I686_CPU
ident Kernel_with_NAT
#<-- ถ้าต้องการเพิ่ม option NAT
options IPDIVERT # enable NAT
#<<-- Firewall
options IPFIREWALL # enable Firewall
options IPFIREWALL_VERBOSE # ipfw logging
options IPFIREWALL_VERBOSE_LIMIT=120 # limit to 120 identical log entri
options IPFIREWALL_DEFAULT_TO_ACCEPT #
options IPFIREWALL_FORWARD # port forward
options MROUTING
options QUOTA
options HZ=100 # origial HZ=1000 : reduce high CPU consume
options DEVICE_POLLING
#<-- ถ้าต้องการเพิ่ม Traffic Shaping
options DUMMYNET
options ALTQ
options ALTQ_CBQ # class Bases Queuing(CBQ)
options ALTQ_RED # Random Early Detection (RED)
options ALTQ_RIO # RED in/out
options ALTQ_HFSC # Hierachical Packet Scheduler (HFSC)
options ALTQ_PRIQ # Priority Queuing(PRIQ)
options ALTQ_NOPCC # Required for SMP build
#<-- ถ้าต้องการเพิ่ม Packet Filter
device pf
device pflog
device pfsync
----------------------------------------------------------------------
เริ่ม Compile
# config NoomKernel
# cd /usr/src/sys/i386/compile/NewKernel
# make; make install
# make cleandepend && make depend
# reboot
# uname -a
FreeBSD a1.aculala.com 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Thu Jul 21 12:54:15 ICT 2011
pee@a1.aculala.com:/usr/src/sys/i386/compile/NewKernel i386
FreeBSD: Ports update โดย CSUP
1. สำรองไฟล์ config เดิมเก็บไว้
# cp /usr/share/examples/cvsup/ports-supfile /usr/share/examples/cvsup/ports-supfile-ori
2. แก้ไข Server ที่จะดาวโหลดไฟล์
# ee /usr/share/examples/cvsup/ports-supfile
เช่น
*default host=cvsup.sg.FreeBSD.org
*default host=cvsup5.jp.FreeBSD.org
ดูเซิร์ฟเวอร์ทั้งหมดได้จาก
http://www.freebsd.org/doc/en/books/handbook/cvsup.html.
ping -c 5 cvsup5.jp.freebsd.org
อัพเดท Ports
To update the ports collection
# csup -g -L 2 /usr/share/examples/cvsup/ports-supfile
# rehash
# cp /usr/share/examples/cvsup/ports-supfile /usr/share/examples/cvsup/ports-supfile-ori
2. แก้ไข Server ที่จะดาวโหลดไฟล์
# ee /usr/share/examples/cvsup/ports-supfile
เช่น
*default host=cvsup.sg.FreeBSD.org
*default host=cvsup5.jp.FreeBSD.org
ดูเซิร์ฟเวอร์ทั้งหมดได้จาก
http://www.freebsd.org/doc/en/books/handbook/cvsup.html.
ping -c 5 cvsup5.jp.freebsd.org
อัพเดท Ports
To update the ports collection
# csup -g -L 2 /usr/share/examples/cvsup/ports-supfile
# rehash
FreeBSD: Install บน VirtualBox แบบ Text mode
[1] บูทเครื่องจากแผ่นติดตั้งใน VirtualBox
เลือกติดตั้งแบบ Text Mode
1. Thailand
2. USA (ISO)
3. Standard installation
4. standard install a standard MBR (No Boot Manager)
5. Create patition
5.1 A = entire disk
c = create (all size = 165)
q = quit
5.2 Standard Install a standard MBR (no boot manager)
A = Create patition
c = create (all size = 165)
q = quit
สร้าง Partition (โดยประมาณ)
/ 768M
swap 512M
/tmp 512M
/var 768M
/usr 8G
6. Choose distribution
Custom
[x] base
[x] kernels
[x] Document --> EN
[x] man
[x] src --> all --> ยกเว้น game
[x] ports
7. Choose Installation Media
CD/DVD
ตอบคำถามระหว่างติดตั้ง
Last Chance:
Yes :Ethernet Adapter
No :IPV6
No :DHCP
Yes :Brink interface up
No :machine to be a network gateway
No :would like to configure inetd and network services
YES :enable SSH (secure shell) login
No :anonymous FTP access to this machine
No :Fuction as an NFS Server
No :Fuction as an NFS client
Yes :Customize console setting
Yes :Time zone
No : CMOS
- Asia
- 44 Thailand
Yes :Set Clock to UTC ?
No : enable Linux binary compatibility
Yes : browse the applications
YES : add a user account.
member groups = [wheel] ; to allow the user to become root/administrator
No : Visit the general configuration menu for a chance to set any last options ?
[exit install]
ตรวจสอบหลังติดตั้ง
ตรวจสอบเนื้อที่ ฮาร์ดดิส
# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 859M 172M 618M 22% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1d 496M 12K 456M 0% /tmp
/dev/ad0s1f 19G 1.4G 16G 8% /usr
/dev/ad0s1e 989M 534K 910M 0% /var
บางครั้งติดตั้งใน virtual box แล้ว CPU ของเครื่อง Peak ให้เพิ่มคำสั่ง แล้ว reboot เครื่องใหม่
#ee /boot/loader.conf
kern.hz=100
เลือกติดตั้งแบบ Text Mode
1. Thailand
2. USA (ISO)
3. Standard installation
4. standard install a standard MBR (No Boot Manager)
5. Create patition
5.1 A = entire disk
c = create (all size = 165)
q = quit
5.2 Standard Install a standard MBR (no boot manager)
A = Create patition
c = create (all size = 165)
q = quit
สร้าง Partition (โดยประมาณ)
/ 768M
swap 512M
/tmp 512M
/var 768M
/usr 8G
6. Choose distribution
Custom
[x] base
[x] kernels
[x] Document --> EN
[x] man
[x] src --> all --> ยกเว้น game
[x] ports
7. Choose Installation Media
CD/DVD
ตอบคำถามระหว่างติดตั้ง
Last Chance:
Yes :Ethernet Adapter
No :IPV6
No :DHCP
Yes :Brink interface up
No :machine to be a network gateway
No :would like to configure inetd and network services
YES :enable SSH (secure shell) login
No :anonymous FTP access to this machine
No :Fuction as an NFS Server
No :Fuction as an NFS client
Yes :Customize console setting
Yes :Time zone
No : CMOS
- Asia
- 44 Thailand
Yes :Set Clock to UTC ?
No : enable Linux binary compatibility
Yes : browse the applications
YES : add a user account.
member groups = [wheel] ; to allow the user to become root/administrator
No : Visit the general configuration menu for a chance to set any last options ?
[exit install]
ตรวจสอบหลังติดตั้ง
ตรวจสอบเนื้อที่ ฮาร์ดดิส
# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 859M 172M 618M 22% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1d 496M 12K 456M 0% /tmp
/dev/ad0s1f 19G 1.4G 16G 8% /usr
/dev/ad0s1e 989M 534K 910M 0% /var
บางครั้งติดตั้งใน virtual box แล้ว CPU ของเครื่อง Peak ให้เพิ่มคำสั่ง แล้ว reboot เครื่องใหม่
#ee /boot/loader.conf
kern.hz=100
วันศุกร์ที่ 20 เมษายน พ.ศ. 2555
สมัครสมาชิก:
บทความ (Atom)