1. 新增swap檔案, 例1024Mb的swap空間:
#dd if=/dev/zero of=/swapfile bs=1024 count=1048576
新增 / 下面 swapfile 檔 count= bs * 1024
2. format swap 檔案:
#mkswap /swapfile
3. 啟動與停止 swap:
啟動
#swapon
停止
#swapoff
4. 設定/etc/fstab, 開機時自動mount swap 區塊
#vi /etc/fstab
設定一:
/dev/sda1 swap swap defaults 0 0
/swapfile swap swap defaults 0 0
設定二:
/swapfie swap swap noatime 0 0
5.確認swap是否有啟動
1.#top
2.#free
3.#cat /proc/swap
2009年6月23日 星期二
2009年6月19日 星期五
CentOS, Fedora snmp 設定
1. 使用rpm安裝.
1.1. yum 指令:
#yum install net-snmp
1.2. 設定snmpd.conf
#vi /etc/snmp/snmpd.conf ( 預設路徑 )
寫入
rocommunity public
即可:wq存檔離開,
(此法如果防火牆未開, 任何主機皆可查詢的到你)
1.1. yum 指令:
#yum install net-snmp
1.2. 設定snmpd.conf
#vi /etc/snmp/snmpd.conf ( 預設路徑 )
寫入
rocommunity public
即可:wq存檔離開,
(此法如果防火牆未開, 任何主機皆可查詢的到你)
2009年6月15日 星期一
CentOS VNC
1.start kdm
#/etc/init.d/xfs start ( important !!!)
1.1kdm
edit option in file /etc/X11/xdm/kdmrc
[Xdmcp]Enable=1
#netstat -tunlp (check listen port shows following)
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
5920/Xtcp 0 0 :::6000 :::* LISTEN
5920/Xudp 0 0 :::177 :::*
2.vnc setting
#su "username"#vncpasswd (setting a password for vnc)
clean all words in file/home/"username"/.vnc/xstartup
#exit ( return to root )
#vi /etc/sysconfig/vncservers ( change configure for vnc login user )VNCSERVERS="2:"username""
VNCSERVERARGS[2]="-geometry 800x600 -query localhost"
(2 = port )
#/etc/init.d/vncserver start (start vnc )
ok!
3.vnc start command
#vncserver :3 (start,3 = port )
#vncserver -kill :3(stop)
modify /root/.vnc/xstartup
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title $VNCDESKTOP Desktop" &
#gnome desktopgnome-session &
#/etc/init.d/xfs start ( important !!!)
1.1kdm
edit option in file /etc/X11/xdm/kdmrc
[Xdmcp]Enable=1
#netstat -tunlp (check listen port shows following)
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
5920/Xtcp 0 0 :::6000 :::* LISTEN
5920/Xudp 0 0 :::177 :::*
2.vnc setting
#su "username"#vncpasswd (setting a password for vnc)
clean all words in file/home/"username"/.vnc/xstartup
#exit ( return to root )
#vi /etc/sysconfig/vncservers ( change configure for vnc login user )VNCSERVERS="2:"username""
VNCSERVERARGS[2]="-geometry 800x600 -query localhost"
(2 = port )
#/etc/init.d/vncserver start (start vnc )
ok!
3.vnc start command
#vncserver :3 (start,3 = port )
#vncserver -kill :3(stop)
modify /root/.vnc/xstartup
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title $VNCDESKTOP Desktop" &
#gnome desktopgnome-session &
Apache page authorization - htpaccess
1.configure the config file httpd.conf or apache.conf
#vi /etc/httpd/conf/httpd.conf
2.edit description as below
AccessFileName .htaccess
<file>
Order allow,deny
Deny from all
</files>
<directory>
AllowOverride
AuthConfig
Order allow,deny
Allow from all
</directory>
3.create authorization file(authorize path)
# vi .htaccess
content as :
AuthName "(text name)"
Authtype Basic
AuthUserFile (authorization file path)
require user (username)
4.Create user and password
#htpasswd -c (authorization file path) (username)
it can enter several user and password.
#vi /etc/httpd/conf/httpd.conf
2.edit description as below
AccessFileName .htaccess
<file>
Order allow,deny
Deny from all
</files>
<directory>
AllowOverride
AuthConfig
Order allow,deny
Allow from all
</directory>
3.create authorization file(authorize path)
# vi .htaccess
content as :
AuthName "(text name)"
Authtype Basic
AuthUserFile (authorization file path)
require user (username)
4.Create user and password
#htpasswd -c (authorization file path) (username)
it can enter several user and password.
2009年6月14日 星期日
Drop duplicate mail - Postfix
Postfix mail server praised by all technician.
but it has a small problem of using "aliases" to define email group.
For example, when someone sends mail to "jameschen" who in the group "all",
"jameschen" will receive two the same mail form the server.
because the group title "all" is "jameschan"'s alias and "jameschan" is in group "all",
So that, Posrfix thinks that is two different username and will not drop the same mail,
Even the mail which sent to "all" will translate to "jameschan".
To solve this problem, we can use "procmail" to filter duplicate mail,
Touch a execute file name ".procmailrc" content as following:
:0 Whc: msgid.lock
formail -D 8192 msgid.cache
:0 a:
/dev/null
the confiig file of Postfix "main.cf" should be write a command line
"mailbox_command = /usr/bin/procmail"
Then copy to each user home directory,
The some mail will be drop.
but it has a small problem of using "aliases" to define email group.
For example, when someone sends mail to "jameschen" who in the group "all",
"jameschen" will receive two the same mail form the server.
because the group title "all" is "jameschan"'s alias and "jameschan" is in group "all",
So that, Posrfix thinks that is two different username and will not drop the same mail,
Even the mail which sent to "all" will translate to "jameschan".
To solve this problem, we can use "procmail" to filter duplicate mail,
Touch a execute file name ".procmailrc" content as following:
:0 Whc: msgid.lock
formail -D 8192 msgid.cache
:0 a:
/dev/null
the confiig file of Postfix "main.cf" should be write a command line
"mailbox_command = /usr/bin/procmail"
Then copy to each user home directory,
The some mail will be drop.
CentOS 下把系統時區改為CST與系統對時
1. 複製台北時區設定檔為系統時間
# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
2. 與 rdate server對時
# rdate -s time.bora.net
( time.bora.net 為少數rdate server之一)
3. 設定 cron job對時
3.1. 叫出cron job 編輯畫面
# crontab -e
3.2. 寫入設定每小時對時一次
0 * * * * rdate -s time.bora.net
3.3. 儲存跳出
:wq
(crontab: installing new crontab)
如此一來就可確保系統時間的正確性了.
# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
2. 與 rdate server對時
# rdate -s time.bora.net
( time.bora.net 為少數rdate server之一)
3. 設定 cron job對時
3.1. 叫出cron job 編輯畫面
# crontab -e
3.2. 寫入設定每小時對時一次
0 * * * * rdate -s time.bora.net
3.3. 儲存跳出
:wq
(crontab: installing new crontab)
如此一來就可確保系統時間的正確性了.
One Way Trusted SSH Authorized Key
1. make public key:/.ssh]#ssh-keygen -d
2. Enter file in which to save the key (/root/.ssh/id_dsa): (just enter)
3. Enter passphrase (empty for no passphrase): (just enter)
4. Enter same passphrase again: (just enter)
5. Your identification has been saved in /root/.ssh/id_dsa.
6. Your public key has been saved in /root/.ssh/id_dsa.pub.
7. Use Scp id_dsa.pub to target remote host /.ssh/authorized_keys2
ok!
2. Enter file in which to save the key (/root/.ssh/id_dsa): (just enter)
3. Enter passphrase (empty for no passphrase): (just enter)
4. Enter same passphrase again: (just enter)
5. Your identification has been saved in /root/.ssh/id_dsa.
6. Your public key has been saved in /root/.ssh/id_dsa.pub.
7. Use Scp id_dsa.pub to target remote host /.ssh/authorized_keys2
ok!
訂閱:
文章 (Atom)

