某些時候想要重建yum server的repository,要保持套件群組的關係,要依照下面作法
[1] server
cp /var/ftp/pub/VT/repodata/comps-rhel5-vt.xml /tmp/comps-rhel5-vt.xml
rm -rf /var/ftp/pub/VT/repodata/
rm -rf /var/ftp/pub/VT/.olddata
createrepo -g /tmp/comps-rhel5-vt.xml /var/ftp/pub/VT
備註:
如果沒有照上述重建,xml檔仍會產生出來,yum install也沒問題,但在GUI進行套件工具時
群組的關係會全部跑掉
[2] client
yum clean
server重建後,cleint應該要重新跟server取得xml的內容,所以要clean
2010年6月6日 星期日
2010年6月2日 星期三
initsript
在某些原因下,有些自己寫的程式不想放在/etc/init.d下當一個 service來啟動
而是放在/etc/inittab中來啟動
但此時如果要對這個daemon程式進行系統調整時,會有困難
例如ulimit的控制項
因為一般我們指令在執行ulimit都是當下狀況,在bash下產生的效果
而要讓這個ulimit發生效果之前,其實透過/etc/inittab啟動的程式,早就起來了
也就是先後順序的問題
所以應該要找到一個比/etc/inittab啟動前更早的東西來執行
原本是想,把這個daemon用一個scripts包起來
而這個daemon執行之前,先執行ulimit -n 8192(例如要把openfiles上限開到8192)
結果.....殘念,不知為何不能生效
後來才發現有一個叫 initscript的東西,可以man initscript來看看
也新增一個/etc/initscript來讓init在執行/etc/inittab前先執行/etc/initscript
這樣就能有效讓ulimit生效了
預設沒有/etc/initscript這個檔案,可以man initscript的內容,拿來新增這個檔案
#man initscript
:
:
#
# initscript Executed by init(8) for every program it
# wants to spawn like this:
#
# /bin/sh /etc/initscript
#
# Set umask to safe level, and enable core dumps.
umask 022
ulimit -c 2097151
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
# Increase the hard filedescriptor limit for all processes
# to 8192. The soft limit is still 1024, but any unpriviliged
# process can increase it’s soft limit up to the hardlimit
# with "ulimit -Sn xxx" (needs a 2.2.13 or later Linux kernel).
ulimit -Hn 8192
# Execute the program.
eval exec "$4"
先把他存到/etc/initscript
然後,修改ulimit -Hn 8192成為ulimit -n 8192即可
eval exec "$4"這行不可以漏掉,否則/etc/inittab會沒執行到
#ls -l /etc/initscript
-rw-r--r-- 1 root root 581 6¤ë 17 2009 /etc/initscript
2010年5月26日 星期三
因為windows安裝使得 RHEL的grub設定失效
經常有一個經驗是當我安裝好Linux(RHEL)後
想在同一台機器再安裝另外一個OS(Windows)
結果裝好時,開機選單卻沒有Linux
原因很簡單,當然是開機選單不再走MBR了
所以這時候,在MBR還存在下
1.用linux rescue mode進入後,讓file system自動mount在/mnt/sysimage
2.chroot /mnt/sysimage,可以發現硬碟裡的linux資料都出現且位置都對
先別高興,這只是chroot後的假象
3.grub-install --recheck /dev/sda ,這裡/dev/sda是/boot所在的 partition磁碟代號
這個動作很掃很久,耐心等完後就完成啦
如果MBR不小心清掉了,例如
dd if=/dev/zeor of=/dev/sda bs=512 count=1
那就只能grub再灌一次了
shell> grub 用root進grub
grub> find /boot/grub/stage1
(hd0,0)
grub>root {hd0,0)
grub>setup (hd0)
grub>quit
如此再寫入MBR後再試看看開機狀況
想在同一台機器再安裝另外一個OS(Windows)
結果裝好時,開機選單卻沒有Linux
原因很簡單,當然是開機選單不再走MBR了
所以這時候,在MBR還存在下
1.用linux rescue mode進入後,讓file system自動mount在/mnt/sysimage
2.chroot /mnt/sysimage,可以發現硬碟裡的linux資料都出現且位置都對
先別高興,這只是chroot後的假象
3.grub-install --recheck /dev/sda ,這裡/dev/sda是/boot所在的 partition磁碟代號
這個動作很掃很久,耐心等完後就完成啦
如果MBR不小心清掉了,例如
dd if=/dev/zeor of=/dev/sda bs=512 count=1
那就只能grub再灌一次了
shell> grub 用root進grub
grub> find /boot/grub/stage1
(hd0,0)
grub>root {hd0,0)
grub>setup (hd0)
grub>quit
如此再寫入MBR後再試看看開機狀況
訂閱:
文章 (Atom)
文章分類
- 爬山 (3)
- 參考文章 (3)
- 鳥事 (5)
- 報稅 (1)
- AIX (2)
- ajax (1)
- BCB (3)
- C/C++ (2)
- cloudera (3)
- DISK (1)
- ftp (1)
- Fuse (2)
- gdb (2)
- hadoop (13)
- hdfs (8)
- HPC (2)
- hypertable (12)
- iOS (1)
- iscsi (1)
- JAVA (2)
- KFS (5)
- kickstart (1)
- KVM (2)
- LAMP (2)
- linux (2)
- Lion (1)
- LVM (2)
- mapreduce (3)
- mpi (3)
- mpich2 (4)
- msgpack (2)
- mysql (2)
- nfs (1)
- openmp (2)
- OS (1)
- OSX (2)
- others (5)
- PBS (1)
- performance_tuning (3)
- php (3)
- phplist (3)
- programming (27)
- REST (2)
- RHCA (6)
- rhel (13)
- rhel6 (4)
- scp (1)
- shell_scripts (2)
- snowleopard (2)
- Solaris (6)
- ssh (1)
- syslog (1)
- t-442-1 (4)
- torque (1)
- ubuntu (2)
- VNC (1)
- watercolor (5)
- windows (1)
- yum (1)
