gentoo安装流程

2021-02-20 05:36发布

##1、配置网络 使之可以连上internet

##2、硬盘准备 a.分区 /boot swap /

         b.格式化mkfs.ext2  /dev/sda1 

                mkfs.ext3  /dev/sda3 

                mkswap  /dev/sda2

                swapon  /dev/sda2          

          c.挂载  mount /dev/sda3  /mnt/gentoo

                mkdir /mnt/gentoo/boot

                mount /dev/sda3  /mnt/gentoo/boot

##3、安装gentoo的安装文件

          a.下载  stage tarball  在/mnt/gentoo目录下解压

          b.配置编译选项  nano -w /mnt/gentoo/etc/portage/make.conf 把CFLAGS设为  CFLAGS="-march=k8 -O2 -pipe 

##4、安装gentoo系统

          a.chrooting     mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

                          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

                          source /etc/profile

                          export PS1="(chroot) $PS1"

          b.配置 portage

                          emerge-webrsync    emerge --sync

          c.配置时区

           ls /usr/share/zoneinfo

          (Suppose you want to use Europe/Brussels)

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

           (Next set the timezone)

           echo "Europe/Brussels" > /etc/timezone 

##5、配置kernel

           cd /usr/src/linux

           make menuconfig   

           make && make modules_install

           cp arch/x86_64/boot/bzImage /boot/kernel-3.4.9-gentoo

           emerge genkernel

           genkernel --install initramfs

           或者 genkernel all

##6、配置系统

           a.修改 /etc/fstab

           /dev/sda1   /boot        ext2    defaults,noatime     0 2

           /dev/sda2   none         swap    sw                   0 0

           /dev/sda3   /            ext4    noatime              0 1



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



          b.网络配置

          nano -w /etc/conf.d/hostname

          nano -w /etc/conf.d/net

          dns_domain_lo="homenetwork"

          config_eth0="dhcp"

          cd /etc/init.d

          ln -s net.lo net.eth0

          rc-update add net.eth0 default

          c.系统信息

          设置:passwd   keymaps  hwclock  locales

##7、安装必要的系统工具

           emerge syslog-ng

           rc-update add syslog-ng default

          

           emerge vixie-cron

           rc-update add vixie-cron default

          

           emerge mlocate

          

           nano -w /etc/inittab

             

           emerge dhcpcd

##8、配置bootloader

          emerge sys-boot/grub:0

          

          title Gentoo Linux 3.4.9

          root (hd0,0)

          kernel /boot/3.4.9 real_root=/dev/sda3

          initrd /boot/initramfs-genkernel-amd64-3.4.9-gentoo

          

          grep -v rootfs /proc/mounts > /etc/mtab

          echo "(hd0) /dev/vda" >> /boot/grub/device.map

          grub-install --no-floppy /dev/sda



          grub> root (hd0,0)    (Specify where your /boot partition resides)

          grub> setup (hd0)     (Install GRUB in the MBR)

          

          grub> quit            (Exit the GRUB shell)

##9、完成gentoo安装

          a.设置root密码

          Login: root

          Password: (Your root password)

          b.添加用户 

           useradd -m -G users,wheel,audio -s /bin/bash john

           passwd john

          Password: (Enter the password for john)

          Re-enter password: (Re-enter the password to verify)

          c.删除tarball

          rm /stage3-*.tar.bz2*
标签: