Akagi201
8/27/2014 - 10:13 PM

gentoo-install.md

  1. 下载install-amd64-minimal-20140821.iso
  2. 创建virtualbox虚拟机, 150G硬盘
  3. gentoo
  4. ifconfig -> enp0s3
  5. parted -a optimal /dev/sda
  6. mklabel gpt
  7. unit mib
  8. mkpart primary 1 3
  9. name 1 akgrub
  10. set 1 bios_grub on
  11. mkpart primary 3 1027
  12. name 2 akboot
  13. mkpart primary 1027 3075
  14. name 3 akswap
  15. mkpart primary 3075 -1
  16. name 4 akrootfs
  17. print
  18. quit
  19. mkfs.ext2 /dev/sda2
  20. mkfs.ext4 /dev/sda4
  21. mkswap /dev/sda3
  22. swapon /dev/sda3
  23. mount /dev/sda4 /mnt/gentoo
  24. mkdir /mnt/gentoo/boot
  25. mount /dev/sda2 /mnt/gentoo/boot
  26. cd /mnt/gentoo
  27. wget http://mirrors.163.com/gentoo/releases/amd64/current-iso/stage3-amd64-20140821.tar.bz2
  28. tar xvf stage3-amd64-20140821.tar.bz2
  29. nano -w ./etc/portage/make.conf 例子在 /usr/share/portage/config/make.conf.example
CFLAGS="-march=native -O2 -pipe"
MAKEOPTS="-j5"
ACCEPT_LICENSE="*"
ACCEPT_KEYWORDS="~amd64"
USE="systemd"
  1. mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
  2. mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
  3. cp -L /etc/resolv.conf /mnt/gentoo/etc/
  4. mount -t proc proc /mnt/gentoo/proc
  5. mount --rbind /sys /mnt/gentoo/sys
  6. mount --rbind /dev /mnt/gentoo/dev
  7. chroot /mnt/gentoo /bin/bash
  8. source /etc/profile
  9. export PS1="(chroot) $PS1"
  10. emerge-webrsync
  11. eselect news read
  12. emerge --sync --quiet
  13. eselect profile list echo "Asia/Shanghai" > /etc/timezone emerge --config sys-libs/timezone-data nano -w /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8

locale-gen eselect locale list eselect locale set 5 env-update && source /etc/profile nano -w /etc/fstab

/dev/sda2   /boot        ext2    defaults,noatime     0 2
/dev/sda3   none         swap    sw                   0 0
/dev/sda4   /            ext4    noatime              0 1

/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0


emerge --ask emerge --update --deep --newuse @world
emerge genkernel-next
emerge linux-firmware
emerge gentoo-sources
cd /usr/src/linux
make menuconfig

CONFIG_AUTOFS4_FS CONFIG_CGROUP_FREEZER CONFIG_CGROUP_DEVICE CONFIG_RESOURCE_COUNTERS CONFIG_CGROUP_SCHED CONFIG_CGROUP_PERF CONFIG_FANOTIFY CONFIG_GENTOO_LINUX_INIT_SYSTEMD CONFIG_IPV6 CONFIG_CMDLINE_BOOL

make && make modules_install
make install
genkernel --install initramfs
passwd
echo "akgentoo" > /etc/hostname
emerge -1av systemd
ln -sf /proc/self/mounts /etc/mtab

if you want to check for unneeded packages, do "emerge -cav"

emerge iproute2
emerge dhcpcd
emerge -C sysvinit
emerge -C openrc
emerge -C net-tools
emerge sys-apps/systemd-sysv-utils

emerge sys-boot/grub
/etc/default/grub
# Append parameters to the linux kernel command line
GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

grub2-install /dev/sda
grub2-mkconfig -o /boot/grub/grub.cfg

exit
cd
umount -l /mnt/gentoo
halt
取出iso

###
ip link set enp0s3 up
ip addr add 192.168.1.102/24 dev enp0s3
ip route add default via 192.168.1.1

ip link set dev enp0s3 up
ip addr add 192.168.1.102/24 broadcast 192.168.1.255 dev enp0s3
ip route add default via 192.168.1.1


vim /etc/conf.d/network@enp0s3
address=192.168.1.102
netmask=24
broadcast=192.168.1.255
gateway=192.168.1.1

vim /etc/systemd/system/network@.service

[Unit]
Description=Network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network@%i

ExecStart=/bin/ip link set dev %i up
ExecStart=/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i
ExecStart=/bin/sh -c 'test -n ${gateway} && /bin/ip route add default via ${gateway}'

ExecStop=/bin/ip addr flush dev %i
ExecStop=/bin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

systemctl enable network@enp0s3

## Using dhcpcd
systemctl start dhcpcd@enp0s3
systemctl enable dhcpcd@enp0s3


emerge sudo
useradd -m -G users,wheel,audio -s /bin/bash akagi201
passwd akagi201

visudo 或者 vim /etc/sudoers
root    ALL=(ALL:ALL) ALL
akagi201    ALL=(ALL) NOPASSWD:ALL

systemctl enable sshd.servie


## static ip
you can use NM or networkd or another tool

## install
sudo emerge zsh
sudo usermod -s /bin/zsh root
sudo usermod -s /bin/zsh akagi201
reboot
sudo emerge wget
sudo emerge net-misc/curl
sudo emerge dev-vcs/git
oh my zsh: <curl -L http://install.ohmyz.sh | sh>
spf13-vim: <curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh>
emerge mercurial
emerge go
emerge bzr
emerge texinfo
emerge u-boot-tools
emerge ccache
emerge uuid
emerge eix
emerge dosfstools
emerge gentoolkit

## package.use
# /etc/portage/package.use
dev-libs/boost static-libs
dev-vcs/git subversion perl
dev-vcs/subversion perl -dso

emerge -avt git

emerge samba

<http://wiki.openwrt.org/doc/howto/buildroot.exigence>
asciidoc
bc
binutils
bzip2
fastjar
flex
util-linux
gawk
intltool
jikes
zlib
make
cdrtools
ncurses
openssl
patch
perl-ExtUtils-MakeMaker
rsync
ruby
sdcc
unzip
gettext
libxslt
boost-build
XML-Parser
libusb-compat
bin86
dev86
sharutils
oracle-jdk-bin
b43-fwcutter

## develop libs
lua
libuv
libevent
libnl
json-c
libnet
libnids
libpcap
doxygen
m4
boost
gengetopt
tcpdump
go

## samba
cd /etc/samba
sudo systemctl enable smbd.service

/etc/samba/smb.conf


security = user
[home]
browseable = yes
read only = no
create mask = 0644
directory mask = 0755

sudo pdbedit -a -u akagi201

crossdev

https://wiki.gentoo.org/wiki/Overlay/Local_overlay
mv /etc/portage/package.use /etc/portage/use && mkdir -p /etc/portage/package.use && mv /etc/portage/use /etc/portage/package.use/package.use
sudo crossdev -t arm-linux-gnueabihf


you need to keep openrc installed for now, even if you boot via systemd
iamben: Akagi201: it supplies a script that is used by tools like gcc-config, binutils-config, etc.  you don't want THOSE broken, do you?
06:00 iamben: work is being done to separate it out, but *for now* you should keep openrc installed
iamben: when bugzilla comes back up, search for "functions.sh" to see how the work is coming along
iamben: but for now, don't sweat it, it's a couple hundred kB









#####

42. `emerge systemd --autounmask-write`
43. `mv /etc/portage/._cfg0000_package.use /etc/portage/package.use`
44. `emerge -C ubus`
45. `emerge systemd`

CONFIG_AUTOFS4_FS CONFIG_CGROUPS CONFIG_FANOTIFY ln -sf /proc/self/mounts /etc/mtab

46. `emerge --newuse systemd`
47. `echo "Asia/Shanghai" > /etc/timezone`
48. `emerge --config sys-libs/timezone-data`
49. `nano -w /etc/locale.gen`

en_US ISO-8859-1 en_US.UTF-8 UTF-8

50. `locale-gen`
51. `eselect locale list`
52. `eselect locale set 5`
53. `env-update && source /etc/profile`
54. `emerge genkernel`
55. `nano -w /etc/fstab`

/dev/sda2 /boot ext2 defaults,noatime 0 2 /dev/sda3 none swap sw 0 0 /dev/sda4 / ext4 noatime 0 1

/dev/cdrom /mnt/cdrom auto noauto,user 0 0 ``

  1. genkernel --menuconfig --install initramfs all
CONFIG_AUTOFS4_FS
CONFIG_CGROUP_FREEZER
CONFIG_CGROUP_DEVICE
CONFIG_RESOURCE_COUNTERS
CONFIG_CGROUP_SCHED
CONFIG_CGROUP_PERF
CONFIG_FANOTIFY
CONFIG_GENTOO_LINUX_INIT_SYSTEMD
CONFIG_IPV6
  1. nano -w /etc/conf.d/hostname -> akgentoo
  2. nano -w /etc/conf.d/net
dns_domain_lo="homenetwork"
nis_domain_lo="ak-nisdomain"
  1. emerge --noreplace netifrc
  2. nano -w /etc/portage/make.conf
USE="systemd networkmanager"
  1. emerge networkmanager --autounmask-write
  2. mv /etc/portage/._cfg0000_package.use /etc/portage/package.use
  3. emerge networkmanager

eselect profile list eselect profile set 5 emerge --ask emerge --update --deep --newuse @world emerge genkernel-next emerge linux-firmware genkernel --menuconfig all ln -sf /proc/self/mounts /etc/mtab nano -w /etc/fstab echo “akgentoo” > /etc/hostname emerge -1av systemd emerge iproute2 emerge dhcpcd emerge -C sysvinit emerge sys-apps/systemd-sysv-utils emerge -C openrc emerge -C net-tools emerge sys-boot/grub emerge app-text/tree

To see all packages installed do, cd /var/db/pkg/* && ls -d / | less

To check dependencies, run emerge -pv –depclean “pkg name”

Refs