How I setup an rsync daemon on CentOS5.

How I setup an rsync daemon and used it between Fedora 5 and CentOS5:

How to start daemon on server you want to sync with:

rsync –daemon –config=/usr/local/etc/rsyncd.conf # two dashes

What is in the /usr/local/etc/rsyncd.conf. Not the most secure, but it is a start:
uid = root
gid = root
use chroot = no
max connections = 4
hosts allow 192.168.0.4
syslog facility = local5
pid file = /var/run/rsyncd.pid

[opt]
path = /opt
comment = Opt directory

[home]
path = /home
comment = Home directory

[varwww]
path = /var/www
comment = Web directories

[varspoolmail]
path = /var/spool/mail
comment = Mail spool directory

How to initate and update any changes while preserving modification times, owner, and group. Also, recursive.

On the server you want to sync to:

rsync -ptrogu rsync://servername:/directory /directory

/proc/cpuinfo document

Source for the information below.

Viewing /proc/cpuinfo will display what type of processor your system is running including the number of CPUs present.

A breakdown of the items you should look for are the following:

* processor – Provides each processor with an identifying number. If you have one processor it will display a 0. If you have more than one processor it will display all processor information separately counting the processors using zero notation.

* cpu family – Authoritatively tells you the type of processor you have in the system. If your computer is an Intel-based system, simply place the number in front of “86” to determine the value. This is helpful to determine the type of architecture of an older system and is helpful in determining which compiled RPM package would best suit that system.

* model name – Gives you the common name of the processor, including the project name.

* cpu MHz – Shows the processor’s precise speed, in megahertz, to the thousandth decimal point.

* cache size – Tells you the amount of level 2 memory cache available to the processor.

* flags – Defines a number of different processor attributes, such as the presence of a floating-point unit (FPU) and the ability to process MMX instructions.

Here is example output from cat /proc/cpuinfo of a system containing 2 CPUs. Note how processor 1 is displayed as ‘processor : 0’ and processor 2 is displayed as ‘processor : 1’ in the output:

processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 9
cpu MHz : 2793.076
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips : 5587.89
clflush size : 64

/proc/meminfo document

cat /proc/meminfo
MemTotal: 2075540 kB
MemFree: 210148 kB
Buffers: 653848 kB
Cached: 827688 kB
SwapCached: 0 kB
Active: 1074788 kB
Inactive: 610512 kB
HighTotal: 1179088 kB
HighFree: 200644 kB
LowTotal: 896452 kB
LowFree: 9504 kB
SwapTotal: 2096472 kB
SwapFree: 2096280 kB
Dirty: 104 kB
Writeback: 0 kB
AnonPages: 203784 kB
Mapped: 60056 kB
Slab: 164348 kB
SReclaimable: 147348 kB
SUnreclaim: 17000 kB
PageTables: 5352 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 3134240 kB
Committed_AS: 679184 kB
VmallocTotal: 114680 kB
VmallocUsed: 4188 kB
VmallocChunk: 110128 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 4096 kB

Source for the information below.

Below you find the individual values we will discuss. First we will discuss the high-level statistics.
High-Level Statistics

* MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code)
* MemFree: Is sum of LowFree+HighFree (overall stat)
* MemShared: 0; is here for compat reasons but always zero.
* Buffers: Memory in buffer cache, mostly useless as metric nowadays
* Cached: Memory in the pagecache (diskcache) minus SwapCache
* SwapCache: Memory that once was swapped out, is swapped back in, but is still in the swapfile. (If memory is needed it does not need to be swapped out AGAIN because it is already in the swapfile. This saves I/O.)

Detailed Level Statistics – VM Statistics

VM splits the cache pages into “active” and “inactive” memory. The idea is that if you need memory and some cache needs to be sacrificed for that, you take it from inactive since that is expected to be not used. The VM checks what is used on a regular basis and moves stuff around.

When you use memory, the CPU sets a bit in the pagetable and the VM checks that bit occasionally. Based on that, it can move pages back to active. Within active, there is an order of “longest ago not used” (roughly – it is a little more complex in reality). The longest-ago used ones can get moved to inactive. Inactive is split into two in the above kernel (2.4.18-24.8.0). Some have it three.

* Active: Memory that has been used more recently and usually not reclaimed unless absolutely necessary.
* Inact_dirty: Dirty means “might need writing to disk or swap.” Takes more work to free. Examples might be files that have not been written to yet. They are not written to memory too soon in order to keep the I/O down. For instance, if you are writing logs, it might be better to wait until you have a complete log ready before sending it to disk.
* Inact_clean: Assumed to be easily freeable. The kernel will try to keep some clean stuff around always to have a bit of breathing room.
* Inact_target: Just a goal metric the kernel uses for making sure there are enough inactive pages around. When exceeded, the kernel will not do work to move pages from active to inactive. A page can also get inactive in a few other ways, e.g. if you do a long sequential I/O, the kernel assumes you are not going to use that memory and makes it inactive preventively. So you can get more inactive pages than the target because the kernel marks some cache as “more likely to be never used” and lets it cheat in the “last used” order.

Memory Statistics

* HighTotal: is the total amount of memory in the high region. Highmem is all memory above (approx) 860MB of physical RAM. Kernel uses indirect tricks to access the high memory region. Data cache can go in this memory region.
* LowTotal: The total amount of non-highmem memory.
* LowFree: The amount of free memory of the low memory region. This is the memory the kernel can address directly. All kernel datastructures need to go into low memory.
* SwapTotal: Total amount of physical swap memory.
* SwapFree: Total amount of swap memory free.
* Committed_AS: An estimate of how much RAM you would need to make a 99.99% guarantee that there never is OOM (Out Of Memory) for this workload. Normally the kernel will overcommit memory. That means, say you do a 1GB malloc, nothing happens, really. Only when you start USING that malloc memory you will get real memory on demand and just as much as you use. So you sort of take a mortgage and hope the bank does not go bust. Other cases might include when you mmap a file that is shared only when you write to it and you get a private copy of that data. While it normally is shared between processes. The Committed_AS is a guesstimate of how much RAM/swap you would need worst-case.

To update timezone to support DST on RedHat systems.

To verify the current 2007 timezone settings.

#zdump -v /etc/localtime | grep 2007

————————————————————————————————————–

/etc/localtime.orig Sun Apr 1 09:59:59 2007 UTC = Sun Apr 1 01:59:59 2007 PST isdst=0 gmtoff=-28800
/etc/localtime.orig Sun Apr 1 10:00:00 2007 UTC = Sun Apr 1 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime.orig Sun Oct 28 08:59:59 2007 UTC = Sun Oct 28 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime.orig Sun Oct 28 09:00:00 2007 UTC = Sun Oct 28 01:00:00 2007 PST isdst=0 gmtoff=-28800
————————————————————————————————————–

cd /usr/local/src

mkdir tzdata2007c

Downloaded the following ftp://elsie.nci.nih.gov/pub/tzdata2007c.tar.gz.

Here is the version I used:
Updated time zone source files.

wget ftp://elsie.nci.nih.gov/pub/tzdata2007c.tar.gz

tar -zxvf tzdata2007c.tar.gz
zic -d /tmp/zoneinfo northamerica
cd /tmp/zoneinfo/

Verify the compiled timezone files are correct:

zdump -v /tmp/zoneinfo/PST8PDT | grep 2007

————————————————————————————————————–

/tmp/zoneinfo/PST8PDT Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/tmp/zoneinfo/PST8PDT Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/tmp/zoneinfo/PST8PDT Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/tmp/zoneinfo/PST8PDT Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800
————————————————————————————————————–
cd /usr/share/zoneinfo/
cp -p PST8PDT PST8PDT.orig
cp /tmp/zoneinfo/PST8PDT .
cd America/
cp -p Los_Angeles Los_Angeles.orig
cp /tmp/zoneinfo/PST8PDT Los_Angeles

Verify the copied files are correct:

zdump -v /usr/share/zoneinfo/PST8PDT | grep 2007

————————————————————————————————————–

/usr/share/zoneinfo/PST8PDT Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/usr/share/zoneinfo/PST8PDT Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/PST8PDT Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/PST8PDT Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800

————————————————————————————————————–

zdump -v /usr/share/zoneinfo/America/Los_Angeles | grep 2007

————————————————————————————————————–

/usr/share/zoneinfo/America/Los_Angeles Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/usr/share/zoneinfo/America/Los_Angeles Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/America/Los_Angeles Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/usr/share/zoneinfo/America/Los_Angeles Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800

————————————————————————————————————–

cp -p localtime localtime.orig
ln -fs /usr/share/zoneinfo/PST8PDT localtime

Verify the currently set timezone is correct:
zdump -v /etc/localtime | grep 2007

————————————————————————————————————–

/etc/localtime Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/etc/localtime Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800
————————————————————————————————————–

Fedora/CentOS/Redhat Enterprise Linux – yum hangs

Here is the procedure I have used to fix yum when it hangs. Usually, I will find one or more of the following kinds of rpm processes “running”:

# ps -ef | grep rpm
root 27265 26840 0 Feb05 ? 00:00:00 awk -v progname=/etc/cron.daily/rpm progname {????? print progname “:\n”????? progname=””;???? }???? { print; }

The first thing I do is cancel or kill my yum processes. Then, I kill all the running rpm processes using the following:

# killall -9 -r “.*rpmq.*”

Next, I remove all the __ files in the /var/lib/rpm directory:

# cd /var/lib/rpm
# ls
Basenames __db.000 __db.002 Dirnames Group Name Providename Pubkeys Requireversion Sigmd5
Conflictname __db.001 __db.003 Filemd5s Installtid Packages Provideversion Requirename Sha1header Triggername
# rm _*
rm: remove regular empty file `__db.000′? y
rm: remove regular file `__db.001′? y
rm: remove regular file `__db.002′? y
rm: remove regular file `__db.003′? y

Then, rebuild the rpm database:

# rpm –rebuilddb

I usually clean out the yum cache files by running the following:

# yum clean all

Protected: Commands, notes, and misc information (linux, Unix and Windows).

This content is password protected. To view it please enter your password below:

Postfix/amavisd perfomance – server crash

Yesterday, I had interesting mail problem that I believe is still occurring today only on a much smaller scale. One on my servers crashed a couple times. I believe this is because the server was overloaded trying to process too many mail messages at once.

I ended up having to add the following line to main.cf on both of my mail servers:

smtp-amavis_destination_concurrency_limit = 2

I found this in the amavisd documentation for a postfix installation. I never went into the performance tweaks documented. I had about 200 messages queued up on my secondary server. Whenever, I tried to process them, my primary server got pounded. I decided to process the couple messages that looked legitimate, and delete all the others. So far, with the new settings mentioned above and deleting the pending unimportant messages in the secondary queue, things have been working fine. I guess I should RTFM a bit more on postfix and amavisd. Especially, since I am running these domains on older hardware.

Howto Install linux via grub.

What I used to install FC6 on the dell4100, from the information found on the
web below my write up.

1) Copy vmlinuz and initrd from isolinux directory on the first CD,
to /boot of the machine you want to install on.
2) Create grub entry on the machine you want to install on.
title Fedora Core 6 Install
kernel /vmlinuz-fc6install
initrd /initrd-fc6install.img
3) Setup up FTP, NFS or HTTP install location.
4) Boot installation target, and choose Fedora Core 6 Install.
5) When prompted, select the method that you setup in step 3.

How I setup install to use HTTP:
1) Copied the install to a common directory by mounting each CD using You
can overwrite on not overwrite the file prompted about. They are not
important or are the same:
mount -t iso9660 -o loop FC-6-i386-disc1.iso /mnt/tmp
cp -r /mnt/tmp/* /home/FC6
2) After all the CDs are copied, set the permissions to:
drwxr-xr-x 7 root root 4096 Oct 25 09:59 FC6

chown -R 755 /home/FC6
3) Create link in web server directory:
lrwxrwxrwx 1 root root 10 Oct 25 10:11 FC6 -> /home/FC6/

cd /var/www/html
ln -s /home/FC6

============================================================================

From the web:

1. Loopmount diskboot.img
2. Copy vmlinuz and initrd.img (with unique names) to your /boot directory
3. Configure grub (you should be on grub with RH7.3) to boot from the
copied kernel
4. At boot time type ‘linux askmethod’ and you’ll get to specify the
CDROM

I used this method to install FC3 online. Just downloaded the boot.iso
and chose ‘ftp’ as the install method…

or

1. Copy boot.iso to your hard disk
2. Configure grub to boot from the iso [0]
3. At boot time type ‘linux askmethod’ and you’ll get to specify the
CDROM

This assumes that there is a suitable scsi driver available in the
initrd.img. If not, you can go about it this way.

1. copy the contents of the CDs to the hard disk (second and subsequent
CDs’ rpm files go in the RPMS directory copied from the first CD
2. Use either of the above boot methods and specify ‘hard disk’ as the
source.

NB. Make sure you copy the CD contents to a filesystem that is _not_
going to be formatted at install time otherwise there’ll be nothing
there for the installer to use!

Conor

[0] Booting direct from an iso is mentioned here:
http://www.linux.ie/lists/pipermail/ilug/2005-February/022062.html

Basically, it’s:

grub> chainloader hd(0,0)/image.iso
grub> boot

Conor Daly

The loopmount is so you can get at the vmlinuz and initrd.img that you’re
going to use to boot from. Where did you get the files you copied? When
you say you modified grub.conf, do you mean to say you changed the
existing boot config rather than adding an extra one? Ooops! You’ll be
able to boot your original system in any case by using the grub shell at
boot time. My RH9 grub.conf has two sections, one to boot the system and
one to boot the FC3 installer (I plugged the spare disk into this machine
to start the install…). Each section looks like this:

title Red Hat Linux (2.4.20-8)
root (hd0,0)
kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda1 hdc=ide-scsi
initrd /boot/initrd-2.4.20-8.img
title Fedora Core 3 install
root (hd0,0)
kernel /boot/vmlinuz-FC3-install text askmethod
initrd /boot/initrd-FC3-install.img

The “Red Hat Linux” section boots my main kernel and your main kernel will
look similar but with different version numbers. The “Fedora Core 3
install” section boots the installer’s kernel instead. You need to modify
your grub.conf so that you have both sections. This actually won’t matter
once the upgrade happens since it will overwrite your grub.conf but, in
the meantime…

Since you can’t boot your RH7.3 kernel at present, you can go about things
two ways. 1. Boot interactively using grub. 2. Boot the installer,
mount your current partitions, edit grub.conf and reboot.

1. Interactively using grub
o boot the machine, at the grub screen, press ‘e’ to edit
o select the ‘kernel’ line and press ‘e’ again to edit
o Set the kerenl line to the correct vmlinuz-… root=/dev/hd… and press

o select the ‘initrd’ line and press ‘e’ to edit
o set the initrd line to the correct initrd… and press
o press ‘b’ to boot
o once booted, edit /etc/grub.conf to include correct values.

2. Using the FC installer
o boot the machine, at the grub screen, press ‘e’ to edit
o select the ‘kernel’ line and press ‘e’ again to edit
o remove the ‘askmethod’ keyword and instead type ‘rescue’ and press

o press ‘b’ to boot
o once booted, it should tell you where your original system is mounted
it may even do a chroot
o edit /etc/grub.conf to include correct values.
o type ‘exit’ to reboot.

That should get you back to being able to boot your RH7.3 system. Of
course, you could just go ahead and run the FC3 installer and do the
system upgrade…

Conor`

Conor Daly

Domestic Sysadmin 🙂
———————
Hobbiton.cod.ie
10:34:05 up 2 days, 21:54, 1 user, load average: 0.04, 0.03, 0.00

Return top

INFORMATION