Table des matières

Gentoo

Lister les paquets installés sur le système avec leur flags

enalyze a packages

Mettre à jour le systeme en tenant compte des dernières variables USE

emerge --sync
emerge -uDNav world
emerge --depclean
revdep-rebuild
etc-update (ou dispatch-conf)
eclean-dist
emerge --info

Description des variables use

http://www.gentoo.org/dyn/use-index.xml en ligne ou en local :

cat /usr/portage/profiles/use.desc

Voir quel package est lié à une variable use

euse -i zlib
equery hasuse mysql

Installation aux petits oignons

Installe le “soft” avec les options choisies (avec opt1 et sans opt2)

emerge <soft>    USE= +opt1 -opt2 

Pour avoir la liste des options utilisables :

emerge -vp <soft>

Si choses speciales à faire comme appliquer un patch ou autre :

ebuild /usr/portage/section/soft/ebuild-version.ebuild OPTIONS

Pour rajouter des options USE à chaque installation pour un paquage (dans toutes ses versions ou une version précise) il faut éditer le fihchier /etc/portage/package.use

=sys-apps/pciutils-3.1.7 -zlib
net-analyzer/wireshark gtk

Lister toutes les versions d'un soft

# equery list -po firefox
 * Searching for firefox ...
[-P-] [  ] www-client/firefox-3.6.20:0
[-P-] [  ] www-client/firefox-3.6.22:0
[-P-] [  ] www-client/firefox-8.0:0
[IP-] [  ] www-client/firefox-9.0:0
# equery meta firefox
 * www-client/firefox [gentoo]
Herd:        mozilla (mozilla@gentoo.org)
Maintainer:  None specified
Upstream:    None specified
Homepage:    http://www.mozilla.com/firefox
Location:    /usr/portage/www-client/firefox
Keywords:    3.6.20:0: alpha arm ia64 ppc ppc64
Keywords:    3.6.22:0: sparc ~ia64-linux ~ppc64 ~sparc-solaris ~x64-solaris ~x86-solaris
Keywords:    8.0:0: 
Keywords:    9.0:0: amd64 x86 ~alpha ~amd64-linux ~arm ~ia64 ~ppc ~x86-linux

epm

C'est l'équivalent à rpm sous Gentoo.

gigi-linux gigi # epm -qf /usr/bin/vim
vim-7.3.266
gigi-linux gigi # epm -ql vim
/usr/share/bash-completion/vim
/usr/bin/vim
/usr/bin/vimdiff
/usr/bin/rvim
/usr/bin/rview

SCRIPT D'INSTALLATION

install.sh
#!/bin/bash
 
CONF_PATH="$PWD/conf"
PKG_INSTALL="mlocate lsof htop iftop sysstat iotop lsscsi tcpdump wireshark curl acroread vlc corefonts freefonts bind9-host k3b yakuake"
 
if [ "`uname -p`" != "x86_64" ] ; then
        echo "Ce script n'est compatible que pour les architectures processeurs x86_64 !"
        echo "Votre architecture processeur est : `uname -p`"
        exit 1
fi
 
while [ -z $INSTALL_PATH  ]
do
        echo  -e "\n* Veuillez saisir le chemin d'installation (ex : /mnt/gentoo)"
        read INSTALL_PATH
        [ -d "$INSTALL_PATH" ] || unset INSTALL_PATH
done
 
cd "$INSTALL_PATH"
 
echo "* Téléchargement de Gentoo 64 bits stage3..."
#wget ftp://distfiles.gentoo.org/pub/gentoo/releases/amd64/current-stage3/stage3-amd64-*.tar.bz2
STAGE3_VERSION="`wget -q -O - http://distfiles.gentoo.org/releases/amd64/current-stage3/ | grep stage3 | sed 's@.*stage3-amd64-\(.*\).tar.bz2.*@\1@g' | tail -1`"
wget http://distfiles.gentoo.org/releases/amd64/current-stage3/stage3-amd64-${STAGE3_VERSION}.tar.bz2 || exit 1
 
echo -e "\n* Décompréssion de stage3..."
tar xjpf stage3*.tar.bz2 || exit 1
rm stage3*.tar.bz2
 
cd usr
 
echo -e "\n* Téléchargement de portage..."
wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2 || exit 1
 
echo -e "\n* Décompréssion de portage..."
tar xjpf portage-lat*.tar.bz2 || exit 1
rm portage-lat*.tar.bz2
 
cd ..
 
mount -t proc none proc
mount -o bind /dev dev
 
while [ -z $MYHOSTNAME  ]
do
        echo -e "\n* Veuillez saisir le nom de la machine :"
        read MYHOSTNAME
done
 
while [ -z $MYDOMAINNAME  ]
do
        echo -e "\n* Veuillez saisir le nom de domaine (par exemple : local) :"
        read MYDOMAINNAME
done
 
 
echo -e "\n* Génération du fichier /etc/hosts..."
echo "127.0.0.1 $MYHOSTNAME.$MYDOMAINNAME $MYHOSTNAME localhost
 
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts" | tee etc/hosts
 
echo -e "\n* Génération du fichier /etc/conf.d/hostname..."
echo "hostname=$MYHOSTNAME" > etc/conf.d/hostname
 
echo -e "\n* Génération du fichier /etc/conf.d/domainname..."
echo "dns_domain_lo=$MYDOMAINNAME" > etc/conf.d/domainname
 
echo -e "\n* Génération du fichier /etc/localtime..."
cp -a usr/share/zoneinfo/Europe/Paris etc/localtime
 
echo -e "\n* Génération du fichier /etc/conf.d/keymaps..."
cp -a "${CONF_PATH}/keymaps" etc/conf.d/keymaps
 
echo -e "\n* Edition du fichier /etc/fstab dans 3 secs..."
sleep 3
cp -a "${CONF_PATH}/fstab" etc/fstab
vi etc/fstab
 
echo -e "\n* Edition du fichier /etc/make.conf dans 3 secs..."
sleep 3
cp -a "${CONF_PATH}/make.conf" etc/make.conf
COMPILE_CPU=`lscpu | grep "^CPU\(s\):" | awk '{ print $NF+1 }'`
echo "MAKEOPTS='-j$COMPILE_CPU -l$COMPILE_CPU'" >> etc/make.conf
echo "EMERGE_DEFAULT_OPTS='--jobs=$COMPILE_CPU --load-average=${COMPILE_CPU}.0 --with-bdeps y'" >> etc/make.conf
echo "PORTAGE_NICENESS=15" >> etc/make.conf
vi etc/make.conf
 
echo -e "\n* Génération du fichier /etc/conf.d/clock..."
echo 'TIMEZONE="Europe/Paris"' > etc/conf.d/clock
 
echo -e "\n* Génération du fichier /etc/locale.gen..."
echo "
fr_FR ISO-8859-1
fr_FR.UTF-8 UTF-8
fr_FR.UTF-8@euro UTF-8
fr_FR@euro ISO-8859-15" | tee -a etc/locale.gen 
 
echo -e "\n * Génération du fichier /etc/resolv.conf..."
cp -a /etc/resolv.conf etc/resolv.conf
 
##### DEBUT DU CHROOT #####
echo -e "\n* Passage en chroot dans $INSTALL_PATH..."
chroot "$INSTALL_PATH" <<EOF
env-update && source /etc/profile
hostname $MYHOSTNAME
echo -e "\n* Génération des locales..."
locale-gen
echo -e "\nDéfinition du password root..."
echo "changeme
changeme" | passwd
echo -e "\n* Définition des mirroirs..."
#mirrorselect -i -o >> /etc/make.conf
#mirrorselect -i -r -o >> /etc/make.conf
echo 'GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://mirrors.linuxant.fr/distfiles.gentoo.org/"' >> /etc/make.conf
echo 'SYNC="rsync://rsync2.fr.gentoo.org/gentoo-portage"' >> /etc/make.conf
emerge mirrorselect
emerge --sync
emerge -uDNav world
emerge --depclean
revdep-rebuild
etc-update
emerge mirrorselect
#emerge -vpe world
echo -e "\n* Installation paquages + update..."
emerge pciutils usbutils lshw hwinfo ntp rsyslog logrotate vixie-cron grub sudo less vim lvm2 dmraid genkernel irqbalance portage-utils gentoolkit gentoo-sources $PKG_INSTALL
rc-update add rsyslog default
rc-update add vixie-cron default
rc-update add irqbalance default
rc-update add ntp-client default
rc-update add ntpd default
rc-update add sshd default
emerge --oneshot libtool
 
echo -e "\* Mise à jour du système"
emerge --sync
emerge --update --deep --newuse world
emerge --depclean
revdep-rebuild
echo -e "\n* Reconfiguration des paquets..."
dispatch-conf
echo -e "\n*Reconfiguation de Perl..."
perl-cleaner all
echo -e "\n*Reconfiguation de Python..."
python-updater
echo -e "\n* Compilation du kernel avec option --lvm --dmraid"
#genkernel --dmraid --lvm --splash --splash-res=1024x768 all
genkernel --dmraid --lvm all
echo -e "\n* Ajout de l'utilisateur gigi + password..."
useradd -g users -G lp,wheel,audio,cdrom,portage,cron -m gigi
echo "changeme
changeme" | passwd gigi
echo "Password root et gigi défini à 'changeme' !"
 
echo -e "\n* Configuration de grub..."
grub --device-map=/dev/null --batch <<GRUBEOF
device (hd0) /dev/dm-0
root (hd0,2)
setup (hd0)
quit
GRUBEOF
 
cd /boot
ln -s initramfs-genkernel-* initramfs
ln -s kernel-genkernel-* kernel
 
echo -e "\n* Configuration DHCP eth0"
echo 'config_eth0="dhcp"' > /etc/conf.d/net
cd /etc/init.d
ln net.lo net.eth0
rc-update add net.eth0 default
 
echo -e "\n* Installation de KDE"
emerge kde-meta oxygen-gtk xdm kdm dbus xorg-server firefox google-chrome numlockx icedtea-web adobe-flash
echo "setxkbmap fr" >> /usr/share/config/kdm/Xsetup
echo "numlockx on" >> /usr/share/config/kdm/Xsetup
#echo 'DISPLAYMANAGER="kdm"' > /etc/conf.d/xdm
rc-update add xdm default
rc-update add numlock default
rc-update add consolekit default
rc-update add dbus default
rc-update add alsasound default
gpasswd -a gigi plugdev
 
eclean-dist -p
eclean-pkg -p
EOF
##### FIN DU CHROOT #####
 
 
echo -e "\n* Edition du fichier /boot/grub/menu.lst dans 3 secs..."
sleep 3
cp -a "${CONF_PATH}/grub.conf" boot/grub/grub.conf 
vi boot/grub/grub.conf
 
echo -e "\n* Veuiller lancer les commandes suivantes :"
echo "-> chroot $PATH_INSTALL"
echo "-> passwd root"
echo "-> passwd gigi"

Fichier conf/fstab

fstab
/dev/dm-3               /            ext3            defaults        0 1
/dev/dm-4               /home        ext3            defaults        0 2

Fichier conf/grub

grub
default 0
timeout 30
splashimage=(hd0,2)/boot/grub/splash.xpm.gz

title Windobe 7
rootnoverify (hd0,0)
makeactive
chainloader +1

title Gentoo Linux By GigiX
root (hd0,2)
kernel /boot/kernel root=/dev/dm-3 dodmraid dolvm rootfstype=ext3 init=/linuxrc ramdisk=8192 real_root=/dev/dm-3 vga=0x791 splash=silent,theme:default console=tty1 quiet
initrd /boot/initramfs

Fichier conf/keymaps

keymaps
# Use keymap to specify the default console keymap.  There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.
keymap="fr-latin9"
 
# Should we first load the 'windowkeys' console keymap?  Most x86 users will
# say "yes" here.  Note that non-x86 users should leave it as "no".
# Loading this keymap will enable VT switching (like ALT+Left/Right)
# using the special windows keys on the linux console.
windowkeys="YES"
 
# The maps to load for extended keyboards.  Most users will leave this as is.
extended_keymaps=""
#extended_keymaps="backspace keypad euro2"
 
# Tell dumpkeys(1) to interpret character action codes to be 
# from the specified character set.
# This only matters if you set unicode="yes" in /etc/rc.conf.
# For a list of valid sets, run `dumpkeys --help`
dumpkeys_charset=""
 
# Some fonts map AltGr-E to the currency symbol ¤ instead of the Euro €
# To fix this, set to "yes"
fix_euro="YES"

Fichier conf/make.conf

make.conf
# These settings were set by the catalyst build script that automatically                                                                                                                                                                          
# built this stage.                                                                                                                                                                                                                                
# Please consult /usr/share/portage/config/make.conf.example for a more                                                                                                                                                                            
# detailed example.                                                                                                                                                                                                                                
CFLAGS="-march=native -mtune=native -O3 -pipe"                                                                                                                                                                                                                   
CXXFLAGS="${CFLAGS}"                                                                                                                                                                                                                               
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
 
# Voir http://gentoo-portage.com/USE
# Voir /usr/portage/profiles/use.desc
USE="mmx sse sse2 nptl nptlonly unicode svg alsa dbus bash-completion curl curlwrappers nsplugin java java6 javascript kde plasma mozilla mp3 mp4 mpeg ncurse pam perl png qt4 policykit consolekit udev rdesktop sasl ssl syslog X firefox mozilla cdrom dvd win32codecs mad lame aac ffmpeg mpeg xvid xv encode wav vim-syntax usb threads sockets smp sasl rss png perl pdf nls modules jpeg iconv gnutls encode audiofile libkms -ipv6 -arts -eds -gnome -gtk"
LINGUAS="fr"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://mirrors.linuxant.fr/distfiles.gentoo.org/"
SYNC="rsync://rsync2.fr.gentoo.org/gentoo-portage"
MAKEOPTS="-j3 -l3"
PORTAGE_ELOG_CLASSES="log warn error info"
PORTAGE_ELOG_SYSTEM="echo:log,warn save:log,warn,error,info syslog:error"
EMERGE_DEFAULT_OPTS="--jobs=3 --load-average=3.0 --with-bdeps y"
PORTAGE_NICENESS="19"
ACCEPT_LICENSE="*"
#VIDEO_CARDS="radeon"
#INPUT_DEVICES="evdev synaptics"