Инсталация на Gentoo x86_x64
Търсене:
search   add   edit   back

# eclean distfiles

# eclean packages

# emerge --deselect app-emulation/vmware-workstation

# USE="-harfbuzz" emerge -av freetype

# emerge --autounmask=y --autounmask-write -av alsa-mixer 

# etc-update

 

# dd status=progress if=/dev/sdg of=/mnt/extdisk/Dil.img bs=512 count=295520256 conv=sync,noerror

 

make LD=ld.bfd

 

# emerge --ask --autounmask-write =sys-libs/gdbm-1.18.1

 

 python -m pip install --upgrade pip

# flaggie sys-devel/binutils +default-gold

# emerge -av binutils

#  binutils-config -l

Add to /etc/portage/make.conf < LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=gold"

# . /etc/profile

 

USE="multilib" FEATURES="-sandbox" emerge gcc portage

 

3G Vivacom modem
OpenPGP and X.509 - CN=Tsvetomir Simeonov,EMail=ceco@spirka.net,OU=IT operations,O=Spirka.Net.,L=Sofia,C=BG
wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin -O /lib/firmware/rtlwifi/rtl8188eufw.bin
http://www.siscal.net/etoken.htm
Opensc - https://nilsschneider.net/2013/06/20/epass2003-quickstart.html
Openpgp - https://spin.atomicobject.com/2014/02/09/gnupg-openpgp-smartcard/
HDD speed test
Read: # sync;dd if=/dev/sdb of=/dev/null bs=1M count=4096;sync
Write: # sync;dd if=/dev/zero of=tempfile bs=1M count=4096;sync

Gentoo linux Smart card (smartcard) install
# USE="usb"
emerge -av app-crypt/ccid
# USE="smartcard"
emerge -av app-crypt/gnupg

dd if=/dev/zero|pv -s 1T|dd of=/dev/sdX
sudo rfkill unblock all
USE="-systemd" emerge -av


XEN other installation howto
XEN other installation howto
XEN installatin over Gentoo

Apache upgrade from 2.2 to 2.4

# eselect php list apache2
# eselect php list cli
# eselect php list cgi
# eselect php set apache2 php5.5
# eselect php set cli php5.5
# eselect php set cgi php5.5
# eselect kernel list
# eselect kernel set 1 # eselect locale list
# gcc-config -l
# gcc-config 1
 
# binutils-config -l
# binutils-config 1

# emerge --oneshot libtool

# rm /var/cache/revdep-rebuild/*
# revdep-rebuild -v
flaggie dev-python/pip +vanilla
eselect python update
eselect python cleanup eselect python list
eselect python set 1
eselect python cleanup
Perl update:
# emerge --unmerge perl
# emerge -av perl
# perl-cleaner --allmodules
# emerge --pretend --depclean --verbose perl
Software RAID howto
 
TinyGentoo
Realtime gentoo
Generate SSH personal key (if no password, stay empty prompt for password)
# ssh-keygen -t rsa -b 4096

Udev 2.0
net.ifnames=0 in kernel row in /boot/grub/grub.conf

Edit /etc/default/grub
At the end of GRUB_CMDLINE_LINUX line append "net.ifnames=0 biosdevname=0"
grub-mkconfig -o /boot/grub/grub.cfg
"
reboot


Описание за инсталация на Gentoo x86


Update на системата:
# emerge -av --update --deep --newuse --with-bdeps=y @world

Създаване на дялове:
# cfdisk /dev/sda
Правят се дялове съответно:
/dev/sda1 - Swap - Големина колкото е RAM паметта.
/dev/sda2 - ROOT - Големина от 15 до 30ГБ.
/dev/sda3 - HOME - Големина до запълване на диска.


Форматиране на дялове:
# mkfs.reiserfs /dev/sda2 # mkfs.reiserfs /dev/sda3
# mkswap /dev/sda1
# swapon /dev/sda1

Монтиране:
# mount /dev/sda2 /mnt/gentoo # mkdir /mnt/gentoo/boot
Сверяване на часа:
# date

Сваляне на файловете:

# cd /mnt/gentoo
# links http://www.gentoo.org/main/en/mirrors.xml
# tar xvjpf stage3-*.tar.bz2 or tar xJfv stage3-*.tar.xz
# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

Конфигурационни на файлове:
# nano -w /mnt/gentoo/etc/make.conf
-----------------------------------------
CFLAGS="-O2 -march=i686 -pipe" CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2" # Където j2 e броя ядра +1
-----------------------------------------


# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
# mount -t proc none /mnt/gentoo/proc
# mount --rbind /dev /mnt/gentoo/dev

# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"

# emerge --sync
# eselect profile list
# eselect profile set 2
# nano /etc/conf.d/keymaps
----------------------------------
#KEYMAP="us"
KEYMAP="bg_pho-utf8"
DUMPKEYS_CHARSET="iso-8859-1"
----------------------------------


# cp /usr/share/zoneinfo/Europe/Sofia /etc/localtime
# nano /etc/conf.d/clock
----------------------------------
CLOCK="local"
TIMEZONE="Europe/Sofia"
----------------------------------


# nano /etc/env.d/02locale
----------------------------------
LC_ALL="bg_BG.UTF-8"
LANG="bg_BG.UTF-8"
----------------------------------


# nano /etc/locale.gen

----------------------------------
bg_BG.UTF-8 UTF-8
en_US.UTF-8 UTF-8
---------------------------------
-

# locale-gen
# nano /etc/conf.d/consolefont

----------------------------------
#CONSOLEFONT="default8x16"
CONSOLEFONT="Cyr_a8x16"
----------------------------------


# env-update && source /etc/profile

Инсталиране на минимална конфигурация:
# nano /etc/make.conf
-----------------------------------
USE = "-ipv6"
ACCEPT_LICENSE="* -@EULA"
-----------------------------------

# emerge -av dhcpcd \
reiserfsprogs \
ppp \
flaggie \
gentoolkit \
sys-kernel/genkernel \
app-misc/mc \
sys-fs/squashfs-tools \
lynx \
links \
nmap \
mlocate \
app-admin/syslog-ng \
app-admin/logrotate \
iptraf-ng \
iptables \
openvpn \
bind-tools \
rexima \
media-sound/alsa-tools \
net-analyzer/traceroute \
sys-apps/hdparm \
net-misc/ntp \
sys-process/htop \
dosfstools \
sys-fs/ntfs3g \
net-misc/netkit-telnetd \
sys-process/vixie-cron \
sys-apps/pciutils \
grub \
gentoo-sources \
sys-apps/usbutils
# export LC_ALL=C genkernel initramfs
Кернел трикове:
# eselect kernel list
  [1]   linux-3.1.6
  [2]   linux-3.0.6

# eselect kernel set 1 # dispatch-conf
# emerge gentoo-sources
# genkernel --bootloader=grub --kernel-config=/boot/.config all
# genkernel --bootloader=grub --kernel-config=/boot/.config --dmraid all
- Ако има райд масив
# genkernel --bootloader=grub --kernel-config=/boot/.config --mdadm all - Intel RAID
# zcat /proc/config.gz > /usr/src/linux/.config
Removing older kernels:
# emerge -P gentoo-sources

Инсталиране на bootloader
# emerge grub
# grep -v rootfs /proc/mounts > /etc/mtab
  

Grub 1

# nano -w /boot/grub/grub.conf
----------------------------------
default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.6.11-gentoo root=/dev/sda1 real_root=/dev/sda1
initrd /boot/initramfs-genkernel-x86_64-3.6.11-gentoo
title Windows XP rootnoverify (hd0,3) makeactive chainloader +1
----------------------------------
Grub 2
# grub-mkconfig -o /boot/grub/grub.cfg

# grub2-install --no-floppy /dev/sda

# nano -w /etc/fstab
----------------------------------
# /dev/BOOT             /boot           ext2            noauto,noatime  1 2
/dev/sda1 / reiserfs noatime 0 1
/dev/sda2 none swap sw 0 0
/dev/sda3 /home reiserfs noatime 0 1
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
/dev/fd0 /mnt/floppy auto noauto 0 0
----------------------------------
UEFI
# fdisk /dev/nvme0n1
Make new partition with size 256M and type 1 
# grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --no-nvram --removable

# rc-update add sshd default
# rc-update add vixie-cron default
# rc-update add syslog-ng default
# passwd root

# reboot
Монтиране на SFTP и FTP: # emerge sys-fs/sshfs-fuse To mount a remote host's file system through SSH at a local mount point, all you have to do is type: sshfs [user@]host:[dir] mountpoint To allow access to mountpoint for non-root users simply execute:
sshfs [user@]host:[dir] mountpoint -o allow_other
To unmount a remote host's file system type:
fusermount -u mountpoint
emerge -av net-fs/curlftpfs
CurlFtpFS uses typical FTP syntax:
curlftpfs ftp://ftp.gentoo.org/ /path/to/mountpoint
To unmount an ftp host:
fusermount -u /path/to/mountpoint/
A better way is use mount and umount. To do this the following lines need to be added to /etc/fstab:
File: /etc/fstab
curlftpfs#user:password@server.tld/remote/path /mount/point fuse user,disable_eprt,noauto
curlftpfs#user:password@server.tld/remote/path /mount/point fuse.curlftpfs user,disable_eprt,noauto

Remote desktop:
# emerge -av nxserver-freenx
# nxsetup
# cp /var/lib/nxserver/home/.ssh/authorized_keys2 /var/lib/nxserver/home/.ssh/authorized_keys2
# cat /etc/ssh/sshd_config
===================================================
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
===================================================
# /etc/init.d/sshd restart
# /etc/init.d/nxserver restart
# rc-update add nxserver default


Криптиран отдалечен дисков бекъп ПОДРОБНО

Към 2 интернет доставчика
Intel RAID
# grub --no-floppy grub> device (hd0,1) /dev/md1262 grub> device (hd0) /dev/md126 grub> root (hd0,1)  Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)  Checking if "/boot/grub/stage1" exists... yes  Checking if "/boot/grub/stage2" exists... yes  Checking if "/boot/grub/e2fs_stage1_5" exists... yes  Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  18 sectors are embedded.   succeeded  Running "install /boot/grub/stage1 (hd0) (hd0)1+18 p   (hd0,1)/boot/grub/stage2   /boot/grub/menu.lst"... succeeded  Done.
За INTEL Raid


Equery
# equery check gentoolkit - проверява дали са налични всички файлове от пакета
# equery depends pygtk - показва зависимостите за пакета
# equery depgraph gnome - показва дървовидно зависимостите
#
equery files --tree gentoolkit - показва инсталираните файлове като дърво
#
equery hasuse gtk - показва пакетите които са зависими от дадения
#
equery list '*' - всички инсталирани пакети
# equery size nmap - показва колко пространство заема пакета на диска
# equery f nmap - показва кои файлове инсталира пакета

Gentoo Linux LiveUSB HOWTO
# fdisk -l /dev/sdc
Disk /dev/sdc: 2063 MB, 2063597056 bytes 255 heads, 63 sectors/track, 250 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 250 2008124+ 6 FAT16

# emerge -av sys-fs/dosfstools
# mkdosfs -F 16 /dev/sdc1
# emerge -av '>sys-boot/syslinux-3'
# dd if=/usr/share/syslinux/mbr.bin of=/dev/sdc
# mkdir -p /mnt/cdrom
# mount -o loop,ro -t iso9660 /path/to/iso.iso /mnt/cdrom
# mkdir -p /mnt/usb
# mount -t vfat /dev/sdc1 /mnt/usb
# cp -r /mnt/cdrom/* /mnt/usb
# mv /mnt/usb/isolinux/* /mnt/usb
# mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg
# rm -rf /mnt/usb/isolinux*
# mv /mnt/usb/memtest86 /mnt/usb/memtest
# umount /mnt/cdrom

# sed -i \
 -e "s:cdroot:cdroot slowusb:" \
 -e "s:kernel memtest86:kernel memtest:" \
 /mnt/usb/syslinux.cfg

# umount /mnt/usb
# syslinux /dev/sdc1

How to use duplicity for encript remote backups

Gpg key generation
gpg --gen-key
gpg --list-keys
gpg --export C24CF42A > ceco_gpg.key
gpg --import ceco_gpg.key
gpg --send-keys C24CF42A
gpg --recv-keys C24CF42A

duplicity --encrypt-key C24CF42A full /home/Tmp/ ssh://spirka:password@stil-m.com:2222/home/spirka

duplicity --encrypt-key C24CF42A incremental /home/Tmp/ ssh://spirka:password@stil-m.com:2222/home/spirka
duplicity --encrypt-key C24CF42A restore ssh://spirka:password@stil-m.com:2222/home/spirka
/home/Tmp/

 

Grub 1 - Intel RAID

Boot with: gentoo domdadm nodmraid

# emerge -av mdadm

# mdadm --detail-platform

# cat /proc/mdstat# echo 'DEVICE /dev/sda /dev/sdb' >> /etc/mdadm.conf

# mdadm --detail --scan >> /etc/mdadm.conf

# nano -w /etc/init.d/killprocs

----------------------------------------------------

#!/sbin/openrc-run

# Copyright (c) 2007-2008 Roy Marples

# Released under the 2-clause BSD license.

description="Kill all processes so we can unmount disks cleanly." depend()

{

keyword -prefix

}

start()

{

local omit=`pidof mdmon | sed -e 's/ /,/g' -e 's/./-o \0/'`

ebegin "Terminating remaining processes"

killall5 -15 $omit ${killall5_opts}

sleep 1

eend 0

ebegin "Killing remaining processes"

killall5 -9 $omit ${killall5_opts}

sleep 1

eend 0

}

---------------------------------------------------


# nano -w /etc/conf.d/killprocs

----------------------------------------------------------------

killall5_opts="`pidof mdmon | sed -e 's/ /,/g' -e 's/./-o \0/'`"

----------------------------------------------------------------

 

# nano -w /etc/init.d/mdadm-shutdown

----------------------------------------------
#!/sbin/runscript

depend()

{

after mount-ro

}  

start()

{ ebegin "Shutting down mdadm"

mdadm --wait-clean --scan --quiet

eend $?

}

----------------------------------------------

# chmod +x /etc/init.d/mdadm-shutdown

# rc-update add mdadm-shutdown shutdown # ln -s /dev/md126p2 /dev/md1262

# grub --no-floppy

grub> device (hd0,1) /dev/md1262

grub> device (hd0) /dev/md126

grub> root (hd0,1)

Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)

Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes

Checking if "/boot/grub/e2fs_stage1_5" exists... yes

Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 18 sectors are embedded.

succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+18 p

(hd0,1)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded

 

Done. grub> quit

GRUB 2

If you chose the RAID metadata style 1.x, you will most certainly be working with Grub2 now. First things first: The configuration files have changed! There is no longer a /boot/grub/grub.conf! Grub2 has its configuration scripts in /etc/grub.d . There are also the autodetection scripts, which will fail in this case as they won't include the necessary flags for genkernel and your raid device won't be activated. So you need to edit

File: /etc/grub.d/10_linux , line 108
linux   ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} dolvm domdadm

Here we added dolvm domdadm. They tell genkernel to search for lvms and mdadm software raids and activate them. Otherwise, even if you chose the options in /etc/genkernel.conf, it won't get automatically activated. You choose the capabilities of your genkernel with /etc/genkernel.conf, but the choice of what gets activated you have to pass along with the boot arguments.

The method above is out-dated.You dont't need to hack the grub scripts, just edit

File: /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="dolvm domdadm"

Now you need to run genkernel and get your kernel in the /boot directory. Running grub-mkconfig will create your configuration according to your files in /etc/grub.d . Most likely, the result will be to your liking and you can write the output to your grub configuration file /boot/grub/grub.cfg:

grub2-mkconfig -o /boot/grub/grub.cfg
Note: If you have a bios_grub partition, Grub2 will find it and overwrite parts of it, so just make sure it's big enough - if you are unsure go back to the beginning and start reading the documentation for real this time!

A quick (you have to substitute /dev/sdX with your actual raid members, one command for each!)

grub2-install --force /dev/md/System_0

should install Grub2 into your disks.


GPT
root # gdisk /dev/sda
Create GPT partition table:
Command: o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y ↵

Create Partition 1 (/boot):
Command: n ↵
Partition Number: 1 ↵
First sector: ↵
Last sector: +128M ↵
Hex Code: ↵

Create Partition 2 (BIOS boot):
Command: n ↵
Partition Number: 2 ↵
First sector: ↵
Last sector: +2M ↵
Hex Code: EF02 ↵

Create Partition 3 (swap):
Command: n ↵
Partition Number: 3 ↵
First sector: ↵
Last sector: +1024MB ↵
Hex Code: 8200 ↵

Create Partition 4 (/):
Command: n ↵
Partition Number: 4 ↵
First sector: ↵
Last sector: ↵ (for rest of disk)
Hex Code: ↵

Write Partition Table To Disk:
Command: w ↵
Do you want to proceed? (Y/N): Y ↵

Format the partitions:

root # mkfs.ext4 /dev/sda1
root #mkfs.ext4 /dev/sda4
root #mkswap /dev/sda3 && swapon /dev/sda3
portage EAPI
emerge openssl --autounmask-write --autounmask
emerge -av --oneshot --nodeps portage
XFS (xfs) compat format with old kernel - mkfs.xfs -m reflink=0 -m crc=0 -f /dev/sde1
Total update!
# emerge --sync


 cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime