แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - golfreeze

Pages: 1 ... 68 69 [70] 71 72 73
1036
พอดีวันนี้ ได้ migrate mail ครับเลยเอาข้อมูลวิธี มาให้เพื่อนๆ พี่ๆ น้องๆ ดูหน่อยเผื่อจะเป็นประโยชน์
บ้าง

อิอิ
การใช้ imapcopy ในการ migrate mail ที่เป็น imap ครับโดยผ่าน perl module

ต้อง download imapcopy shell ก่อนครับโดยหาจาก google ก็ได้ชื่อ Golfinho-IMAPCopy-0.06.tar.gz
เริ่มต้นลง perl module
#perl -MCPAN -e shell
กระผมเลือกใช้ ค่า default ทั้งหมด
เสร็จแล้วทำการลง ตัว Bundle ครับ ในครั้งแรกที่มีการ ลง perl module
CPAN>install Bundle::CPAN

รอสักครู่ นานสองนาน เมื่อเสร็จแล้ว install IMAPClient Module
CPAN>install Mail::IMAPClient

ออกจาก cpan โดย
CPAN>quit
สั่งให้มัน updatedb
#updatedb
#locate IMAPCopy.pm

ทำการ copy IMAPCopy.pm_hack ไปทับไฟล์ IMAPCopy.pm ซึ่ง perl จะเรียกใช้งาน module นี้ครับ
แล้วเราก็เรียก script imapcopy
ถ้ามี user เดียวสั่งแบบนี้ เลยครับ
/usr/bin/imapcopy -from-host mail.xxx.com -from-login golfreeze -from-pass passxxx -to-host
localhost -to-login golfreeze@destination.com -to-pass passxxx -tmpdir /tmp -to-debug

ของผมมี migrate เยอะเลยใช้วิธีเขียน shell script ช่วยครับ
++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash
PATH=/sbin:/usr/sbin:/bin
export PATH

##Directory value

HOME=/mbox
USERLIST=/home/golf/imapcopy_only
ID=vmail
GID=mail


## Check user and create for dir user ##
if [ -s ${USERLIST}/userlist_seperate_test ] # if file size of new_account > 0
then
#lock account file
chown root ${USERLIST}/userlist_seperate_test
chmod 770 ${USERLIST}/userlist_seperate_test

while read account_dest
do
#Begin imapcopy change #account_ori and #account_dest
/usr/bin/imapcopy -from-host mail.xxx.com -from-login golfreeze -from-pass passxxx
-to-host
localhost -to-login golfreeze@destination.com -to-pass passxxx -tmpdir /tmp

done < ${USERLIST}/userlist_seperate_test

cat /dev/null > ${USERLIST}/userlist_seperate_test
chown root:root ${USERLIST}/userlist_seperate_test
chmod 770 ${USERLIST}/userlist_seperate_test

else
#nothing to do
exit
fi
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
สำหรับ ตัวแปร
account_ori = account ต้นทาง
account_dest = account ปลายทาง

1037
iftop คล้ายๆ กับ top ใน unix ครับ แต่ตัวนี้ จะเอาดู traffic ของ network ที่เข้ามาที่ server
###iftop
#apt-get install iftop

ใช้งานก็
#iftop

มี option ให้เลือกมากมาย
#man iftop ดูน่ะครับ

อีกตัวคือ

iptraf
#apt-get install iptraf

ดูปริมาณ traffic ที่วิ่งผ่าน การ์ดแลน ครับ
แจ่มดี อิอิ

ลองดูน่ะครับ

1038
เว็บนี้ ช่วยได้เยอะเลย

http://help.directadmin.com

มีเกือบทุกอย่าง

ผมลง webalizer เพิ่มครับ
wget -O /usr/local/bin/webalizer http://files.directadmin.com/services/freebsd6/webalizer
chmod 755 /usr/local/bin/webalizer

เสร็จแล้วไปเขียน ลง crontab ครับ
10 0 * * * root echo "action=tally&value=all" >>
/usr/local/directadmin/data/task.queue

แค่นี้แล้วลองเข้าดูเว็บ webalizer ในส่วนของ control panel ดูน่ะครับ

1039
all application on unix knowledges by golfreeze / Apache redirect code error403
« on: มกราคม 24, 2011, 11:19:53 AM »
###Redirect code on apache to file "index.php"
<meta http-equiv="refresh" content="0;
URL=http://www.redirect.com">
<meta name="keywords" content="automatic redirection">

###Ask index.html
GET /index.html HTTP/1.0

1040
Mail issue , problem , configuration / postfix vda patch ลงไปเพื่อ ??
« on: มกราคม 23, 2011, 10:26:30 PM »
ตัว vda ลงไปเพื่อ แก้รักษาโรค อะไรอ่านได้ครับ อิอิ

เป็นไทย : เวลาต้องการให้ user มี quota mailbox ของแต่ละ user ต้องลง vda patch เข้าไปช่วยกันครับผม
สำหรับการ patch ต้องเชค version ของ postfix ด้วยนะครับ
หลังจาก check version postfix เสร็จ ต้องทำการ check version ของ database ด้วยว่าใช้ตัวไหน เช่นใช้ openldap

ต้องลง vda ดังนี้
postfix-ldap_2.5.5-1.1-vda0_amd64.deb
postfix_2.5.5-1.1-vda0_amd64.deb


* Mailbox / Maildir size limit, known also as "soft quota", to avoid user take
all you disk space
* Customizable "limit" message when the soft quota limit is reached. NOTE: message
is sent to senders, but NOT to the owner of the mailbox.
* Limit only 'INBOX', because some people use IMAP and don't want the same limit in
IMAP folder that are differents from INBOX.
* Support for 'Courier' style Maildir, usefull for people that use courier as pop3/imap
server and to get fast soft quota summary. Note that it is also compatible with qmail maildir per
default.
* Supports for Courier 'maildirsize' file in Maildir folder that is used to read quotas
quickly. Note that this option is not actived per default and can be dangerous on some NFS client
implementation (like for example Solaris that cache some filesystem operations).
* Customisable suffix for Maildir support, when share same external dict between postfix and
pop3/imap server sometime "Maildir/" suffix is needed to avoid extra database handling
(eg LDAP, MySQL...).

download version ที่ใช้ได้ที่

http://vda.sourceforge.net/VDA/

apt-get build-dep postfix

cd /usr/src
apt-get source postfix

(Make sure you use the correct Postfix version in the following commands. I have Postfix 2.5.5
installed. You can find out your Postfix version by running

postconf -d | grep mail_version

The output should look like this:

server1:/usr/src# postconf -d | grep mail_version
mail_version = 2.5.5
milter_macro_v = $mail_name $mail_version
server1:/usr/src#

)

wget http://vda.sourceforge.net/VDA/postfix-2.5.5-vda-ng.patch.gz
gunzip postfix-2.5.5-vda-ng.patch.gz
cd postfix-2.5.5
patch -p1 < ../postfix-2.5.5-vda-ng.patch
dpkg-buildpackage

dpkg -i postfix_2.5.5-1.1_i386.deb postfix-mysql_2.5.5-1.1_i386.deb

ต้องดูให้ตรง กับ รุ่น os ที่ใช้ด้วยน่ะครับ ว่าเป็น 32 bit or 64 bit

1041
pop00:/home/golf/___script___# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
user golfs@example.com
+OK Password required.
pass PASSGU
+OK logged in.
LIST
+OK POP3 clients that break here, they violate STD53.
1 1326
2 467
.
RETR 1
+OK 1326 octets follow.
Return-Path: < postmaster@example.com>;
Delivered-To: golfs@example.com
Received: from ldap00.xx.com (ldap00.th.xx.com [10.17.200.22])
by pop00.xx.com (Postfix) with ESMTP id D4B374C8069
for < golfs@example.com>;; Tue, 10 Nov 2009 17:57:00 +0700 (ICT)
Received: from ldap00.xx.com (localhost [127.0.0.1])
by ldap00.xx.com (Postfix) with ESMTP id F14376DF824
for < golfs@example.com>;; Tue, 10 Nov 2009 17:57:00 +0700 (ICT)
Received: (from www@localhost)
by ldap00.xx.com (8.14.3/8.14.3/Submit) id nAAAv0NL085397;
Tue, 10 Nov 2009 17:57:00 +0700 (ICT)
(envelope-from postmaster@example.com)
Date: Tue, 10 Nov 2009 17:57:00 +0700 (ICT)
X-Authentication-Warning: ldap00.xx.com: www set sender to postmaster@example.com using -f
To: golfs@example.com
Subject: Welcome to xx mail service
Message-ID: < 1257850620883_36a8e9eb903b074f4fa6ca13c8395ab9@116.68.150.233>;
X-Mailer: Phamm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: < postmaster@xx.com>;


Welcome to ddd service!
-----------------------------------------------

Dear users,

Thank you for using ddd service.

Please kindly consider change your password periodically for your security.



.
quit
+OK Bye-bye.

1042
####### Linux ##########
ต้องการที่จะเปลี่ยน ip ผ่าน command ครับ
#####check interface
#mii-tools

#route del default gw 10.x.x.x
#route add default gw 192.x.x.x

หรือต้องการให้ network บางตัว route ออกไปคนละ gateway ก็

#route add -net 10.3.0.0/16 gw 10.3.0.1


##############################

##### FREEBSD #######

ถ้าเป็น default gateway แอดด้วย command นี้
#route add default -gateway 10.x.x.x

แต่ถ้ามี subnet ของวงนั้นๆ ด้วย แอดด้วย command
route delete -net 0.0.0.0
route add -net 0.0.0.0 -gateway 192.x.x.x

#######################

1043
ปกติการ Implement ระบบพวก mail ครับ function หนึ่งที่ไม่ควรข้ามไปคือการ เทส ban หรือ block เมลที่
spam และ virus วันนี้เลยมาแนะนำข้อความเพื่อเอาไปใช้ เทสครับ

##Virus email for testing
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

ใส่ข้อความใน message แล้วลองเทสดูได้เลยครับ

##spam email for testing block spam function
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

ลองนำไปใช้งานดูนะครับ

1044
    โจทย์ ใช้ MTA : Postfix
    OS : Freebsd
    ครับ

    จะ set ให้ บาง user= golf@example.com สามารถส่งเมลออกไป domain ข้างนอกไม่ได้ (Ex.
    golfreeze@hotmail.com , sss@yahoo.com )
    แต่ว่ามีให้ user= golfreeze@example.com ส่งได้ จะต้อง set อย่างไงบ้าง

    ก่อนอื่นต้องทำความเข้าใจก่อนว่า ไฟล์ไหนของ postfix ทำงานอย่างไร ทำงานอะไร

    ในกรณีนี้ เราต้องแก้ไขที่ไฟล์ main.cf ครับ

    เพิ่มในส่วนของ

    ###Allow some user sending email off-site #####
    smtpd_sender_restrictions=check_sender_access hash:/usr/local/etc/postfix/sender_restrictions
    smtpd_restriction_classes = local_only
    local_only =
    check_recipient_access hash:/usr/local/etc/postfix/local_domains, reject
    ##### End of Config ########

    แล้วทำการแอด mail account ที่จะใช้กับ policy check_sender_access นีัครับ

    #vi /usr/local/etc/postfix/sender_restrictions
    golf@example.com local_only

    #postmap /usr/local/etc/postfix/sender_restrictions

    #vi /usr/local/etc/postfix/local_domains
    เพิ่ม domain ที่จะให้บังคับใช้งาน policy นี้
    example.com OK
    #postmap /usr/local/etc/postfix/local_domains

    แล้วทำการ restart postfix 1 รอบ แล้วลองส่งดูครับ

    smtp00# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 smtp.packetlove.com ESMTP Postfix
    helo e
    250 smtp.packetlove.com
    ehlo e
    250-smtp.packetlove.com
    250-PIPELINING
    250-SIZE 102400000
    250-ETRN
    250-AUTH LOGIN
    250-AUTH=LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    mail from: golf@example.com
    250 2.1.0 Ok
    rcpt to: golfreeze@hotmail.com
    554 5.7.1 < golf@example.com>;: Sender address rejected: Access denied
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.

    ### ใช้งานได้แล้ว ###

m_golfreeze.gif golfreeze [2009-12-08 15:54:50] mail not show 116.68.146.74

1

Comment : 1

    ### อ่านเพิ่มเติมได้ที่

    http://www.postfix.org/RESTRICTION_CLASS_README.html#external

1045
สำหรับสาวก Postfix ครับ

วันนี้มี tools สำหรับเช๊ค email stat traffic มาฝากกันครับ ซึ่งผมได้ลองใช้มาสักพักใหญ่ๆ รู้สึกชอบ
อิอิ

ตัว stat traffic ตัวนี้จะเอา log ของ mail log มาทำการวิเคราะห์นะครับ ซึ่งจะมีปริมาณ การรับ การส่ง
เมลในแต่ละวัน ซึ่งเป็นเมลที่ drop reject หรือ ban ก็ดูได้หมดครับ หรือจะดูเป็น stat ย้อนหลังก็ได้

#freebsd
Packetlove# make search name="pflogsumm"
Port: pflogsumm-1.1.2,1
Path: /usr/ports/mail/pflogsumm
Info: Postfix Log Entry Summarizer
Maint: flo@kasimir.com
B-deps: perl-5.8.9_3
R-deps: p5-Bit-Vector-7.1 p5-Carp-Clan-6.04 p5-Date-Calc-6.3 perl-5.8.9_3
WWW: http://jimsun.LinxNet.com/postfix_contrib.html

install โดย
#cd /usr/ports/mail/pflogsumm
#make install clean

crontab รันโดย
#crontab -e

45 11 * * * /usr/local/bin/pflogsumm -d today /var/log/maillog | /usr/bin/mailx -s "`uname -n` daily mail stats" receiver@email.com

=========================================

##Debian

#apt-get install pflogsumm

แล้วก็รันใน crontab ดังนี้ครับ

#crontab -e
45 11 * * * /usr/sbin/pflogsumm -d today /var/log/mail.log | /usr/bin/mailx -s "`uname -n` daily mail stats" receiver@email.com

โดยที่ receiver@email.com คือ emailปลายทางที่จะให้ระบบgen stat ส่งไปนะครับ

ยังไงก็ลองใช้กันดูนะครับ อิอิ

1046
ไฟล์ที่ต้อง copy คือ

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

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

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

pwd_mkdb -p /etc/master.passwd

เพื่อ rebuilld password .

1047
#on debian
bonnie++ -d /path_check -s 8192 -r 2048 -n 512 -u 0:0

1048
ปกติเรา สามารถ gen (.csr) request ssl cert ได้

ปกติแล้วผมจะใช้ openssl command ครับจัดยังไงนั้นไปดูกันเลย

โดยเริ่มสั่ง ตามนี้

ทำการสร้างคีย์ Key สำหรับ SSL ที่เป็น Key length ขนาด 2048 bit เพราะทาง NIST องค์กรจัดเรื่อง Key ssl
แนะนำให้ใช้เป็นขนาด 2048 bit ก่อน Jan 2014 เพื่อความปลอดภัยครับ ทำไมถึงเป็นเช่นนั้นจะอธิบายต่อไปในกระทู้ล่างๆ ครับผม
และก็ทำให้ support sha256

#openssl req -new -newkey rsa:2048 -nodes -sha256 -out web.csr
ใส่ข้อมูลต่างๆ ลงไปเช่น พวก ประเทศ ที่อยู่ office

ในกรณีถ้าไม่ได้ ไปซื้อ cert เพื่อความน่าเชื่อถือแล้ว แต่ว่าแค่ gen ใช้ในเครื่องก็สามารถ gen crt
ได้ดังนี้ ครับ
#openssl x509 -req -sha256 -days 365 -in /root/server.csr -signkey /root/server.key -out /root/server.crt
#/usr/bin/openssl req -x509 -sha256 -days 9000 -nodes -newkey rsa:4096 -keyout /etc/exim.key -out /etc/exim.cert

แล้ว copy ไปใน path ที่ไฟล์ extra/httpd-ssl.conf เรียกใช้งานดังนี้

SSLCertificateFile "/usr/local/etc/apache22/server.crt"
SSLCertificateKeyFile "/usr/local/etc/apache22/server.key"

เสร็จทำการ restart apache 1 ครั้ง
#/usr/local/etc/rc.d/apache22 restart

เสร็จแล้วลอง เข้าไปดู ข้อมูลใน certificate ได้ครับ

ถ้าจะสร้างเป็นแบบ SAN cert ที่มีหลายชื่อ ให้ใช้แบบนี้ครับ
#openssl req -new -newkey rsa:2048 -nodes -sha256 -out web.csr -config san.cnf

โดยที่ใน san.cnf มี configure ดังนี้
[ req ]
default_bits       = 2048
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
countryName = TH
countryName_default = TH
stateOrProvinceName = Bangkok
stateOrProvinceName_default = Bangkok
localityName = Pakkred
localityName_default = Pakkred
organizationalName = Packetlove
organizationalName_default = Packetlove
organizationalUnitName = IT
organizationalUnitName_default = IT
commonName                 = golfreeze.com
commonName_max = 64

[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1   = 2golfreeze2.com
DNS.2   = prim.com
DNS.3   = pkl.com
DNS.4   = domain4.com

1049
Lab by golfreeze

#Install DRBD+NFS+HA in debian4.0 R1(AMD64bit)

#ลง drbd ทั้งสองเครื่อง
# apt-get install drbd0.7-module-source
# apt-get install drbd0.7-utils
# apt-get install dpatch
# cd /usr/src
# tar -zxf drbd0.7.tar.gz
# cd /usr/src/modules/drbd
# module-assistant prepare
==press to intall module
# module-assistant automatic-install drbd0.7-module-source
ลง drbd0.7 module
# cd /usr/src
# dpkg -i drbd0.7-module-2.6.18-5-amd64_0.7.21-4+2.6.18.dfsg.1-13etch6_amd64.deb

##Config /etc/drbd.conf ทั้ง 2 เครื่อง
resource r0 {
protocol C;
incon-degr-cmd \"halt -f\";
startup {
degr-wfc-timeout 120;
}
disk {
on-io-error detach;
}
net {
}
syncer {
rate 20M;
group 1;
al-extents 257;
}
on host-a {
device /dev/drbd0;
disk /dev/hda8;
address 10.0.0.10:7789;
meta-disk internal;
}
on host-b {
device /dev/drbd0; แทนdevice ที่จะทำการ mount เข้าเป็น device drbd
disk /dev/sda8; แทน disk ที่จะทำการ Mount เพื่อเก็บเป็น data file server
address 10.0.0.20:7789;
meta-disk /dev/sda7[0]; แทนdisk ที่เก็บ meta-disk ควรสร้างให้ 512M เพราะปกติมันเก็บ
256M
}
}

จัดการลบ fstab ของ /dev/sda8 และ /dev/sda7 ออกจาก /etc/fstab ด้วย ลบทั้ง 2 host เลย
#cp /etc/fstab /etc/fstab.ori
แล้ว umount ออกด้วยเพราะว่าเมื่อ start drbd แล้วมันจะ mount ให้เองอัตโนมัติ
#umount /dev/sda8
#umount /dev/sda7


สั่งให้ drbd ทำงานทั้ง 2 ตัว
# /etc/init.d/drbd start




สั่งให้ เครื่อง DRBD0 ทำงานเป็น \\\"Primary\\\" node ได้
# drbdadm primary all
# drbdsetup /dev/drbd0 primary --do-what-I-say
#modprobe drbd (ทั้งสองเครื่อง)

ทำการสร้าง partition ที่ primary node ที่เดียว
# mke2fs /dev/drbd0
# mkdir -p /mbox/export
# mount /dev/drbd0 /mbox/export
#df -h
แล้วลอง copy ข้อมูลใส่ดู
/dev/drbd0 44G 52M 41G 1% /mbox
#ทำการลง Heartbeat ทั้ง สองเครื่องดังนี้
#apt-get install heartbeat
เพิ่ม config เข้าไปให้ทั้ง สองเครื่อง

#vi /etc/ha.d/ha.cf
debugfile /var/log/ha-debug #เอาไว้ debug ดู error
logfile /var/log/ha-log
logfacility local0
keepalive 2
#deadtime 30 # USE THIS!!!
deadtime 10
#auto_failback on
bcast eth1 #card interface ไหนที่จะให้ใช้งาน
node DRBD0 DRBD1 #มี host อะไรบ้าง


#vi /etc/ha.d/haresources ทั้งสองเครื่องเหมือนกันเพราะ จะให้เครื่อง DRBD0 เป็น primary
DRBD0 IPaddr::10.0.1.169/23/eth1 drbddisk::r0 Filesystem::/dev/drbd0::/mbox::ext2
nfs-kernel-server


#vi /etc/ha.d/authkeys
auth 3
3 md5 kammatanmeditation
#chmod 600 authkeys



#/etc/init.d/heartbeat start
แล้วสั่ง #cat /proc/drbd ก็จะขึ้นแบบนี้ แปลว่าทำงานแล้วครับ
DRBD0:/home/golf# cat /proc/drbd
version: 0.7.21 (api:79/proto:74)
SVN Revision: 2326 build by root@DRBD0, 2008-01-16 01:50:05
0: cs:StandAlone strimary/Secondary ld:Consistent
ns:17 nr:0 dw:33 dr:807319 al:0 bm:492 lo:0 pe:0 ua:0 ap:0
ดู virtual-ip ที่ heartbeat สร้างขึ้นมาก็
#ip addr sh
3: eth1: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:14:5e:fb:fa:26 brd ff:ff:ff:ff:ff:ff
inet 10.0.1.154/23 brd 10.0.1.255 scope global eth1
inet 10.0.1.169/23 brd 10.0.1.255 scope global secondary eth1:0

----------------------------------------------------------------------------------------------------



----------------------------
ส่วนในการทำ test สำหรับ check ว่าข้อมูล sync กับเครื่อง slave หรือไม่โดยการถอดสายแลน เครื่อง master
ออกก่อน
แล้วก็ไปดูที่เครื่อง slave มันก็จะ take virtual ip ไปครับ

Check state ได้คือ
#drbdadm state all
ถ้าออกมาเป็น
Primary /secondary
ก็แสดงว่าเครื่องนั้นรันเป็น primary node อยู่

หรือจะดูเป็น real time คือ
#watch \"cat /proc/drbd\"
ก็ได้ครับ

เสร็จทำการลงเป็น nfs-kernel-server ทั้งสองเครื่อง
#apt-get install nfs-kernel-server

ทำการ ลบ init ของ nfs-kernel-server(ทั้งสองเครื่อง) ป้องกันการมีปัญหาในการ
รีสตาร์ตเครื่องแล้ว เกิด error
โดย
#update-rc.d -f nfs-kernel-server remove

เข้าไปแก้ config ของ nfs-kernel-server ที่
#vi /etc/exports
ครับ

1050
พอดี วันนี้ลง os (debian) แล้วกดเร็วไปหน่อยครับ

ไม่ได้เลือกให้ create swap ให้ สำหรับวิธีแก้ปัญหานั้นไม่ยากครับ

หลักการก็คือสร้าง swap file ขึ้นมาแล้วเขียนเข้าไปที่ ไฟล์ rc.local ซึ่งให้มันอ่านตอน boot ทุกครั้ง
ก็จะมี virtual mem ขึ้นมาใช้งานได้แบบ ปกติครับ

สำหรับ ขั้นตอนนั้นลองมาดูเลยครับ

#swapon #ตรวจดูพื้นที่ swap ครับ
สร้าง swap ขนาด 2G ครับ
#dd if=/dev/zero of=/var/swapfile bs=2048 count=2048000
#mkswap /var/swapfile
#swapon /var/swapfile

เสร็จแล้วก็ ลอง top ดูครับก็จะมี swap ขึ้นมาแล้วครับ

ถ้าจะให้มัน create swap ขึ้นมาทุกครั้งที่ boot เครื่องก็
#vi /etc/rc.local
/bin/dd if=/dev/zero of=/var/swapfile bs=2048 count=2048000
/sbin/mkswap /var/swapfile
/sbin/swapon /var/swapfile

เท่านี้เวลา restart server ก็จะทำการเพิ่ม swap ให้ทำงานขึ้น หลังจาก boot เข้า os ครับผม : )
--------------------------------------------------------
step by golfreeze[at]packetlove.com

Pages: 1 ... 68 69 [70] 71 72 73