2011年9月26日 星期一

[轉貼]CentOS 5 install ntfs-3g

先check 版本(32bit /64bit)
uname -i
安裝  rpmforge-release
http://packages.sw.be/
i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i386.rpmx86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm


可先安裝 DAG 的 GPG 金鑰
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt


審核下載的套件
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm


安裝套件
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm


安裝下列套件。
yum install fuse fuse-ntfs-3g 


若 rpmforge 軟件庫預設為停用的,
yum --enablerepo=rpmforge install fuse fuse-ntfs-3g 


如果是 CentOS 5.3 或更舊版本,那麼你需要安裝來自 ELRepo 的 kmod-fuse。


http://wiki.centos.org/zh-tw/TipsAndTricks/NTFS
http://wiki.centos.org/zh-tw/AdditionalResources/Repositories/RPMForge


2011年7月21日 星期四

讓別台主機存取MySQL

vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -i eth1 -p tcp -s 內網網段/24  --dport 3306  -j ACCEPT
-A RH-Firewall-1-INPUT -i eth0 -p tcp -s 外網網段/24  --dport 3306  -j ACCEPT



mysql -p

CREATE USER 'root'@'10.20.%.%';
GRANT ALL PRIVILEGES ON * . * TO 'root'@'10.20.%.%' IDENTIFIED BY '同localhost用的密碼';
flush privileges;

CREATE USER 'root'@'外網網段.%';
GRANT ALL PRIVILEGES ON * . * TO 'root'@'外網網段.%' IDENTIFIED BY '同localhost用的密碼';
flush privileges;

參考:
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
http://www.debianhelp.co.uk/remotemysql.htm

2011年6月24日 星期五

[轉貼]grep 包含子目錄檔案的方法

http://blog.xuite.net/jyoutw/xtech/46682931

在所有的網頁中,找出含有某特定字串的檔案。
例如說要找出含有 localhost 字串的檔案,記得 grep 沒有 recursive 的參數,可以搜尋包含子目錄
所以就要利用 find 的功能來協助

# find ./ -type f -name \*.php |xargs grep 'localhost'


用上面的方式連是哪個檔案都會列出來,若用下列的寫法,速度既慢而且也無法得知是哪個檔案有含該字串:
# find ./ -type f -name \*.php -exec grep 'localhost' {} \;
 

2011年6月12日 星期日

[轉貼]解析度過大導致螢幕黑畫面

http://www.ubuntu-tw.com/modules/newbb/viewtopic.php?topic_id=20514&viewmode=flat&order=ASC&type=&mode=0&start=0&menumode=2

(要改的東東在 wubi 的 img檔裡,還要做掛 img檔的步驟…)


按ctrl+alt+F1進入文字介面
sudo nano /etc/X11/xorg.conf
看看有沒有內容,沒有的話Ctrl+X跳出
照順序執行:
sudo /etc/init.d/gdm stop
sudo X -configure
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf
sudo nano /etc/X11/xorg.conf
到此xorg.conf已有內容,
找出"Monitor"這一個區塊
加入HorizSync和VertRefresh兩項,
數值請參照螢幕說明書找 水平同步 跟 垂直更新
然後Ctrl+X按y存檔,
最後sudo /etc/X11/gdm start

改完類似這樣:
Section "Monitor"
Identifier "Monitor0"
HorizSync 30.0 - 80.0
VertRefresh 60.0 - 75.0
EndSection

mount wubi disk

http://ubuntuforums.org/showthread.php?t=1564156

Code:
sudo mount -o loop //root.disk /mnt
nautilus /mnt   # to browse
If you have problems mounting it, you can fsck it (don't do it if you mounted it already):

Code:
sudo fsck //root.disk


http://ubuntuforums.org/showthread.php?t=1037874
Make a new text file:

Code:
#!/bin/sh
sudo mkdir -p /media/WindowsXP
echo "Mounting NTFS Partition"
sudo mount -t ntfs /dev/sda1 /media/WindowsXP
sleep 1
sudo mkdir -p /media/root.disk
echo "Mounting Wubi Disk"
sudo mount -o loop /media/WindowsXP/ubuntu/disks/root.disk /media/root.disk
sleep 1
echo "Done :)"
gksu nautilus /media/root.disk
exit 0 &
Save this as mountwubi.sh. Right click this new file, select Permissions tab and put a tick in the Execute box.

Create another text file:

Code:
#!/bin/sh
echo "Unmounting Wubi Disk"
sudo umount /media/root.disk
sleep 1
echo "Unmounting NTFS Partition"
sudo umount /media/WindowsXP
sleep 1
echo "Done :)"
exit 0 &
Save this as umountwubi.sh. Right click this new file, select Permissions tab and put a tick in the Execute box.


Double clicking mountwubi.sh and selecting Run in Terminal will mount your old wubi install and open a root nautilus for full access to the files.
The function of umountwubi.sh is pretty obvious

BloggerAds