Wednesday, November 16, 2016

Simple Recipt to install Basic Gentoo

Last couple of days i was playing with Arch Linux, at the end it were pretty simple to install on LVM but of course this were just a simple and basic install with LVM perspective, so now ill give a try to Gentoo, because some time ago i tried to install it and i could not get the install since the workload rise up, but now i have some time to do so, and it seems that the wiki it is pretty improved and now it is even more easier to install it but some questions arise and here is a short answer.

By the way this is on VM almos all its by default but its just the starting poing.

stages

the stage are like installation packages like configuration flavors now it seems that Stage1 and Stage2 are not being used anymore Stage3 and Stage4 are the ones availables, Stage 3 tarballs are compiled from stage 2 tarballs, but contain a system set and A cloud stage 4 has been created to aid in the process of VM provisioning. These stage 4 files can be used with diskimage-builder

so we will go with the Stage3 but there are some flavors on Stage3 what i saw its there are some versions or flavors:

  1.  Hardened in wich there are somo more security services
  2. Systemd
  3. nomultilib
  4. uclibc for embedded devices
  5. cloud
all of thease have the wiki page ill post it at the end

I just follow the handbook from gentoo but since i just want the extract here it is what i did for installing on VM


Partition disk

toor# fdisk /dev/sda
  n p 1 2048 +2M 
  t 4
  n p 2 enter +128M 
  a 2
  n p 3 enter +2048M
  t 3 82
  n p 4 enter enter
  p
  w
toor# mkfs.ext2 /dev/sda2
toor# mkfs.ext4 /dev/sda4
toor# mkswap /dev/sda3
toor# swapon /dev/sda3
toor# mount /dev/sda4 /mnt/gentoo
toor# mkdir /mnt/gentoo/boot
toor# mount /dev/sda2 /mnt/gentoo/boot
toor# date ok ?
toor# cd /mnt/gentoo
toor# links https://www.gentoo.org/downloads/mirrors/
+
°-->releases/(arch)/autobuilds
toor# tar xvjpf stage3-amd64-hardened-20161103.tar.bz2 --xattrs


configure the make.conf options


toor# nano -w /mnt/gentoo/etc/portage/make.conf
  CHOST="x86_64-pc-linux-gnu"
  PORTDIR="/usr/portage"
  DISTDIR="${PORTDIR}/distfiles"
  PKGDIR="${PORTDIR}/packages"
  CFLAGS="-march=native -O2 -pipe"
  CXXFLAGS="${CFLAGS}"
  MAKEOPTS="-j2"
toor# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
toor# mkdir /mnt/gentoo/etc/portage/repos.conf
toor# cp /mnt/gentoo/usr/share/portage/config/repos.conf \
 > /mnt/gentoo/etc/portage/repos.conf/
toor# cp -L /etc/resolv.conf /mnt/gentoo/etc/

CHROOT

toor# mount -t proc proc /mnt/gentoo/proc/
toor# mount --rbind /sys /mnt/gentoo/sys
toor# mount --make-rslave /mnt/gentoo/sys
toor# mount --rbind /dev /mnt/gentoo/dev
toor# mount --make-rslave /mnt/gentoo/dev
toor# chroot /mnt/gentoo /bin/bash
toor# source /etc/profile
toor# export PS1="(chroot) $PS1"
toor# emerge-webrsync
toor# nano -w /etc/portage/make.conf
  USE="-qt4 -gnome kde"
toor# echo "Time/zone" > /etc/timezone
toor# emerge --config sys-libs/timezone-data
toor# nano -w /etc/locale.gen
 ...
toor# locale-gen
toor# eselect locale list
 ...
toor# eselect locale set #
toor# env-update && source /etc/profile && 
export PS1="(chroot) $PS1"
toor# emerge --ask sys-kernel/gentoo-sources
toor# emerge --ask sys-apps/pciutils


get info


toor# lspci
toor# lsmod

toor# cd /usr/src/linux
toor# make menuconfig
toor# make && make modules_install
toor# make install
toor# nano -w /etc/fstab
...
toor# nano -w /etc/conf.d/hostname
...
toor# emerge --ask --noreplace net-misc/netifrc
toor# passwd
toor# cd /etc/init.d
toor# ln -s net.lo net.eth0

toor# rc-update add net.eth0 default
toor# emerge app-admin/sysklogd && rc-update add sysklogd default  && emerge sys-process/cronie && rc-update add cronie default && crontab /etc/crontab && emerge sys-apps/mlocate && rc-update add sshd default && emerge net-misc/dhcpcd && rc-update add dhcpd default && emerge sys-boot/grub:2 && grub-install /dev/sda
toor# grub-mkconfig -o /boot/grub/grub.cfg
toor# nano -w /etc/conf.d/net
  config_eno6777777="dhcp"

Read /usr/share/doc/netifrc-*/net.example.bz2 for a list of all available options. Be sure to also read up on the DHCP client man page if specific DHCP options need to be set.

If the system has several network interfaces, then repeat the above steps for config_eth1, config_eth2, etc.

toor# cd
toor# exit
toor# umount -l /mnt/gentoo/dev{/shm,/pts,} && umount /mnt/gentoo{/boot,/sys,/proc,}
toor# reboot
toor# emerge -s joe
toor# emerge app-editors/joe
using upgrade to plasma 
toor# eselect profile list
 select plasma
toor# eselect profile set 8
toor# grep -e "qt[[:digit:]]" -e "handbook" -e "kde" -e "plasma" /etc/portage/make.conf

remove ocurrences if exist

toor# grep -e "qt[[:digit:]]$" -e "qt[[:digit:]] " -e "handbook$" -e "handbook " -R /etc/portage/package.use
toor# grep -e "kde$" -e "kde " -e "plasma$" -e "plasma " -R /etc/portage/package.use
toor# emerge app-portage/gentoolkit
toor# for x in libkscreen kde-gtk-config ksshaskpass freespacenotifier kcheckpass kcminit kdebase-cursors kdebase-startkde kdm kephal khotkeys kinfocenter klipper kmenuedit krunner kscreensaver ksmserver ksplash kstartupconfig kstyles ksysguard ksystraycmd kwin kwrited libkgreeter libkworkspace liboxygenstyle libplasmaclock libplasmagenericshell libtaskmanager plasma-workspace powerdevil qguiplatformplugin_kde solid-actions-kcm systemsettings; do equery -q d ${x} | sed -e "s/-[0-9].*//"; done | sed -e "/kdebase-meta/g" -e "/kde-meta/g" | xargs emerge --deselect --pretend
 ...

all working ok so do it with out --pretend

toor# ...
toor# emerge --changed-use --newrepo --deep world
...
lot of time
...
toor# emerge kde-plasma/plasma-meta && emerge kde-plasma/plasma-desktop

usr$ joe ~/.xinitrc
  exec startkde
usr$ startx


Until here i have kde-plasma installed but ill need more customization since i started x and some very simple desktop environmnet showed to me but for now i think this is finish for step one.

Dont forget that this were realized for a VM environment in an actual Machine several more configuration has to be done and this is only the bare bones of the most basic install.

After all of these for me it was way more simple to install OpenBSD than Gentoo or Arch linux it seems that Gentoo its for super geeks, Arch for Geeks.

references
https://wiki.gentoo.org/wiki/Systemd
https://wiki.gentoo.org/wiki/Hardened_Gentoo
https://wiki.gentoo.org/wiki/Project:Hardened_uClibc
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/System
https://wiki.gentoo.org/wiki/KDE/Plasma_5_upgrade#Preparations

No comments:

Post a Comment