Thursday, June 25, 2009
How to add Windows TrueType fonts easily in Linux desktop system
How do you use Windows True Type fonts in Linux or how do you install Windows TrueType fonts in Linux?
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:
fonts://
Alternatively, select Open Location? from file menu and type
fonts://
=> 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.
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:
fonts://
Alternatively, select Open Location? from file menu and type
fonts://
=> 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.
Display Microsoft fonts like in Windows in CentOS/Fedora
Staying in front of your computer for hours and hours with the default fonts can be a challenge on Linux/Unix. I, for one, can’t work properly without the Windows fonts comfort :)
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).
((http://www.osresources.com/11_6_en.html))
1. Create the system source tree:
$ su
# 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
To:
%define without_bytecode_interpreter 0
(And not the opposite!)
Save.
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
freetype-2.1.9-1.2.rf.i386.rpm freetype-devel-2.1.9-1.2.rf.i386.rpm
freetype-demos-2.1.9-1.2.rf.i386.rpm freetype-utils-2.1.9-1.2.rf.i386.rpm
#
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
ie:
/usr/share/fonts/TTF
Save.
10. Log out from Gnome/KDE and relog in. Now here’s how your fonts should look like:
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).
((http://www.osresources.com/11_6_en.html))
1. Create the system source tree:
$ su
# 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
To:
%define without_bytecode_interpreter 0
(And not the opposite!)
Save.
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
freetype-2.1.9-1.2.rf.i386.rpm freetype-devel-2.1.9-1.2.rf.i386.rpm
freetype-demos-2.1.9-1.2.rf.i386.rpm freetype-utils-2.1.9-1.2.rf.i386.rpm
#
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
ie:
Save.
10. Log out from Gnome/KDE and relog in. Now here’s how your fonts should look like:
Wednesday, June 24, 2009
Virtual IP addresses
You can add several virtual IP addresses to a physical network interface. A good starting point is to copy the interface definition file of the device you want to add a virtual IP address to.
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
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
How to create a range of ip addresses on ethx.
Create a range file in /etc/sysconfig/network-scripts
E.Q.
ifcfg-eth0-range1
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:04:75:D4:C8:F9
IPADDR_START=192.168.0.6
IPADDR_END=192.168.0.10
CLONENUM_START=1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
CLONENUM_START -- interface clone number to start using for this range. # eg "1"
Which would start at eth0:1
E.Q.
ifcfg-eth0-range1
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:04:75:D4:C8:F9
IPADDR_START=192.168.0.6
IPADDR_END=192.168.0.10
CLONENUM_START=1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
CLONENUM_START -- interface clone number to start using for this range. # eg "1"
Which would start at eth0:1
Linux wireless device parameter for AD-HOC connection
TYPE=Wireless
DEVICE=eth1
HWADDR=00:24:2b:6f:4c:9e
BOOTPROTO=none
NETMASK=255.255.255.0
DHCP_HOSTNAME=
IPADDR=192.168.0.1
GATEWAY=10.176.26.204
DOMAIN=
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
ESSID=kuttapan
CHANNEL=
MODE=Ad-Hoc
SECURITYMODE=off
RATE=auto
DEVICE=eth1
HWADDR=00:24:2b:6f:4c:9e
BOOTPROTO=none
NETMASK=255.255.255.0
DHCP_HOSTNAME=
IPADDR=192.168.0.1
GATEWAY=10.176.26.204
DOMAIN=
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
ESSID=kuttapan
CHANNEL=
MODE=Ad-Hoc
SECURITYMODE=off
RATE=auto
Installing Broadcom BCM4312 802.11b/g on centos
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:
# tar -xvzf hybrid-portsrc-x86_32_5_10_27_6.tar.gz
hybrid-portsrc-x86_32_5_10_27_6.tar.gz
lib
Makefile
src
Wait..........
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
#define TYPEDEF_BOOL
Now build the Loadable Kernel Module (LKM) like so:
# make -C /lib/modules/`uname -r`/build M=`pwd`
built-in.o
hybrid-portsrc-x86_32_5_10_27_6.tar.gz
lib
Makefile
modules.order
Module.symvers
src
wl.ko
wl.mod.c
wl.mod.o
wl.o
# rmmod bcm43xx; rmmod b43; rmmod b43legacy
# rmmod ndiswrapper
# 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
# modprobe wl
# 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
Q. I'd like to configure my Debian box to backup two remote servers using rsnapshot software. It should make incremental snapshots of local and remote filesystems for any number of machines on 2nd hard disk located at /disk1 ( /dev/sdb2).
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
1. rsnapshot
2. rsync
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 root@remotebox1.server.com:.ssh/authorized_keys2
# scp .ssh/id_rsa.pub root@remotebox2.server.com:.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
OR
$ sudo vi /etc/rsnapshot.conf
Set snapshots root directory:
---------------------------
snapshot_root /disk1/backup/
---------------------------
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 root@remotebox1.server.com:/home/ server1/
backup root@remotebox1.server.com:/etc/ server1/
backup root@remotebox1.server.com:/webroot/ server1/
backup root@remotebox1.server.com:/var/spool/mail/ server1/
backup root@remotebox2.server.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
Output:
---------------------------
Syntax OK
---------------------------
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,
exclude_file /etc/rsnapshot.server1.conf
Append exclude file list to /etc/rsnapshot.server1.conf:
# vi /etc/rsnapshot.server1.conf
Exclude files matching pattern from backup:
---------------------------
var/lib/php/session/*
/var/spool/mail/nobody/*
cache/wp-cache-*.????
/var/logs/apache/access.log.*
/var/logs/apache/error.log.*
/linux-kernel/*
/tmp/cache/*
/var/lib/mysql/mysql.sock*
/tmp/php.socket-*
/tmp/*socket*
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:
---------------------------
#!/bin/sh
NOW=$(date +"%d-%m-%Y")
MUSER="MySQL-UserNAME" #root
MPASS="MySQL-SERVER-PASSWORD" # mypassword
MHOST="MySQL-SERVER-IP-ADDRESS" # server1
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
FILE=mysql-$db.$NOW-$(date +"%T").gz
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done
---------------------------
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.
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
1. rsnapshot
2. rsync
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 root@remotebox1.server.com:.ssh/authorized_keys2
# scp .ssh/id_rsa.pub root@remotebox2.server.com:.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
OR
$ sudo vi /etc/rsnapshot.conf
Set snapshots root directory:
---------------------------
snapshot_root /disk1/backup/
---------------------------
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 root@remotebox1.server.com:/home/ server1/
backup root@remotebox1.server.com:/etc/ server1/
backup root@remotebox1.server.com:/webroot/ server1/
backup root@remotebox1.server.com:/var/spool/mail/ server1/
backup root@remotebox2.server.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
Output:
---------------------------
Syntax OK
---------------------------
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,
exclude_file /etc/rsnapshot.server1.conf
Append exclude file list to /etc/rsnapshot.server1.conf:
# vi /etc/rsnapshot.server1.conf
Exclude files matching pattern from backup:
---------------------------
var/lib/php/session/*
/var/spool/mail/nobody/*
cache/wp-cache-*.????
/var/logs/apache/access.log.*
/var/logs/apache/error.log.*
/linux-kernel/*
/tmp/cache/*
/var/lib/mysql/mysql.sock*
/tmp/php.socket-*
/tmp/*socket*
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:
---------------------------
#!/bin/sh
NOW=$(date +"%d-%m-%Y")
MUSER="MySQL-UserNAME" #root
MPASS="MySQL-SERVER-PASSWORD" # mypassword
MHOST="MySQL-SERVER-IP-ADDRESS" # server1
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
FILE=mysql-$db.$NOW-$(date +"%T").gz
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done
---------------------------
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.
Subscribe to:
Posts (Atom)