2007年7月12日 星期四

Add firewall rules for aMule in order to get a HighID on CentOS

1. Insert iptables rules:

/sbin/iptables -I RH-Firewall-1-INPUT -p tcp --dport 4662 -j ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT -p udp --dport 4665 -j ACCEPT
/sbin/iptables -I RH-Firewall-1-INPUT -p udp --dport 4672 -j ACCEPT

2. Get the rules saved to /etc/sysconfig/iptables using iptables-save

/sbin/service iptables save

3. Restart iptables

/etc/init.d/iptables restart

2007年7月11日 星期三

Use ddclient to update dyndns automatically on CentOS

vi /etc/ddclient/ddclient.conf
some parameters have to be uncommented and set


use=web # via web
login= # default login
password= # default password

##
## dyndns.org dynamic addresses
##
## (supports variables: wildcard,mx,backupmx)
##
server=members.dyndns.org, \
protocol=dyndns2 \
yours.dyndns.org

/etc/rc.d/init.d/ddclient {start|stop|restart|status}

Set up an mp3 alarm on CentOS

1. Make sure the user who will run the alarm is not in /etc/cron.deny
2. Log in as the user then type crontab -e for editing his cron entry
# dom = Day of Month
# dow = Day of Week
# m h dom mon dow command
42 07 * * 1-5 /usr/local/bin/alarm

3. vi /usr/local/bin/alarm


# run xterm to execute mplayer in another window
# with the parameter, display 0 you can quit playing easily,
# the parameter -loop 0 means repeat forever.
/usr/bin/xterm -display :0 -bg black -fg white \
-e /usr/local/mplayer -loop 0 filename.mp3



/usr/bin/mplayer -loop 0 filename.mp3

4. Remember to give permission of execution to alarm
chmod 7xx alarm

5. An easy way to stop playing, use the command pkill

pkill mplayer

2007年7月6日 星期五

Fonts of wine disappear on CentOS

Install Microsoft's TrueType core fonts

1. Make sure you have the following rpm-packages installed
# rpm-build
# wget
# ttmkfdir
# cabextract

2. Set up an rpm build environment in your home directory by adding the line %_topdir %(echo $HOME)/rpmbuild to your $HOME/.rpmmacros and create the directories $HOME/rpmbuild/BUILD and $HOME/rpmbuild/RPMS/noarch

3.
# Build the binary rpm
rpmbuild -bb msttcorefonts-2.0-1.spec
# Install the newly built rpm (you will need to be root):
rpm -ivh $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
# Reload the X font server
/sbin/service xfs reload

2007年7月5日 星期四

Set vncserver on CentOS

1. vi /etc/sysconfig/vncservers
uncomment # VNCSERVERS="2:myusername"
2. locally log in the user you want to connect via vnc then type vncpasswd
3. vi /home/$user/.vnc/xstartup
replace "twm &" with "exec gnome-session &"
4. allow the vnc tcp port of firewall, display 2 is equal to port 5902

2007年7月2日 星期一

( fc-cache ) failed to write cache

/usr/share/fonts: failed to write cache
/usr/share/fonts/encodings/large: failed to write cache
/usr/X11/share/fonts: failed to write cache
/usr/X11/share/fonts/encodings/large: failed to write


"touch" each folder to solve it