c0mputerking's blog

Gentoo

Kernel

Rebuild Kernel

I use this way now it seems to work better than Gentoo docs
# cd /usr/src/linux
# make clean
# make
# make install

Kernel modules

Find all modules
# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko

List installed kernel modules
# lsmod Load kernel modules
# modprob modulename

Load kernel modules at boot time
# nano -w /etc/modules.autoload.d/kernel-2.6

I do not do it this way anymore
Recompile the kernel which has to be done alot in gentoo
# genkernel --menuconfig all

Recompile regular kernel
# make menuconfig
# make && make modules_install

World

Update the whole world

# emerge --sync
# emerge --update --deep --newuse world
# emerge -P --depclean you should run with the -p option first
# revdep-rebuild

Use this to update the protected /etc directory
# dispatch-conf

Packages

Basic emerge config and commands

Create these to install blocked and masked packages
# mkdir /etc/portage
# touch /etc/portage/package.keywords
# touch /etc/portage/package.unmask
# touch /etc/portage/package.mask
# touch /etc/portage/package.use

Update Packages
# emerge --sync

Search for packages
# emerge --search pdf or
# emerge --searchdesc pdf

Add packages
# emerge -va packagename or # emerge -p packagename

Remove packages
# emerge -unmerge packagename

Emerge with use flags
USE="-java" emerge seamonk

Update packages
see World or

Some Specific Packages

Zoneminder

Moving events DIR
Stop ZM
mv /var/www/html/zm/events /opt or what ever your mount point is.
ln -s /opt/events /var/www/html/zm/events
Check the you can still view existing events both stream and stills. Other wise stop here and find your permission problem (check all your logs for errors, including Apache)
Once the previous step works, start ZM.

cd /usr/src/linux
make menu config
add"Multimedia Devices", "Video 4 Linux" and some usb cams maybe?
make && make modules_install

add these to /etc/make.conf
mysql sockets apache2

add this to /etc/portage.unmask
www-misc/zoneminder
dev-perl/PHP-Serialization

emerge zoneminder

# /etc/init.d/apache2 start
# /usr/bin/mysql_install_db
# /etc/init.d/mysql start
# /usr/bin/mysqladmin -u root -h localhost password 'setapassword'
# mysql mysql -p
mysql > grant select,insert,update,delete on zoneminder.* to 'zm'@localhost identified by '22vu22';
mysql>exit

# mysqladmin -p restart
vim /etc/zm.conf change what needs to be changed
# rc-update add apache2 default
# rc-update add mysql default
# rc-update add zoneminder default

postfix

# vim /etc/mail/aliases
# /usr/bin/newaliases
add this line to main.cf
relayhost = [mx1.hostname.tdl]:325
# /etc/init.d/postfix start
# rc-update add postfix default
Also mailx must be installed for zm to send mail
# emerge mailx

Mondo Rescue
mondoarchive -OVi -d /usr/backups/mondo -E '/usr/backups/mondo /usr/backups/mondo' -p `hostname`-`date +%Y-%m-%d` ALSO you need to edit this for networking to work on new system ?? vim /etc/udev/rules.d/70-persistent-net.rules

Setup some stuff

USE VARIABLES

My current use variables

 

Some of the use variables suggested for zoneminder

a52 aac encode ieee1394 imlib ogg sdl theora truetype v4l vorbis x264 xvid aalib alsa fbcon flac ggi libcaca bzip2 gif jpeg jpeg2k mp3 png tiff mpeg vhosts

USE variables for media-video/ffmpeg

a52 - Enables support for decoding ATSC A/52 streams used in DVD
aac - Enables support for MPEG-4 AAC Audio
encode - Adds support for encoding of audio or video files eee1394 - Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
imlib - Adds support for imlib, an image loading and rendering library
ogg - Adds support for the Ogg container format (commonly used by Vorbis, Theora and flac)
sdl - Adds support for Simple Direct Layer (media library)
theora - Adds support for the Theora Video Compression Codec
truetype - Adds support for FreeType and/or FreeType2 fonts
v4l - Enables video4linux support
vorbis - Adds support for the OggVorbis audio codec
x264 - Enable h264 encoding using x264
xvid - Adds support for xvid.org's open-source mpeg-4 codec

USE variables for media-libs/libsdl

aalib - Adds support for media-libs/aalib (ASCII-Graphics Library)
alsa - Adds support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
fbcon - Adds framebuffer support for the console, via the kernel
flac - Adds support for the flac audio codec
cgi - Adds support for media-libs/libggi (non-X video api/drivers)
libcaca - Add support for colored ASCII-art graphics

USE variables for media-libs/imlib2

bzip2 - Use the bzlib compression library
gif - Adds GIF image support
jpeg - Adds JPEG image support
jpeg2k - Support for JPEG 2000, a wavelet-based image compression format
mp3 - Add support for reading mp3 files tiff - Adds support for the tiff image format

USE variables for www-misc/zoneminder

mpeg -Adds libmpeg3 support to various packages
vhosts - Adds support for installing web-based applications into a virtual-hosting environment

USING DUMP

 

#sbin/dump -0 -j -f /backuplfs.dump /dev/sda3

 

Go to the root directory


#restore rf /backuplfs.dump


 

You can often find out how much shared memory is available by typing the following :- cat /proc/sys/kernel/shmall and the most you can allocate in one go :- cat /proc/sys/kernel/shmmax To change these values type (for example) :- echo 134217728 >/proc/sys/kernel/shmall echo 134217728 >/proc/sys/kernel/shmmax However be aware that sometimes you will only need to change the shmmax value as shmall is often large enough. Also changing these values in this way is only effective until your machine is rebooted. To change them permanently you will need to edit /etc/sysctl.conf and add the following lines (for example) :- kernel.shmall = 134217728 kernel.shmmax = 134217728 Which will enforce the changes the next time your machine is restarted.

Networking
# /etc/conf.d/net
config_eth0=( "192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255" )
routes_eth0=( "default gw 192.168.1.1" )
# /etc/resolv.conf
nameserver 192.168.1.1
Stolen from here http://www.gentoo-wiki.info/HOWTO_static_ip_with_dhcp_router

lvextend -L +1G /dev/VolGroup00/LogVolVMWareXP
# resize2fs /dev/VolGroup00/LogVolVMWareXP

Moving MySQL out of /var

presuming /usr is actually a good place for it (may really want to add a
disk and make a really different partition)

First stop MySQL or reboot to single user.
Then
cd /var/db
tar cf /usr/db.tar *
cd /usr
mkdir var.db
cd var.db
tar xf ../db.tar
cd /var
mv db db.old
ln -s /usr/var.db db
Now, reboot and let MySQL start and make sure it all is happy and
works just fine.
Then clean up.
cd /usr
rm db.tar
cd /var
rm -rf db.old

It should now work using the space in /usr
You can use any names you like for db.tar, var.db, db.old. Those
just make sense to me and are the style I use.

Drupal

*UPGRADING*

BACKUPS

Site Files

cp -rp drupal-5.7 08091701.drupal57

Databases

This should already be done nightly but u can never have to many backups go here and login
http://phpmyadmin.computerking.ca/ then click export and select all databases use defaults for the rest.

MISC

*LINUX*

UBUNTU

General config tweaks

Add all the necessary evils
# apt-get install ubuntu-restricted-extras
Temp fix
# iwconfig wlan0 rate 54M
Perm fix
edit /etc/network/interfaces and add this line
pre-up iwconfig wlan0 rate 54M

Bacula

Starting bacula bat
# /usr/bin/bat -c /etc/bacula/bat.conf

Webcam setup and motion detection

*ZONEMINDER*

INSTALL ZONEMINDER

This will install all zoneminder packages #apt-get install zoneminder
Set Permissions Check For Permission Problems Like I Had With buntu 8.0.4 LTS server This will get zoneminder working #chmod 666 /dev/video0
This should be a permanent fix #chmod 4755 /usr/bin/zmfix
Apache Link to make apache work #ln -s /etc/zm.conf /etc/apache2/conf.d/zoneminder.conf
apt-get install mythzoneminder *WEBCAM* This is to get drivers working for lots of USB webcams Add these to the /etc/apt/list.sources file deb http://blognux.free.fr/ubuntu hardy main deb-src http://blognux.free.fr/ubuntu hardy main Update to get the new packages #apt-get update Get easycam 2 for gnome #apt-get install easycam2-gtk Start easycam2 for gnome #gksudo 'python /usr/share/EasyCam2/core.py --gtk' More shared memory for zone alarm add this to /etc/sysctl.conf kernel.shmmax = 134217728 Run this to adjust display settings #displayconfig-gtk apt-get install vlc

added this to my /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport  

Then set up this rule "*   smtp:[hostaddress]:325" in my transport file then hashed it with posthash to create transport.db an like magic it all works i am receiving mail

However you are stating that if i add this line to main.cf it would work the same!! seems easier but which is more correct?????

relayhost = [hostaddress]:325
make sure to leave the hostname in the []

This tells of the cgi directory error in gentoo ebuild http://www.zoneminder.com/forums/viewtopic.php?p=45543&sid=b4dd293f672f7... This is a very cool logging command for zoneminder tail -f /var/log/messages /var/log/apache2/error_log /var/log/zoneminder/zm*.log

NEW ATTEMPT

Using ZMLinux2008

these perl modules must be installed

perl -MCPAN -e shell
install Archive::Tar
install MIME::Entities
install Archive::Zip

Add this to the hostname on the email setting page action=login

 

harddisk and raid tips

Software RAID

Simulate failure

# mdadm --manage --set-faulty /dev/md2 /dev/sdc3 to set a drive to faulty simulating failure
# mdadm --detail /dev/md2 to see which drive has failed
# mdadm /dev/md2 -r /dev/sdc3 to remove the disk from the array
# mdadm /dev/md2 -a /dev/sdc3 to add it back
# cat /proc/mdstat to watch it being rebuilt

Replace entire drive

# mdadm /dev/md0 -f /dev/sda1 fail all devices on the broken drive so they can be removed from the array
# mdadm /dev/md1 -f /dev/sda2
# mdadm /dev/md2 -f /dev/sda3
# mdadm /dev/md3 -f /dev/sda4

# mdadm /dev/md0 -f /dev/sda1 remove all devices on the broken drive so the drive can be replaced
# mdadm /dev/md1 -f /dev/sda2
# mdadm /dev/md2 -f /dev/sda3
# mdadm /dev/md3 -f /dev/sda4

# shutdown -h now?? i should be able to do this hot more detail needed anyways replace broken drive

# sfdisk -d /dev/sda | sfdisk /dev/sdc this will recreate the partition table on the new drive
# fdisk -l run a check

# mdadm /dev/md0 -f /dev/sda1 add all devices back to the array new drive is installed
# mdadm /dev/md1 -f /dev/sda2
# mdadm /dev/md2 -f /dev/sda3
# mdadm /dev/md3 -f /dev/sda4

# cat /proc/mdstat for progress

LVM

Create a new lvm partition

# lvcreate -L50G -nbackups vg0
# mke2fs -j /dev/vg0/backups
# mkdir /usr/backups
# mount /dev/vg0/backups /usr/backups

 

Old

SOFTWARE RAID View mdadm status cat /proc/mdadm
To re-add a missing drive mdadm --add /dev/md0 /dev/sdb3
To replace a failed drive mdadm --fail /dev/md2 /dev/sdb3
mdadm --remove /dev/md0 /dev/sdb3
mdadm --add /dev/md0 /dev/sdb3

 

lvresize -L +200M /dev/opt_vg/opt_lv
ext2online hope this works with gentoo cause below is scary
umount -f -l /usr/
root@ns1:/home/c0mputerking# resize2fs /dev/vg/usr
resize2fs 1.38 (30-Jun-2005)
Please run 'e2fsck -f /dev/vg/usr' first.
root@ns1:/home/c0mputerking# e2fsck -f /dev/vg/usr
e2fsck 1.38 (30-Jun-2005)
/dev/vg/usr: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create<y>? yes
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg/usr: ***** FILE SYSTEM WAS MODIFIED *****
/dev/vg/usr: 74006/6553600 files (1.0% non-contiguous), 13107092/13107200 blocks
root@ns1:/home/c0mputerking# resize2fs /dev/vg/usr
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/vg/usr to 39321600 (4k) blocks.

 

use this to wipe the mbr
dd if=/dev/zero of=/dev/hda/ bs=446 count=1

Linux Ha

Linux HA new
Unpublished
Submitted by The King (not verified) on Tue, 08/12/2008 - 05:47.

* with unpack we mean deleting the source repository (if existing) and unpacking the tar.gz file that was downloaded from linux-ha.org again.
* I did not clean up this discription, but left what I have done. Hopefully I've not forgotten anything ;)

====
Download:
heartbeat 2.0.7 sources from linux-ha.org

dependancy:
build-essential (for compiler & toolchain)
pkgconfig pkg-config
glib2-devel libglib2.0-0 libglib2.0-dev
libnet libnet1 libnet1-dev

/usr/bin/ld .. -lz ..
results in: cannot find -lz...
Seems like library z is missing (what is this?)
try: zlib1g zlib1g-dev
unpack, reconfigure, resolved

Got error on xml.c: variable not used.
try: libbz2-1.0 libbz2-dev
unpack, reconfigure, resolved

Error in crm_mon.c
try: libncurses5 libncurses5-dev
unpack, reconfigure, resolved

Compilation seems to be done correctly.

make install, does work... (it seems, not really tested)

unpack again.
./ConfigureMe package
Unmet build dependencies:
debhelper debhelper
libsnmp9-dev libsnmp9 libsnmp9-dev
modutils modutils
libtool libtool
libcurl3-openssl-dev libcurl3 libcurl3-dev
libsensors-dev libsensors3 libsensors-dev
libltdl3-dev libltdl3 libltdl3-dev
swig swig
libgnutls-dev libgnutls-dev libgnutls12
python2.3-dev python2.3 python2.3-dev
libpam0g-dev libpam0g libpam0g-dev

./ConfigureMe package
Unmet build dependencies:
libxml2-dev libxml2 libxml2-dev
bison bison
flex flex
uuid-dev libuuid1 uuid-dev
libopenipmi-dev libopenipmi0 libopenipmi-dev
lynx lynx // why need this???
uuid-dev

./ConfigureMe package
failed on fakeroot: command not found

attempt installing: devscripts dh-make
./ConfigureMe package
attempt installing: fakeroot
./ConfigureMe package
Complaining about Python.h
unpack, ./ConfigureMe package

Install package python2.4-dev
Found Python.h, /usr/include/python2.3/Python.hl; /usr/include/python2.4/Python.h
Configure script seems to find the 2.4 also (if I can read sufficiently fast)

Try again:

Todo List

Invoice Graeme for Bandwidth
Invoice Mike Bro for hours of work
Call Bill Wong
Call Powell
Email volvo bertone to insurance company
Help out Junor
Upgrade drupal
Fix FTP
http://drupal.org/upgrade/preparing-the-site

Setting up a redudant Zimbra

Send an email to all users regarding disruption
become zimbra superuser
# su zimbra
# zmcontrol stop

Stop ZImbra
First i need a LVM2 partition to house /opt which contains the Zimbra files
Run fdisk -l to list the harddisks guess i will use hd4
Run pvs to find out which logical groups exist on the system
create a logical volume to house the new opt
# lvcreate -L10G -nnew-opt vg
As an example, let's extend a logical volume with 5 extra Gbytes)
# lvextend -L+5G /dev/vg/new-opt
create a filesystem on the new logical volume
# mke2fs -j /dev/vg/new-opt
Make a directory for mounting
# mkdir /new-opt
Mount
# mount /dev/vg/new-opt /new-opt/
check fstab and add this line
#/dev/vg/opt /opt ext3 noauto 0 0
Add this to /etc/drbd.conf on ALL nodes
resource zimbra {
on mx1.canmail.org{
device /dev/drbd3;
disk /dev/vg/opt;
address 66.244.200.225:7789;
meta-disk internal;
}
on ns1.computerking.ca {
device /dev/drbd3;
disk /dev/vg/opt;
address 68.144.188.169:7789;
meta-disk internal;
}
syncer {
# group 1;
}
}

used these docs extensively
http://tldp.org/HOWTO/LVM-HOWTO
http://www.gentoo.org/doc/en/lvm2.xml

Syndicate content