Gentoo Linux Installation Details

Source: Internet
Author: User
Tags syslog ssh secure shell

1. Prepare for remote Logon:

  • Enable the ssh service:
/etc/init.d/sshd start
  • Set password:
passwd

So that you can use putty and ssh client to remotely log on to the upload stage (sometimes online download is slow, while local area network upload is fast)

Prepare a disk:
  • Partition:
fdisk /dev/sda

/Dev/sda1:/boot 100 M (32-100 M) set startup notes-
/Dev/sda2:/20G
/Dev/sda3:/home 20G
/Dev/sda5:/swap 1 GB (memory <512 MB, partitions are allocated 2 times the memory size;> 1024 MB, you can allocate less space or even do not need swap partitions .) -T 82

  • Create a file system:
mkfs.ext4 /dev/sda1mkfs.ext4 /dev/sda2mkfs.ext4 /dev/sda3mkswap /dev/sda5
  • Mount partition:
mount /dev/sda2 /mnt/gentoomkdir /mnt/gentoo/bootmount /dev/sda1 /mnt/gentoo/bootmkdir /mnt/gentoo/homemount /dev/sda3 /mnt/gentoo/homeswapon /dev/sda5
2. Install the system installation stage and portage:
  • Set date/time correctly:
date

If the displayed date/time is incorrect, use the date MMDDhhmmYYYY command.

  • Download Stage3 Tarbll:
cd /mnt/gentoolinks http://www.gentoo.org/main/en/mirrors.xml

Select a domestic fast image and go to the releases/x86/autobuilds/directory. You will see all the stage files suitable for your computer architecture (they may also be placed in subdirectories of individual sub-system names ). Select one and press D to download it. After the download, press Q to exit the browser.

Or use SSH Secure Shell to log on and upload the stage3 file.

  • Unlock Stage3 Tarball:
tar xvjpf stage3-*.tar.bz2
  • Download Portage:
    links http://www.gentoo.org/main/en/mirrors.xml

    Or use SSH Secure Shell to log on and upload the portage file.

    • Unzip the Portage:
    tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr (install a Portage snapshot)
    Preparations before Compilation:
    • Configure compilation options:
     nano -w /mnt/gentoo/etc/portage/make.conf

    CFLAGS = "-march = native-O2-pipe"
    CXXFLAGS = "$ {CFLAGS}" # use the same settings for the two variables
    MAKEOPTS = "-j3" # MAKEOPTS defines the number of parallel compilations that can be generated when the software is installed. Adding one to the number of CPUs is a good choice.

    View cpu information:

    cat proc/cpuinfo
    • Select an image site:
    mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.confmirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf 
    • Copy DNS information:
    cp -L /etc/resolv.conf /mnt/gentoo/etc/
    3. Chroot enters the new system environment: Chroot:
    • Mount the/proc,/dev,/sys file system:
    mount -t proc none /mnt/gentoo/procmount --rbind /dev /mnt/gentoo/devmount --rbind /sys /mnt/gentoo/sys
    • Enter the new system environment:
    chroot /mnt/gentoo /bin/bashsource /etc/profileexport PS1="(chroot) $PS1"
    New Environment Configuration:
    • Update the portage tree:
    Emerge -- sync (Updating the Portage tree) or emerge-webrsync (fetch the latest portage snapshot)
    • Select Profile:
    eselect profile listeselect profile set ×
    • Set the time zone:
    ls /usr/share/zoneinfoecho "Europe/Brussels" > /etc/timezoneemerge --config sys-libs/timezone-data
    • Set locale:
     nano -w /etc/locale.genlocale-gen
    • Update environment variables:
    env-update && source /etc/profile
    4. Compile the kernel:
    • Install the kernel source code:
      emerge gentoo-sourcesls -l /usr/src/linuxManually compile the kernel:
      cd /usr/src/linuxmake menuconfig
      • Required options:

        Other options can be added as needed. If you do not know how to keep the default value, you can:

      • Compile the kernel and module:
      make && make modules_install
      • Copy the kernel to the boot partition:
      cp arch/x86_64/boot/bzImage /boot/kernel-3.10.10-gentoo
      Use genkernel to compile the kernel:
      emerge genkernel
      • Optional. Copy the Kernel configuration file on the installation CD:
      zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config
      • Compile:
      genkernel --menuconfig all 

      Once genkernel is run, a kernel including all modules and initrd will be created. We will use this kernel and initrd When configuring the boot program later. Write down the name of the kernel and initrd because you will use them when configuring the boot program. Initrd will automatically identify the hardware before starting the real system (just like installing a CD ).

      ls /boot/kernel* /boot/initramfs*
      5. configure system information:
      • File System Information:
        nano -w /etc/fstab
        • Network Information:

        Host name, Domainname, etc

        nano -w /etc/conf.d/hostname

        Grouping Network

        nano -w /etc/conf.d/net
        • System Information:

        Gentoo uses/etc/rc. conf to configure the services, startup, and shutdown of your system.

        nano -w /etc/rc.conf

        Root Password

         passwd

        Gentoo uses/etc/conf. d/hwclock to set clock options.

        nano -w /etc/conf.d/hwclock
        Install system tool software:
        • Optional: PCMCIA use lspci to view hardware information:
        emerge pcmciautils
        • System Logger:
        emerge syslog-ngrc-update add syslog-ng default
        • Optional: File Indexing:
        emerge mlocate
        • Optional: Remote Access:
        rc-update add sshd default
        • Optional: DHCP Client:
        emerge dhcpcd
        Configure the startup Item:
        • Using GRUB2:
        emerge sys-boot/grubgrub2-install /dev/sda

        Generating GRUB2 configuration:

        grub2-mkconfig -o /boot/grub/grub.cfg
        • Optional: Using GRUB Legacy:
        emerge sys-boot/grub:0

        Edit the configuration file:

        nano -w /boot/grub/grub.conf

        Example grub. conf:

        # Which list is selected by default for guidance. 0 indicates the first, 1 indicates the second, and so on. Default 0 # How many seconds to wait before guiding the default list timeout 30 # use a pretty, "bloated" spalsh image to add a little fun :) # If you do not have a video card installed, comment out splashimage = (hd0, 0)/boot/grub/splash.xpm.gz title Gentoo Linux 3.10.10 # root (hd0, 0) partition of the kernel image (or operating system) kernel/boot/kernel-3.10.10-gentoo root =/dev/sda2title Gentoo Linux 3.10.10 (rescue) # root (hd0, 0) partition where the kernel image (or operating system) is located) kernel/boot/kernel-3.10.10-gentoo root =/dev/sda2 init =/bin/bb # The next four lines are required only when you have dual boot with Windows. # In this example, the windows system is located in/dev/sda6. Title Windows XProotnoverify (hd0, 5) makeactivechainloader + 1 # comment out makeactive under win7

        Setting up GRUB using grub-install:
        Creating/etc/mtab:

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

        Install GRUB:

        grub-install --no-floppy /dev/sda
        Restart the system:
        exitcdumount -l /mnt/gentoo/dev{/shm,/pts,}umount -l /mnt/gentoo{/boot,/proc,}reboot
        6. install X Desktop Environment: Install Xorg:
        • Detect video card information:
        dmesg | grep videolspci  | grep -i VGA
        • Configure the INPUT_DEVICE and VIDEO_CARDS variables:
          (For mouse, keyboard, and Synaptics touchpad support) INPUT_DEVICE = "evdev synaptics" (For nVidia graphics cards) VIDEO_CARDS = "nvidia" (or, For ATI Radeon graphics cards) VIDEO_CARDS = "radeon" (vmwarevm) VIDEO_CARDS = "vmware" (VirtualBox VM) VIDEO_CARDS = "virtualbox"
          • Install xorg-server"
          emerge -pv xorg-drivers

          First of all, make sure udev is in your USE flags:

          echo "x11-base/xorg-server udev" >> /etc/portage/package.use

          Note: The keyboard and mouse are replaced with evdev in the latest version of Xorg (later than 1.5) to ensure that the udev flag is enabled when xorg-server is installed.

          Next, install Xorg:

          emerge -av xorg-server
          • Update environment variables:
          env-update source /etc/profile
          • Use startx:
            emerge -v twm xtermstartxInstall the desktop environment:
            • Lxde:

            • Awesome:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.