Thursday, June 25, 2009
Fonts are very important. When you migrate from Windows XP to Linux you may miss Truetype font. TrueType is a font standard developed by Apple Computer. By 1991 Microsoft had built TrueType into the Windows 3.1 operating system. The FreeType project provides TrueType under Linux. So let us see how to backup your Windows TrueType fonts and install them in Linux.
It is quite easy to add Windows True Type fonts in Linux. First make sure you copy Windows fonts on USB pen (usually located in C:\Windows\Fonts directory) or just mount windows NTFS/FAT partition. You can copy selected or all fonts from C:\Windows\Fonts directory.
Linux Gnome desktop
=> Open your default file manger or double click Computer icon on Gnome desktop
=> Type url:
Alternatively, select Open Location? from file menu and type
=> Once window open, just drag and drop fonts into this new windows from USB pen or mounted partition. Don't forget to restart application or just logout and login again.
Having the windows fonts working on Unix systems is fairly easy, but on Red Hat-based operating systems such as CentOS or Fedora, can be a real nightmare. The most critical aspect of having the Microsoft fonts to display properly on CentOS in compiling freetype with bytecode interpreter enabled. Let’s go through this procedure.
This tutorial assumes you have the 3 most popular community repositories enabled (Karanbir Singh, Dag Wieers and Dries).
1. Create the system source tree:
# mkdir -p /usr/src/redhat/SPECS
2. Download the latest version of the Freetype source code from a CentOS repository – For instance: freetype-2.*.el5.src.rpm – To your desktop (has to have a .src.rpm extension) and install the source:
# rpm -Uvh ./Desktop/freetype-2.1.9-1.0.rf.src.rpm
3. Open the spec (make) file in a text editor:
# gedit /usr/src/redhat/SPECS/freetype.spec
And enable the bytecode interpreter changing this line:
%define without_bytecode_interpreter 1
%define without_bytecode_interpreter 0
(And not the opposite!)
4. Install some essential compilation tools and a few upgrades:
# yum install gcc-c++ rpm-build xorg-x11-deprecated-libs-devel xorg-x11-devel automake autoconf libtool zlib-devel libX11-devel
5. Build Freetype:
# cd /usr/src/redhat/SPECS
# rpmbuild -ba freetype.spec
6. Now you should have your RPMs:
# cd /usr/src/redhat/RPMS/i386 && ls
7. Install the new version of Freetype:
# rpm -Uvh --force *
8. Download the Microsoft fonts and extract them:
# mkdir /usr/share/fonts/TTF
# tar xvjpf msfonts.tbz -C /usr/share/fonts/TTF/
Download the fontconfig files and extract them into your fontconfig directory:
# tar xvjpf fontconfig.tbz -C /etc/fonts/
9. Make sure the fonts directory is listed in the fontconfig configuration file:
# gedit /etc/fonts/fonts.conf
10. Log out from Gnome/KDE and relog in. Now here’s how your fonts should look like:
Wednesday, June 24, 2009
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
You may have to modify ifcfg-eth0 to match your physical interface name.
Now you can edit the new file ifcfg-eth0:0 and specify the network settings of the virtual interface.
To make the changes take effect please restart the network services using:
service network restart
Tuesday, June 23, 2009
CLONENUM_START -- interface clone number to start using for this range. # eg "1"
Which would start at eth0:1
Download wireless package from Broadcom
Untar the file hybrid-portsrc-x86_32_5_10_27_6.tar.gz (hybrid-portsrc-x86_64_5_10_27_6.tar.gz if you’re running on a 64-bit kernel) in its own folder:
You should now see this in your directory listing:
# tar -xvzf hybrid-portsrc-x86_32_5_10_27_6.tar.gz
Before u compile...
Something missing in code:---
Without adding the following headers the compiling process exits with error
don't worry have solution here.
Add the following line to the file
Open file src/include/typedefs.h and add there the line below at header
# vim src/include/typedefs.h
Now build the Loadable Kernel Module (LKM) like so:
# make -C /lib/modules/`uname -r`/build M=`pwd`
And for good measure remove ndiswrapper modules:
# rmmod bcm43xx; rmmod b43; rmmod b43legacy
Now load the module ieee80211_crypt_tkip:
# rmmod ndiswrapper
And finally load the wl.ko module:
# modprobe ieee80211_crypt_tkip
# insmod wl.ko
Else try iwconfig
Copy the wl.ko file to /lib/modules/2.6.26-1-686/kernel/net/wireless/
# cp wl.ko /lib/modules/2.6.26-1-686/kernel/net/wireless/
Create the module dependencies:
# depmod -a
If you get no error on modprobe, then it worked perfectly! Next you have to tell your system to load the module at startup. On my debian system, I do this by editing the file /etc/modprobe.conf to include the following:
# modprobe wl
Now, reboot and you’ve got official Broadcom wifi goodness! Hooray! Ubuntu 8.10 (due out the end of this month) will have this driver bundled with it, here’s hoping that Debian will have it in its repositories soon! Of course, all the above was done on my GNU/Debian Lenny/Sid system, so let me know if you tried it out on yours and tell me how it worked for you. Cheers!
# vim /etc/modprobe.conf
# alias wlan0 wl
Need to setup Linux as router ?
Enable the ipforwarding and add the masquerade to eth0
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Monday, June 22, 2009
Debian / Ubuntu Linux Install and Configure Remote Filesystem Snapshot with rsnapshot Incremental Backup Utility
A. rsnapshot is perfect open source solution for making backups on local system. It supports both remote and local systems. From the man page:
rsnapshot saves much more disk space than you might imagine. The amount of space required is roughly the size of one full backup, plus a copy of each additional file that is changed. rsnapshot makes extensive use of hard links, so if the file doesn’t change, the next snapshot is simply a hard link to the exact same file. The following instructions are compatible with both Debian and Ubuntu Linux.
Required software / setup on local backup system
3. ssh client
4. 2nd hard disk ( RAID array is suggested) - you can also use primary hard disk
5. Password less login configured using ssh keys
6. /disk1/backup - Backup directory
7. /disk1/backup/server1 - Backup directory for remote server called server1
8. /disk1/backup/server2 - Backup directory for remote server called server2
9. /disk1/backup/localhost - Backup directory for local server
Required software on remote server
1. OpenSSH sshd server
2. Password less login configured using ssh keys
Step #1: Install rsync and rsnapshot software
Use apt-get command, enter:
$ sudo apt-get install rsync rsnapshot
Step #2: Configure passwordless login / public key based login
Type the following command
# ssh-keygen -t rsa
# scp .ssh/id_rsa.pub email@example.com:.ssh/authorized_keys2
# scp .ssh/id_rsa.pub firstname.lastname@example.org:.ssh/authorized_keys2
See how to configure RSA / DSA SSH public key based authentication.
Step #3: Configure rsnapshot utility
The configuration file is located at /etc/rsnapshot.conf. The configuration file requires tabs between elements and all drectories require a trailing slash. Just open config file using a text editor such as vi or gedit:
# vi /etc/rsnapshot.conf
$ sudo vi /etc/rsnapshot.conf
Set snapshots root directory:
Note: you must separate snapshot_root and /disk1/ by a [tab] key i.e. type snapshot_root hit [tab] key once and type /disk1/backup/. All snapshots will be stored under this root directory (/disk1/backup/).
Configure backup policy
You can make hourly, daily, weekly or monthly snapshots of local and remote systems. To make a snapshot every four hours (six times a day) and keep a second set, which are taken once a day, and stored for a seven days, enter:
interval hourly 6
interval daily 7
Feel free to adapt configuration as per your backup needs.
Specify local and remote backup directories
Find out comments that read as follows:
### BACKUP POINTS / SCRIPTS ###
You need to comment out / delete default backup directories. To make snapshots for /home/, /etc/, /webroot/ directories to /disk1/backup/localhost, enter:
backup /home/ localhost/
backup /etc/ localhost/
backup /webroot/ localhost/
To backup remote server1 /home/, /etc/, /var/spool/mail/, /webroot/ directories to /disk1/backup/server1, enter:
backup email@example.com:/home/ server1/
backup firstname.lastname@example.org:/etc/ server1/
backup email@example.com:/webroot/ server1/
backup firstname.lastname@example.org:/var/spool/mail/ server1/
backup email@example.com:/home/ server2/
Save and close the file.
Test your config file for errors
Type the following to test your configuration file for errors
# rsnapshot configtest
You can also run rsnapshot in a test mode to display its action:
# rsnapshot -t hourly
Step #4: Run rsnapshot for first time
To run first time, enter:
# rsnapshot hourly
Step #5: Configure cron job
Edit /etc/cron.d/rsnapshot file to setup backup snapshot job. This is a sample cron file for rsnapshot. The values used correspond to the examples in /etc/rsnapshot.conf. There you can also set the backup points and many other things. To activate this cron file you have to uncomment the lines below.
Feel free to adapt it to your needs.
0 */4 * * * root /usr/bin/rsnapshot hourly
30 3 * * * root /usr/bin/rsnapshot daily
0 3 * * 1 root /usr/bin/rsnapshot weekly
30 2 1 * * root /usr/bin/rsnapshot monthly
See crontab related faq for more information about cronjob under UNIX / Linux.
How do I exclude files from backup?
rsnapshot allows you to set the include and exclude parameters, if enabled, simply get passed directly to rsync. If you have multiple include/exclude patterns, put each one on a separate line. For example,
Append exclude file list to /etc/rsnapshot.server1.conf:
# vi /etc/rsnapshot.server1.conf
Exclude files matching pattern from backup:
Save and close the file.
How do I backup remote MySQL database?
You can backup default database directory /var/lib/mysql. However, you can backup remote or local MySQL database with the following script:
MPASS="MySQL-SERVER-PASSWORD" # mypassword
MHOST="MySQL-SERVER-IP-ADDRESS" # server1
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
Now add following line to /etc/rsnapshot.conf file:
backup_script /root/scripts/mysql.backup.sh server1/mysql/
How do I restore backup?
You can simply copy back file using regular scp / cp command.