安裝步驟

date 01062029
net-setup eth0
fdisk /dev/sda
  /dev/sda1   200M  /boot
  /dev/sda2  4096M  swap
  /dev/sda3    ALL /
mke2fs /dev/sda1
mkreiserfs /dev/sda3
mkswap /dev/sda2
swapon /dev/sda2
cd /mnt
mount /dev/hda3 gentoo
cd gentoo
mkdir boot
mount /dev/sda1 boot

使用網路最新的資料 for x86 wget http://ftp.twaren.net/Linux/Gentoo/releases/x86/2008.0/stages/stage3-x86-2008.0.tar.bz2 tar -xvjpf stage3-x86-2008.0.tar.bz2

使用網路最新的資料 for i686 wget http://gentoo.cs.nctu.edu.tw/gentoo/releases/x86/current-stage3/stage3-i686-20120131.tar.bz2 tar -xvjpf stage3-i686-20120131.tar.bz2

使用網路最新的資料 for x64 wget ftp://gentoo.cs.nctu.edu.tw/gentoo/gentoo-distfiles/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-2.tar.bz2 tar -xvjpf stage3-amd64-2.tar.bz2 -C /mnt/gentoo

wget ftp://gentoo.cs.nctu.edu.tw/gentoo/gentoo-distfiles/snapshots/portage-latest.tar.xz
tar -xvJf portage-latest.tar.xz -C /mnt/gentoo/usr

cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
echo "export PS1='\[\033[01;33m\]\A/$? \[\033[01;31m\]\h \[\033[01;34m\]\w \$ \[\033[00m\]'" >> /mnt/gentoo/etc/profile.d/my.sh
echo "alias d=ls" >> /mnt/gentoo/etc/profile.d/my.sh
echo "alias v='ls -l'" >> /mnt/gentoo/etc/profile.d/my.sh
vi etc/locale.gen
vi etc/fstab
vi etc/conf.d/hwclock
vi etc/conf.d/hostname
vi etc/portage/make.conf

    CFLAGS="-march=core2 -mtune=generic -O3 -pipe"

    USE="-ipv6 -X mmx sse sse2 xml apache2"

    FEATURES="ccache"
    MAKEOPTS="-j4"

    CCACHE_DIR="/var/tmp/ccache"
    CCACHE_SIZE="2G"

    FETCHCOMMAND="/usr/bin/axel -a -o \${DISTDIR}/\${FILE} \${URI}"
    RESUMECOMMAND="${FETCHCOMMAND}"
vi etc/conf.d/net
config_eth0="192.168.1.10/24"
routes_eth0="default via 192.168.1.254"

Bond interface

config_eth0="null"
config_eth1="null"

slaves_bond0="eth0 eth1"
config_bond0="192.168.1.9/24"
routes_bond0="default via 192.168.1.254"
rc_net_bond0_need="net.eth0 net.eth1"
mount -t proc none /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys

chroot /mnt/gentoo /bin/bash
env-update; source /etc/profile; export PS1="(chroot) $PS1"; cd
cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
emerge --sync
emerge portage
etc-update

emerge ccache -uv
echo FEATURES=\"ccache\" >> /etc/portage/make.conf
echo CCACHE_DIR=\"/var/tmp/ccache\" >> /etc/portage/make.conf
echo CCACHE_SIZE=\"2G\" >> /etc/portage/make.conf

emerge vim

edit /etc/locale.gen
   en_US ISO-8859-1
   en_US.UTF-8 UTF-8

emerge vim dhcp grub syslog-ng vixie-cron reiserfsprogs genkernel gentoo-sources gentoolkit gptfdisk ppp -uv

touch /etc/udev/rules.d/80-net-name-slot.rules

grub

rc-update add sshd default
rc-update add syslog-ng default
rc-update add vixie-cron default
cd /etc/init.d/
ln -s net.lo net.eth0
rc-update add net.eth0 boot
sed -i 's/CLEAN="yes"/CLEAN="no"/' /etc/genkernel.conf
sed -i 's/#BOOTLOADER="grub"/BOOTLOADER="grub"/' /etc/genkernel.conf

genkernel all

config: Using config from /usr/share/genkernel/arch/x86/kernel-config-2.6
kernel: Using config from /usr/share/genkernel/arch/x86_64/kernel-config

genkernel all --menuconfig --bootloader=grub --gensplash=livecd-2007.0

vi /boot/grub/grub.conf

// for x32
default 0
timeout 5
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux (2.6.18-gentoo-r6)
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.18-gentoo-r6 root=/dev/ram0 init=/linuxrc real_root=/dev/sda3 vga=791
initrd /initramfs-genkernel-x86-2.6.18-gentoo-r6

// for x64
default 0
timeout 5
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux 2.6.16-r7
root (hd0,0)
kernel /kernel-genkernel-x86_64-2.6.16-gentoo-r7 root=/dev/ram0 init=/linuxrc real_root=/dev/sda3 vga=791
initrd /initramfs-genkernel-x86_64-2.6.16-gentoo-r7
grub
    root (hd0,0)
    setup (hd0)
    quit

passwd

exit
cd /
umount -l /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo/sys /mnt/gentoo
reboot

vi /etc/local.d/my.sh

!/bin/bash

Log

NOW=date +%Y%m%d:%H%M%S LAST=last $USER -5 echo "$NOW: From $HOSTNAME : this user $USER login..." > /tmp/userlogin.log echo "$LAST" >> /tmp/userlogin.log mail -s "$HOSTNAME $USER ~~ User Login ~~" root < /tmp/userlogin.log rm -f /tmp/userlogin.log

Env setting

alias d='ls --color' alias v='d -l' alias grep='grep --color'

export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"

if $TERM = 'xterm' ; then export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"' fi

if /usr/bin/whoami = 'root' ; then export PS1='[\03301;33m\\A/$? [\03301;31m\\h [\03301;34m\\w \$ [\03300m\' else export PS1='[\03301;33m\\A/$? [\03301;32m\ [\03301;34m\\w \$ [\03300m\' fi


emerge -C ssmtp
emerge ntp postfix php nginx dev-db/mysql sysstat logwatch logrotate iproute2 iptables bind bind-tools rrdtool acpid gentoolkit -uav

rc-update add acpid default

vi /etc/postfix/main.cf
    myhostname = xxx.yyy.com
    mydomain = yyy.com

vi /etc/snmp/snmpd.conf
    rocommunity mrtg

postalias /etc/mail/aliases
rc-update add postfix default

/etc/conf.d/local.start
  ntpdate pool.ntp.org
  hwclock -w

/etc/crontab
1 1 * * * root ntpdate pool.ntp.org;hwclock -w
1 6 * * * root emerge --sync >/dev/null;emerge world -pvD

P5LD2 Giga 網路問題

http://gentoo-wiki.com/HARDWARE_sk98lin


*

eaccelerator extension="eaccelerator.so" eaccelerator.cache_dir="/var/cache/eaccelerator" eaccelerator.allowed_admin_path = "." eaccelerator.log_file = "/var/log/apache2/eaccelerator_log"


*

extension="apc.so"


*

SSHd

filter f_sshd { program("sshd"); }; destination d_sshd { file("/var/log/secure"); }; log { source(src); filter(f_sshd); destination(d_sshd); };

重啟 /etc/init.d/syslog-ng reload


*

emerge '=dev-lang/php-4*' dev-php4/eaccelerator ACCEPT_KEYWORDS="~x86" emerge dev-php4/eaccelerator emerge openssl apache


*

改 make.conf

32bit

CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

64bit

CHOST="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=nocona -fomit-frame-pointer -pipe" CXXFLAGS="${CFLAGS}"


*


*

gentoo boot 參數要加 dodmraid

emerge dmraid fdisk /dev/dm-0 dmraid -ay mount /dev/dm-3 gentoo

grub --device-map=/dev/null device (hd0) /dev/mapper/isw_degaagdejg_Volume0 root (hd0,0) setup (hd0) quit

genkernel all --dmraid

改 apache2 的最大承載

vi /etc/apache2/httpd.conf 找到 裡面增加 ServerLimit 2000 將 MaxClients 改成 2000 存檔 重新啟動

設定開機要執行的程式

修改 /etc/local.d/*.start 將指令放在裡面

預設 kernel 設定檔在 /usr/share/genkernel/x86/kernel-config-2.6

安裝參考

http://www.gentoo.org/doc/zh_tw/gentoo-x86-quickinstall.xml

執行時間: 0.0260 秒, 瀏覽次數: 12