แสดงบทความที่มีป้ายกำกับ gentoo แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ gentoo แสดงบทความทั้งหมด

วันศุกร์ที่ 10 กันยายน พ.ศ. 2553

Gentoo prebuilt package installation

With gentoo, you can customize every packages you want because gentoo give that choices to you. Emerge, package manager, will built package for you from source code. However, compiling package in gentoo can be very time-consuming task, Especially, when you have more gentoo system. I have found option of emerge that can build package and you can use this prebuilt package to other system.

(1) build package
#quickpkg mysql
- This will build package from files on your system. If the package you wanna built are on the system already.


#emerge -b mysql
-the -b(--buildpkg) option tell emerge to do additional task when installing package to the system.

*In this case(mysql), the prebuilt package will be available in /usr/portage/packages/dev-db/ directory.

(2) use prebuilt package
Place the prebuilt package in appropriate directory, in this case : /usr/portage/packages/dev-db/
#emerge --usepkgonly mysql

For more information please consult the man page :
#man emerge
#man quickpkg
#man make.conf

วันพุธที่ 4 สิงหาคม พ.ศ. 2553

Gentoo migration to raid

At some point, high availability become more essential to your server. Raid1(mirror) can help server to be able to continue even the disk go wrong. This blog is intend to be a complete just-type-guide for system admin. I hope that you guy succeeded in this migration

Background my system is gentoo on sda. The new disk will be sdb. After finishing copying data to sdb. The another new disk will be replace as sda. sda and sdb will be raid1 mirroring each other.

#0 move running service to another system
- make sure that the system can be down for maintainance


#1 shutdown system
shutdown -h now

#2 install new hdd as sdb
some vendor disable port B (for sdb) please make sure that it is enable so it can be visible from linux.

#3 boot system with live cd
modprobe raid1

#4 format disk and create raid on sdb
available 500GB
-> sdb1 boot 1GB ext2
-> sdb5 root entire ext3
-> sdb6 swap 4GB swap
cfdisk /dev/sdb
cd /dev && MAKEDEV md
mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb1
mdadm --create /dev/md5 --level=1 --raid-devices=2 missing /dev/sdb5
mke2fs /dev/md1
mke2fs -j /dev/md5
mkswap /dev/sdb6
swapon /dev/sdb6


#5 copy data from sda to raid
mkdir /mnt/gentoo1
mount /dev/sda5 /mnt/gentoo1
mount /dev/md5 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo1/boot
mkdir /mnt/gentoo/boot
mount /dev/md1 /mnt/gentoo/boot
cp -dpRx /mnt/gentoo1/* /mnt/gentoo/


#6 install boot loader to raid
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1=”(chroot) $PS1”
#Edit grub.conf change root=/dev/sdaxx to mdxx
nano /boot/grub/grub.conf
#install boot loader to the disk
grub –no-floppy
- device (hd0) /dev/sdb
- root (hd0,0)
- setup (hd0)

#7 edit fstab to mount disk on raid instead // or just copy from preedit @ /home/username/fstab
nano /etc/fstab

#8 shutdown & replace sda with new disk
exit
cd /
umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo
umount /mnt/gentoo1/boot /mnt/gentoo1
shutdown -h now
-replace new disk


#9 sync disk and install boot loader
-change bios priority to start boot from sdb
sfdisk -d /dev/sdb | sfdisk /dev/sda
mdadm --add /dev/md1 /dev/sda1
mdadm --add /dev/md5 /dev/sda5
#edit fstab add sda as swap
nano /etc/fstab
mkswap /dev/sda6
swapon /dev/sda6
grub –no-floppy
- device (hd0) /dev/sda
- root (hd0,0)
- setup (hd0)


#wait until sync finish
- reboot test
- restore bios boot priority
- restore sevice back to the server.

วันพุธที่ 10 มีนาคม พ.ศ. 2553

Configuring gentoo apache with fcgi

mod php and worker are not stable as PHP official page.

Gentoo user might not aware this because we can compile PHP with threads use flag without realizing the warning.

Before get start with apache-worker fcgid and php. You need the following :
1) installed PHP with cgi use flag.
2) installed mod_fcgid (emerge mod_fcgid)

PHP configuration :
- modify /etc/php/cgi-php5/php.ini to suite your need.

apache configuration :
- modify /etc/apache2/modules.d/20_mod_fcgid.conf adding the following in
AddHandler fcgid-script .php .fcgi
DefaultInitEnv PHPRC "/etc/php/cgi-php5"

IdleTimeout 60
BusyTimeout 120
ProcessLifeTime 360
SpawnScoreUpLimit 2100
MaxProcessCount 2100
DefaultMaxClassProcessCount 2100
IPCConnectTimeout 120
IPCCommTimeout 120

FCGIWrapper /usr/bin/php-cgi .php

Please change the /usr/bin/cgi/ to your path. And don't forget to add +ExecCGI to option directive.

- edit /etc/conf.d/apache2 add -D FCGID to APACHE2_OPTS

restarting apache.

วันจันทร์ที่ 8 กุมภาพันธ์ พ.ศ. 2553

gentoo SNMP

Installing SNMP in gentoo for system monitoring.


#emerge net-snmp

edit /etc/snmp/snmpd.conf add the following
com2sec Mybox localhost public
com2sec cacti 192.168.1.0/24 public

group RWGroup v2c Mybox
group ROGroup v1 cacti
group ROGroup v2c cacti

view all included .1 80
view system included system fe

access ROGroup "" any noauth exact all none none
access RWGroup "" v2c noauth exact all all all

#rc-update add snmpd default