Последовательность команд для успешной установки gentoo

Это не руководство по установке, это список команд, чтобы делать мышкой копи-паст.

Содержимое редактируемых файлов приводится в самом конце страницы.

Непосредственно в консоли liveCD

passwd root
ip a a 192.168.1.77/24 dev eth0 
ip l s up dev eth0 
ip ro a default via 192.168.1.1
nano /etc/ssh/sshd_config
        PermitRootLogin yes
ssh-keygen -t ed25519 -a 100 -f /etc/ssh/ssh_host_ed25519_key -N "" 
/etc/init.d/sshd restart 

В liveCD через SSH

ntpdate ash.catalysis.ru
 
parted /dev/sda
# для больших дисков >2TB
    (parted) mklabel gpt
# для нормальных дисков
    (parted) mklabel msdos
# /boot
    (parted) mkpart primary reiserfs 0 256M
    Warning: The resulting partition is not properly aligned for best performance.
    Ignore/Cancel? i
# раздел под LVM
    (parted) mkpart primary 256M -1s
    Warning: You requested a partition from 256MB to 32.2GB (sectors 500000..62914559).
    The closest location we can manage is 256MB to 32.2GB (sectors 500001..62914526).
    Is this still acceptable to you?
    Yes/No? y                                                                 
    Warning: The resulting partition is not properly aligned for best performance.
    Ignore/Cancel? i                                                          
    (parted) set 2 lvm on                                                     
    (parted) p                                                                
    Model: ATA QEMU HARDDISK (scsi)
    Disk /dev/sda: 32.2GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags: 
 
    Number  Start   End     Size    File system  Name  Flags
     1      17.4kB  256MB   256MB
     2      256MB   32.2GB  32.0GB                     lvm
    (parted) quit                                                             
 
 
########
#
## Если продолжаем прерванную процедуру установки то вместо след. блока команд делаем 
## vgchange -a y 
#
########
 
pvcreate /dev/sda2 
vgcreate vg /dev/sda2 
lvcreate -L 1G -n root vg
lvcreate -L 1G -n tmp  vg
lvcreate -L 1G -n opt  vg
lvcreate -L 2G -n home vg
lvcreate -L 5G -n var  vg
lvcreate -L 5G -n usr  vg
 
 
for p in root tmp opt var usr home ; do mkreiserfs /dev/vg/$p ; done
mkreiserfs /dev/sda1
mount /dev/vg/root /mnt/gentoo/
mkdir /mnt/gentoo/boot ; 
for p in tmp opt var usr home ; do mkdir /mnt/gentoo/$p ; done
 
mount /dev/sda1 /mnt/gentoo/boot
for p in tmp opt var usr home ; do mount /dev/vg/$p /mnt/gentoo/$p ; done
 
nano /etc/resolv.conf
    nameserver 172.16.0.5
 
cd /mnt/gentoo/tmp/
wget -t0 -c http://mirror.yandex.ru/gentoo-distfiles/releases/amd64/autobuilds/current-stage3-amd64-hardened/stage3-amd64-hardened-20190203T214502Z.tar.xz
wget -t0 -c http://mirror.yandex.ru/gentoo-distfiles/snapshots/portage-latest.tar.xz 
cd /mnt/gentoo/
tar xvf tmp/stage3-amd64-hardened-20121013.tar.bz2
cd usr/
tar xvf ../tmp/portage-latest.tar.bz2
cd ..
rm tmp/stage3-amd64-hardened-20121013.tar.bz2 tmp/portage-latest.tar.bz2
 
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
 
chroot /mnt/gentoo /bin/bash

В chroot'e через SSH

env-update
source /etc/profile
cd 
 
cp /usr/share/zoneinfo/Asia/Novosibirsk /etc/localtime 
echo "Asia/Novosibirsk" > /etc/timezone
 
 
# пример конфига в самом конце страницы
nano /etc/portage/make.conf
nano /etc/locale.gen 
locale-gen
 
eselect profile list 
eselect profile set hardened/linux/amd64 
 
emerge --sync ; emerge -uDN --with-bdeps y world ; emerge @preserved-rebuild ; revdep-rebuild -i ;
 
 
wget http://file.sabitov.su/gentoo/base-world
cat /var/lib/portage/world base-world | sort | uniq > world ; mv world /var/lib/portage/world ; rm base-world
 
emerge --sync ; emerge -uDN --with-bdeps y world ; emerge @preserved-rebuild ; revdep-rebuild -i ;
 
nano /usr/src/rebuild-kernel.sh
chmod +x /usr/src/rebuild-kernel.sh
/usr/src/rebuild-kernel.sh
 
 
cat >> /etc/default/grub <<EOT
 
 
############# Local settings #####################
 
GRUB_CMDLINE_LINUX_DEFAULT="dolvm udev "
GRUB_PRELOAD_MODULES="ext2 reiserfs lvm"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_GFXMODE=console
GRUB_GFXPAYLOAD_LINUX=text
GRUB_FONT="/boot/grub/fonts/unicode.pf2"
#GRUB_BACKGROUND="/boot/grub/back.jpg"
GRUB_COLOR_NORMAL="black/light-blue"
GRUB_COLOR_HIGHLIGHT="brown/blue"
GRUB_DISABLE_SUBMENU=y
 
 
EOT
 
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda
 
groupadd -g 777 sabitov
useradd -u 777 -g 777 -G root,wheel,cron,users -c 'Andrew A. Sabitov' -m sabitov
 
passwd root
passwd sabitov
 
cd /etc/init.d/
ln -s net.lo net.eth0
 
for s in net.eth0 sshd vixie-cron syslog-ng ; do rc-update add $s default; done
 
nano /etc/conf.d/consolefont
nano /etc/conf.d/hostname
nano /etc/conf.d/hwclock
nano /etc/conf.d/keymaps
nano /etc/conf.d/modules
nano /etc/conf.d/net
nano /etc/conf.d/ntp-client
nano /etc/conf.d/ntpd
 
nano /etc/env.d/02locale
nano /etc/env.d/98editor
nano /etc/env.d/98pager
nano /etc/env.d/99zlocal-env
 
nano /etc/etckeeper/etckeeper.conf
 
nano /etc/ssh/sshd_config
 
nano /etc/fstab
 
nano /etc/logrotate.conf
nano /etc/ntp.conf
nano /etc/rc.conf
nano /etc/sudoers
nano /etc/wgetrc
 
# eselect bashcomp enable --global ... 
# см. ниже файл eselect_bashcomp.sh

Выходим из chroot

exit
umount /mnt/gentoo/boot
for p in tmp opt var usr home ; do umount /mnt/gentoo/${p} ; done
umount -l /mnt/gentoo/proc /mnt/gentoo/sys /mnt/gentoo/dev
umount /mnt/gentoo/
 
reboot

Файлы

/etc/portage/make.conf
CFLAGS="-O2 -march=native -fomit-frame-pointer -pipe -mno-tls-direct-seg-refs"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
 
MAKEOPTS="-j3"
 
SYNC="rsync://ash.catalysis.ru/gentoo-portage"
GENTOO_MIRRORS="\
        http://ash.catalysis.ru/gentoo/ \
        http://mirror.yandex.ru/gentoo-distfiles/distfiles/ \
        http://trumpetti.atm.tut.fi/gentoo/ \
"
 
 
PORTAGE_ELOG_CLASSES="info warn error log qa"
PORTAGE_ELOG_SYSTEM="save echo syslog save_summary"
FEATURES="parallel-fetch metadata-transfer"
EMERGE_DEFAULT_OPTS="--keep-going -j2 -vt --nospinner "
 
USE_ENABLED="\
        acl acpi apm \
        bash-completion bzip2 \
        caps crypt curl curlwrappers \
        encode \
        gmp \
        hardened hardenedphp iconv idn ipv6 \
        mmap mysql \
        ncurses nls nptl nptlonly \
        pam posix \
        readline recode \
        sharedmem slang snmp sockets spell ssl sysvipc \
        tcpd threads udev unicode usb \
        vhosts \
        xattr xml xmlrpc \
        zlib \
"
 
USE_DISABLED="\
        -3dfx -X \
        -a52 -aac -aalib -arts -audiofile -avahi \
        -bluetooth \
        -doc \
        -esd -emacs -evo -examples -expat \
        -font-server \
        -gnome -gnustep -gtk -gtk2 -gtkhtml \
        -ieee1394 \
        -kde \
        -ldap \
        -pcmcia -pdf \
        -qt -qt3support -qt4 \
        -scanner \
        -xulrunner \
        -zeroconf\
"
 
USE_CPU="mmx sse sse2"
 
USE="${USE_ENABLED} ${USE_CPU} ${USE_DISABLED}"
 
#ACCEPT_LICENSE=""
 
LINGUAS="en ru"
QEMU_SOFTMMU_TARGETS="i386 x86_64"
QEMU_USER_TARGETS="i386 x86_64"
INPUT_DEVICES="keyboard mouse evdev"
VIDEO_CARDS="vesa"
 
PHP_INI_VERSION="production"
APACHE2_MODULES="\
        actions alias auth_basic auth_digest \
        authn_anon authn_dbd authn_dbm authn_default authn_file \
        authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user \
        autoindex cache cgi charset_lite dav dav_fs dav_lock \
        dbd deflate dir disk_cache env expires ext_filter file_cache filter \
        headers ident imagemap include info log_config logio \
        mem_cache mime mime_magic negotiation \
        proxy proxy_ajp proxy_balancer proxy_connect proxy_http \
        rewrite setenvif so speling status unique_id userdir usertrack vhost_alias\
"
 
#PORTDIR_OVERLAY="/usr/local/portage"
#source /var/lib/layman/make.conf
/etc/locale.gen
ru_RU.KOI8-R KOI8-R
ru_RU.UTF-8 UTF-8
en_US ISO-8859-1
en_US.UTF-8 UTF-8
/usr/src/rebuild-kernel.sh
#!/bin/sh
genkernel --lvm --menuconfig all
/boot/grub/grub.conf
# Boot automatically after 5 secs.
timeout 5
 
# By default, boot the first entry.
default saved
 
# Fallback to the second entry.
fallback 1
 
color light-gray/blue black/light-gray
 
title Gentoo Linux genkernel-x86_64-3.5.4-hardened-r1 with LVM2
        root   (hd0,0)
        savedefault 0
        kernel /kernel-genkernel-x86_64-3.5.4-hardened-r1  udev dolvm root=/dev/ram0 real_root=/dev/vg/root init=/linuxrc video=uvesafb:mtrr:3,ywrap,1024x768-32@60
        initrd /initramfs-genkernel-x86_64-3.5.4-hardened-r1
/etc/env.d/02locale
LC_ALL=""
LANG="ru_RU.UTF-8"
/etc/env.d/99zlocal-env
HISTCONTROL="ignoredups"
HISTIGNORE="mc:ls:df:du"
HISTSIZE=15000
HISTFILESIZE=15000
/etc/fstab
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
 
shm                             /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
none                            /proc           proc            defaults                0 0
 
 
########################################################################
#
## Local file systems
#
########################################################################
 
/dev/mapper/vg-root             /               reiserfs        noatime,notail          0 2
/dev/mapper/vg-usr              /usr            reiserfs        notail                  0 2
/dev/mapper/vg-home             /home           reiserfs        acl,user_xattr,notail   0 2
/dev/mapper/vg-var              /var            reiserfs        notail                  0 2
/dev/mapper/vg-opt              /opt            reiserfs        noatime,notail          0 2
/dev/mapper/vg-tmp              /tmp            reiserfs        notail                  0 2
 
/dev/sda1                       /boot           reiserfs        noatime,notail          1 2
 
 
 
########################################################################
#
## NFS
#
########################################################################
 
#server:/      /extra/server              nfs   ro,vers=3                 0 0
#server:/home  /extra/server/home         nfs   rw,vers=3                 0 0
eselect_bashcomp.sh
eselect bashcomp enable --global 
eselect bashcomp enable --global  apache2ctl
eselect bashcomp enable --global  aspell
eselect bashcomp enable --global  base
eselect bashcomp enable --global  bash-builtins
eselect bashcomp enable --global  bind-utils
eselect bashcomp enable --global  blkid
eselect bashcomp enable --global  brctl
eselect bashcomp enable --global  bzip2
eselect bashcomp enable --global  chown
eselect bashcomp enable --global  configure
eselect bashcomp enable --global  coreutils
eselect bashcomp enable --global  cpio
eselect bashcomp enable --global  crontab
eselect bashcomp enable --global  dbus
eselect bashcomp enable --global  dconf
eselect bashcomp enable --global  dd
eselect bashcomp enable --global  eix
eselect bashcomp enable --global  eselect
eselect bashcomp enable --global  etckeeper
eselect bashcomp enable --global  find
eselect bashcomp enable --global  findutils
eselect bashcomp enable --global  genkernel
eselect bashcomp enable --global  gentoo
eselect bashcomp enable --global  git
eselect bashcomp enable --global  gpg
eselect bashcomp enable --global  gpg2
eselect bashcomp enable --global  gzip
eselect bashcomp enable --global  iconv
eselect bashcomp enable --global  info
eselect bashcomp enable --global  ip
eselect bashcomp enable --global  ipmitool
eselect bashcomp enable --global  iproute2
eselect bashcomp enable --global  ipsec
eselect bashcomp enable --global  iptables
eselect bashcomp enable --global  ipv6calc
eselect bashcomp enable --global  kill
eselect bashcomp enable --global  killall
eselect bashcomp enable --global  layman
eselect bashcomp enable --global  lsof
eselect bashcomp enable --global  lvm
eselect bashcomp enable --global  mkfs
eselect bashcomp enable --global  mount
eselect bashcomp enable --global  mount.linux
eselect bashcomp enable --global  nmap
eselect bashcomp enable --global  ntpdate
eselect bashcomp enable --global  openssl
eselect bashcomp enable --global  ping
eselect bashcomp enable --global  postfix
eselect bashcomp enable --global  qemu
eselect bashcomp enable --global  rdesktop
eselect bashcomp enable --global  rkhunter
eselect bashcomp enable --global  rsync
eselect bashcomp enable --global  screen
eselect bashcomp enable --global  sh
eselect bashcomp enable --global  shadow
eselect bashcomp enable --global  smbclient
eselect bashcomp enable --global  ssh
eselect bashcomp enable --global  tar
eselect bashcomp enable --global  tcpdump
eselect bashcomp enable --global  umount
eselect bashcomp enable --global  unrar
 

sys/установка_генты_как_она_есть.txt · Последние изменения: 2019-02-04 22:46 — Andrew A. Sabitov