Install gentoo hard disk


















LVM increases the flexibility offered by the partitioning setup. The installation instructions below will focus on "regular" partitions, but it is good to know LVM is supported if that route is desired.

Visit the LVM article for more details. Newcomers beware: although fully supported, LVM is outside the scope of this guide. While it is possible to mix and match, that goes beyond the scope of this manual. If this suffices as information, the advanced reader can directly skip ahead to the actual partitioning.

Both fdisk and parted are partitioning utilities. Here, fdisk is used since it has a better text-based user interface. Before going to the creation instructions, the first set of sections will describe in more detail how partitioning schemes can be created and mention some common pitfalls. The design of disk partition layout is highly dependent on the demands of the system and the file system s applied to the device. How many partitions and how big very much depends on considering the trade-offs and choosing the best option for the circumstance.

Separate partitions or volumes have the following advantages:. There is no perfect value for swap space size. The purpose of the space is to provide disk storage to the kernel when internal memory RAM is under pressure.

A swap space allows for the kernel to move memory pages that are not likely to be accessed soon to disk swap or page-out , which will free memory in RAM for the current task. Of course, if the pages swapped to disk are suddenly needed, they will need to be put back in memory page-in which will take considerably longer than reading from RAM as disks are very slow compared to internal memory.

When a system is not going to run memory intensive applications or has lots of RAM available, then it probably does not need much swap space. However do note in case of hibernation that swap space is used to store the entire contents of memory likely on desktop and laptop systems rather than on server systems.

If the system requires support for hibernation, then swap space larger than or equal to the amount of memory is necessary. As a general rule, the swap space size is recommended to be twice the internal memory RAM. The faster a disk can swap, the faster the system will run when data in swap space must be accessed.

When choosing between rotational and solid state disks, it is better for performance to put swap on the SSD. Also, swap files can be used as an alternative to swap partitions; this is mostly interesting for systems with very limited disk space.

The instructions below contain the necessary pointers to correctly handle this operation. After partitioning, format the ESP accordingly:. It is a very small 1 to 2 MB partition in which boot loaders like GRUB2 can put additional data that doesn't fit in the allocated storage.

It will not be used in this guide. The example partition layout was mentioned earlier:. Use the p key to display the disk's current partition configuration:. This particular disk was configured to house two Linux filesystems each with a corresponding partition listed as "Linux" as well as a swap partition listed as "Linux swap". Type g to create a new GPT disklabel on the disk; this will remove all existing partitions. For an existing GPT disklabel see the output of p above , alternatively consider removing the existing partitions one by one from the disk.

Type d to delete a partition. The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions p , but it will not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that case, type q immediately and hit Enter and the partition will not be deleted.

Repeatedly type p to print out a partition listing and then type d and the number of the partition to delete it. Eventually, the partition table will be empty:. Type n to create a new partition, followed by 1 to select the first partition.

When prompted for the first sector, make sure it starts from which may be needed for the boot loader and hit Enter. When prompted for the first sector, hit Enter. After all this is done, type t to set the partition type, 2 to select the partition just created and then type in 19 to set the partition type to "Linux Swap".

Finally, to create the root partition, type n to create a new partition. The next step is to run the locale-gen command. To verify that the selected locales are now available, run locale -a. Once done, it is now time to set the system-wide locale settings. Again we use eselect for this, now with the locale module.

With eselect locale list , the available targets are displayed:. Setting the locale will avoid warnings and errors during kernel and software compilations later in the installation. A full Localization guide to provide additional guidance through the locale selection process.

Before getting to configuring kernel sections, it is beneficial to be aware that some devices require additional firmware to be installed on the system before they will operate correctly. This is often the case for network interfaces, especially wireless network interfaces commonly used in both desktop and laptop computers. Modern video chips from vendors like AMD, Nvidia, and Intel, often need external firmware files to be fully functional.

On systems using graphics cards from these vendors, it is wise to emerge this firmware package in order to have it available before configuring and compiling the kernel. In addition to discrete graphics hardware and network interfaces, CPUs also can require firmware updates. Typically this kind of firmware is referred to as microcode. Newer revisions of microcode are sometimes necessary to patch instability, security concerns, or other bugs in CPU hardware.

See the Microcode article for more information on how to apply microcode updates. Manual configuration is explained as the default choice since it is the best way to optimize an environment. The core around which all distributions are built is the Linux kernel. It is the layer between the user programs and the system hardware.

Gentoo provides its users several possible kernel sources. A full listing with description is available at the Kernel overview page. Choose an appropriate kernel source and install it using emerge :. However, this symbolic link will not be created by default. An easy way to create the symbolic link is to utilize eselect's kernel module.

In order to create a symbolic link called linux , use:. Manually configuring a kernel is often seen as the most difficult procedure a Linux user ever has to perform. Nothing is less true - after configuring a couple of kernels no one remembers that it was difficult! However, one thing is true: it is vital to know the system when a kernel is configured manually. Another source of system information is to run lsmod to see what kernel modules the installation CD uses as it might provide a nice hint on what to enable.

Now go to the kernel source directory and execute make menuconfig. This will fire up menu-driven configuration screen. The Linux kernel configuration has many, many sections. Let's first list some options that must be activated otherwise Gentoo will not function, or not function properly without additional tweaks.

We also have a Gentoo kernel configuration guide on the Gentoo wiki that might help out further. These ensure that a minimum of kernel features required for proper functioning is available:. Naturally the choice in the last two lines depends on the selected init system OpenRC vs. It does not hurt to have support for both init systems enabled. Enabling support is possible, but goes beyond the scope of the handbook.

Make sure that every driver that is vital to the booting of the system such as SCSI controller, etc. Next select the exact processor type. It is also recommended to enable MCE features if available so that users are able to be notified of any hardware problems.

Now go to File Systems and select support for the filesystems that will be used by the system. Do not compile the file system that is used for the root filesystem as module, otherwise the system may not be able to mount the partition.

The two compression options won't harm but are not definitely needed, neither does the PPP over Ethernet option, that might only be used by ppp when configured to do kernel mode PPPoE. With the configuration now done, it is time to compile and install the kernel. Exit the configuration and start the compilation process:. This is handled by the make install command:. In certain cases it is necessary to build an initramfs - an initial ram-based file system.

With an initramfs, these partitions can be mounted using the tools available inside the initramfs. Without an initramfs, there is a huge risk that the system will not boot up properly as the tools that are responsible for mounting the file systems need information that resides on those file systems. An initramfs will pull in the necessary files into an archive which is used right after the kernel boots, but before the control is handed over to the init tool.

Scripts on the initramfs will then make sure that the partitions are properly mounted before the system continues booting. See genkernel --help for more information. The resulting file can be found by simply listing the files starting with initramfs :. If a manual configuration looks too daunting, then consider using genkernel. It will configure and build the kernel automatically. This means that when genkernel is used to build the kernel, the system will generally detect hardware it was built for support with at boot-time, just like the installation CD does.

Note that genkernel does not automatically generate a custom kernel configuration the hardware on which it is being run. Now, let's see how to use genkernel. This would make the entry in the file look like so:. Now, compile the kernel sources by running genkernel all.

Be aware though, as genkernel compiles a kernel that supports almost all hardware, this compilation will take quite a while to finish! Once genkernel completes, a kernel, full set of modules and initial ram disk initramfs will be created.

We will use the kernel and initrd when configuring a boot loader later in this document. Write down the names of the kernel and initrd as this information is used when the boot loader configuration file is edited. The initrd will be started immediately after booting to perform hardware autodetection just like on the installation CD before the "real" system starts up. Distribution Kernels are ebuilds that cover the complete process of unpacking, configuring, compiling, and installing the kernel.

The primary advantage of this method is that the kernels are upgraded to new versions as part of world upgrade without a need for manual action. There are other methods available to customize the kernel config such as config snippets. Before using the distribution kernels, please verify that the correct installkernel package for the system is installed. When using systemd-boot formerly gummiboot , install:.

If in doubt:. System administrators who want to avoid compiling the kernel sources locally can instead use precompiled kernel images:. Once the kernel is installed, the package manager will automatically upgrade it to newer versions.

The previous versions will be kept until the package manager is requested to clean up stale packages. Please remember to periodically run:. Distribution kernels are now capable of rebuilding kernel modules installed by other packages.

To view all available modules, run the following find command. For instance, to automatically load the 3c59x. The actual file name is insignificant to the loader. Continue the installation with Configuring the system. This file contains the mount points of those partitions where they are seen in the file system structure , how they should be mounted and with what special options automatically or not, whether users can mount them or not, etc.

Every line consists of six fields, separated by whitespace space s , tabs or a mixture. Each field has its own meaning:.

Partition labels and partition UUIDs can be used to identify the block device's individual partition s , regardless of what filesystem has been chosen for the partition itself. While not always true for partition labels, using a UUID to identify a partition in fstab provides a guarantee that the bootloader will not be confused when looking for a certain volume, even if the filesystem would be changed in the future.

The naming for block device files depends on a number of factors, including how and in what order the disks are attached to the system. They also could show up in a different order depending on which of the devices are detected by the kernel first during the early boot process.

With this being stated, unless one intends to constantly fiddle with the disk ordering, using default block device files is a simple and straightforward approach. This is just an example, and should be modified according to the partitioning decisions made earlier in the installation. It needs to be checked during boot, so we would write down:. Those people should substitute defaults with noauto. This does mean that those users will need to manually mount this partition every time they want to use it.

Add the rules that match the previously decided partitioning scheme and append rules for devices such as CD-ROM drive s , and of course, if other partitions or drives are used, for those too. When auto is used in the third field, it makes the mount command guess what the filesystem would be. This is recommended for removable media as they can be created with one of many filesystems. The user option in the fourth field makes it possible for non-root users to mount the CD. To improve performance, most users would want to add the noatime mount option, which results in a faster system since access times aren't registered those are not needed generally anyway.

This is also recommended for solid state drive SSD users, who should also enable the discard mount option ext4 and btrfs only for now which makes the TRIM command work. This seems to be quite easy, but lots of users are having difficulties finding the appropriate name for their Linux PC.

To speed things up, know that the decision is not final - it can be changed afterwards. In the examples below, the hostname tux is used within the domain homenetwork. To set the system hostname on systemd, run hostnamectl. An alternative to using neticrc is dhcpcd. See Dhcpcd for more details. There are many options available for configuring network interfaces.

This section covers a only a few methods. Choose the one which seems best suited to the setup needed. During the Gentoo Linux installation, networking was already configured.

However, that was for the installation CD itself and not for the installed environment. Right now, the network configuration is made for the installed Gentoo Linux system.

It uses a straightforward yet perhaps not intuitive syntax. But don't fear, everything is explained below. DHCP is used by default. This is described later in Installing Necessary System Tools. If the system has several network interfaces, then the appropriate net. If after booting the system we find out that the assumption about the network interface name which is currently documented as eth0 was wrong, then execute the following steps to rectify this:. Next inform Linux about the network environment.

Set the root password using the passwd command. The root Linux account is an all-powerful account, so pick a strong password. Later an additional regular user account will be created for daily operations.

Review the settings and change where needed. Edit it to configure and select the right keyboard. Take special care with the keymap variable. If the wrong keymap is selected, then weird results will come up when typing on the keyboard. Edit it according to personal preference. Otherwise the system might show clock skew behavior. It's recommended to run systemd-firstboot --prompt --setup-machine-id to ensure the system is setup correctly, but the necessary steps can be run individually too.

Some tools are missing from the stage3 archive because several packages provide the same functionality. It is now up to the user to choose which ones to install. The first tool to decide on has to provide logging facilities for the system. Unix and Linux have an excellent history of logging capabilities - if needed, everything that happens on the system can be logged in log files.

This happens through the system logger. Others are available through Portage as well - the number of available packages increases on a daily basis. To install the system logger of choice, emerge it. On OpenRC, add it to the default runlevel using rc-update. Next is the cron daemon. Although it is optional and not required for every system, it is wise to install one.

A cron daemon executes scheduled commands. It is very handy if some command needs to be executed regularly for instance daily, weekly or monthly. Installing one of them is similar to installing a system logger. To be able to access the system remotely after installation, sshd must be configured to start on boot. To add the sshd init script to the default runlevel on OpenRC:. If serial console access is needed which is possible in case of remote servers , agetty must be configured.

Depending on the filesystems used, it is necessary to install the required file system utilities for checking the filesystem integrity, creating additional file systems etc.

If networking was previously configured in the Configuring the system step and network setup is complete, then this 'networking tools' section can be safely skipped.

In this case, proceed with the section on Configuring a bootloader. In order for the system to automatically obtain an IP address for one or more network interface s using netifrc scripts, it is necessary to install a DHCP client. More information on dhcpcd can be found in the dhcpcd article.

Now continue with Configuring the bootloader. With the Linux kernel configured, system tools installed and configuration files edited, it is time to install the last important piece of a Linux installation: the boot loader. The boot loader is responsible for firing up the Linux kernel upon boot - without it, the system would not know how to proceed when the power button has been pressed. In this section of the Handbook a delineation has been made between emerging the boot loader's package and installing a boot loader to a system disk.

Here the term emerge will be used to ask Portage to make the software package available to the system. The term install will signify the boot loader copying files or physically modifying appropriate sections of the system's disk drive in order to render the boot loader activated and ready to operate on the next power cycle.

With a small amount of configuration, necessary before build time, GRUB2 can support more than a half a dozen additional platforms. The GRUB installer can perform this operation automatically with the --removable option. Verify the ESP is mounted before running the following commands. This creates the default directory defined by the UEFI specification, and then copies the grubx To generate the final GRUB2 configuration, run the grub-mkconfig command:. The output of the command must mention that at least one Linux image is found, as those are needed to boot the system.

If an initramfs is used or genkernel was used to build the kernel, the correct initrd image should be detected as well. If the files are indeed missing, go back to the kernel configuration and installation instructions. However, it lacks features when compared to GRUB. Of course, it is also used because some people know LILO and want to stick with it.

Either way, Gentoo supports both bootloaders. In the configuration file, sections are used to refer to the bootable kernel. Make sure that the kernel files with kernel version and initramfs files are known, as they need to be referred to in this configuration file. If an initramfs is necessary, then change the configuration by referring to this initramfs file and telling the initramfs where the root device is located:. If additional options need to be passed to the kernel, use an append statement.

For instance, to add the video statement to enable framebuffer:. Users that used genkernel should know that their kernels use the same boot options as is used for the installation CD. For instance, if SCSI device support needs to be enabled, add doscsi as kernel option. Such systems do not need to have additional also known as secondary bootloaders like GRUB2 in order to help boot the system.

Using efibootmgr is really for those who desire to take a minimalist although more rigid approach to booting their system; using GRUB2 see above is easier for the majority of users because it offers a flexible approach when booting UEFI systems.

Be sure to read through the EFI stub kernel article before continuing. The kernel must have specific options enabled to be directly bootable by the system's UEFI firmware. It might be necessary to recompile the kernel. It is also a good idea to take a look at the efibootmgr article. With these changes done, when the system reboots, a boot entry called "Gentoo" will be available.

Syslinux is yet another bootloader alternative for the amd64 architecture. It supports MBR and, as of version 6. PXE network boot and lesser-known options are also supported. Although Syslinux is a popular bootloader for many it is unsupported by the Handbook. Readers can find information on emerging and then installing this bootloader in the Syslinux article.

Exit the chrooted environment and unmount all mounted partitions. Then type in that one magical command that initiates the final, true test: reboot. Do not forget to remove the bootable CD, otherwise the CD might be booted again instead of the new Gentoo system.

Once rebooted in the freshly installed Gentoo environment, finish up with Finalizing the Gentoo installation. Therefore it is strongly recommended to add a user for day-to-day use. The groups the user is member of define what activities the user can perform. The following table lists a number of important groups:. For instance, to create a user called larry who is member of the wheel , users , and audio groups, log in as root first only root can create users and run useradd :. If a user ever needs to perform some task as root, they can use su - to temporarily receive root privileges.

With the Gentoo installation finished and the system rebooted, if everything has gone well, we can now remove the downloaded stage3 tarball from the hard disk. Not sure where to go from here? There are many paths to explore Gentoo provides its users with lots of possibilities and therefore has lots of documented and less documented features to explore here on the wiki and on other Gentoo related sub-domains see the Gentoo online section below.

It is important to note that, due to the number of choices available in Gentoo, the documentation provided by the handbook is limited in scope - it mainly focuses on the basics of getting a Gentoo system up and running and basic system management activities.

The handbook intentionally excludes instructions on graphical environments, details on hardening, and other important administrative tasks. That being stated, there are more sections of the handbook to assist readers with more basic functions.

Readers should definitely take a look at the next part of the handbook entitled Working with Gentoo which explains how to keep the software up to date, install additional software packages, details on USE flags, the OpenRC init system, and various other informative topics relating to managing a Gentoo system post-installation.

Apart from the handbook, readers should also feel encouraged to explore other corners of the Gentoo wiki to find additional, community-provided documentation. The Gentoo wiki team also offers a documentation topic overview which lists a selection of wiki articles by category.

For instance, it refers to the localization guide to make a system feel more at home particularly useful for users who speak English as a second language. The majority of users with desktop use cases will setup graphical environments in which to work natively.

There are many community maintained 'meta' articles for supported desktop environments DEs and window managers WMs. Readers should be aware that each DE will require slightly different setup steps, which will lengthen add complexity to bootstrapping. Many other Meta articles exist to provide our readers with high level overviews of available software within Gentoo.

With the exception of the Libera. Chat hosted internet relay chat IRC network and the mailing lists, most Gentoo websites require an account on a per site basis in order to ask questions, open a discussion, or enter a bug. Every user is welcome on our Gentoo forums or on one of our internet relay chat channels.

It is easy to search for the forums to see if an issue experienced on a fresh Gentoo install has been discovered in the past and resolved after some feedback. The likelihood of other users experiencing the installation issues by first-time Gentoo can be surprising. It is advised users search the forums and the wiki before asking for assistance in Gentoo support channels. Several mailing lists are available to the community members who prefer to ask for support or feedback over email rather than create a user account on the forums or IRC.

Users will need to follow the instructions in order to subscribe to specific mailing lists. Sometimes after reviewing the wiki, searching the forums, and seeking support in the IRC channel or mailing lists there is no known solution to a problem. Generally this is a sign to open a bug on Gentoo's Bugzilla site. Readers who desire to learn more about developing Gentoo can take a look at the Development guide.

This guide provides instructions on writing ebuilds, working with eclasses, and provides definitions for many general concepts behind Gentoo development.

Gentoo is a robust, flexible, and excellently maintained distribution. The developer community is happy to hear feedback on how to make Gentoo an even better distribution. As a reminder, any feedback for this handbook should follow the guidelines detailed in the How do I improve the Handbook?

We look forward to seeing how our users will choose to implement Gentoo to fit their unique use cases and needs. Note For help on the other installation approaches, including using non-Gentoo bootable media, please read our Alternative installation guide.

Note Some target architectures such as arm , mips , and s will not have minimal install CDs. At this time the Gentoo Release Engineering project does not support building. Note This is an optional step and not necessary to install Gentoo Linux. However, it is recommended as it ensures that the downloaded file is not corrupt and has indeed been provided by the Gentoo Infrastructure team.

Important This does not verify that the. That also implies that the checksum should be verified against the values in the. Note In all likelihood, the default gentoo kernel, as mentioned above, without specifying any of the optional parameters will work just fine.

For boot troubleshooting and expert options, continue on with this section. Otherwise, just press Enter and skip ahead to Extra hardware configuration. They can be switched by pressing Alt then a function key between F1 - F7.

It can be useful to switch to a new terminal when waiting for job to complete, to open documentation, etc. Note If users log on to the system, they will see a message that the host key for this system needs to be confirmed through what is called a fingerprint. This behavior is typical and can be expected for initial connections to an SSH server. However, later when the system is set up and someone logs on to the newly created system, the SSH client will warn that the host key has been changed.

This is because the user now logs on to - for SSH - a different server namely the freshly installed Gentoo system rather than the live environment that the installation is currently using. Follow the instructions given on the screen then to replace the host key on the client system.

Tip If no interfaces are displayed when the standard ifconfig command is used, try using the same command with the -a option. This option forces the utility to show all network interfaces detected by the system whether they be in an up or down state. If ifconfig -a produces no results then the hardware is faulty or the driver for the interface has not been loaded into the kernel.

Both situations reach beyond the scope of this Handbook. Contact gentoo webchat for support. Note Support for the iw command might be architecture-specific. Note Some wireless cards may have a device name of wlan0 or ra0 instead of wlp9s0. Run ip link to determine the correct device name.

For more information on configuring wireless networking in Gentoo Linux, please read the Wireless networking chapter in the Gentoo Handbook. Note If the IP address, broadcast address, netmask and nameservers are known, then skip this subsection and continue with Using ifconfig and route.

In this section, the focus is on IPv4 addresses. CODE Broadcast address. Important Although still supported by most motherboard manufacturers, MBR boot sectors and their associated partitioning limitations are considered legacy. Readers who must proceed with setup type should knowingly acknowledge the following information: Most post motherboards consider using MBR boot sectors a legacy supported, but not ideal boot mode.

Due to using bit identifiers, partition tables in the MBR cannot address storage space that is larger than 2 TiBs in size. Unless a extended partition is created, MBR supports a maximum of four partitions. This setup does not provide a backup boot sector, so if something overwrites the partition table, all partition information will be lost.

Command m for help : p. Command m for help : g. Command m for help : d. Command m for help : n. Command m for help : t. Command m for help : w. Command m for help : o. Important Some motherboards do not include a Real-Time Clock RTC , which will keep relatively accurate time even while the system is powered off.

When doing the make menuconfig of the kernel configuration, don't forget to enable the following options with the others recommended into the install guide. Do not install another bootloader because there is already one - pxegrub. Simply finish the install and restart the server. For help with this consult the hardware manuals or manufacturers website.

Then, a nice black and white GRUB bootmenu should be displayed from where users can select the kernel to boot and press the Enter Return key. If everything is okay the kernel should boot, mount the root filesystem using NFS and provide a login prompt. In order to install Gentoo from an existing Linux distribution it needs to have the chroot command installed, and have a copy of the Gentoo installation or ISO that's desired to install.

A network connection is highly recommended as otherwise the installation can only work with the files available in the installation media. The first example shows the output of mount on a system. The second example uses df disk free to see how much space there is left and how it will be resized. Note that resizing the root partition is not mandatory!

Anything else supported by the resizer can be resized, but let's talk about that later. In this case, it was decided to be resized as to leave MB of free space, therefore allocating 2 GB for Gentoo. Not bad, it could have quite some stuff installed. However, 1 GB is deemed enough for most users. So now partition this thing! It is included on the Minimal installation CD. Look up on that page the type of file system to resize and see if parted can do it.

If not, some partitions might need to be destroyed to make space for Gentoo. Go ahead downloading the software and install it. If the partition can be unmounted while still running in Linux then the following steps are not needed. Here's how it was done on this system. Time to reboot and resize the partition. Do this only after taking a quick look at the parted documentation on the GNU website.

The resize can be long for large hard-drives, be patient. Reboot the system with the Minimal installation CD. Run parted to be able to resize the partition. Once this lengthy process is done, continue with installing Gentoo. Reboot back into the old Linux system for now. The drive to operate on is the drive containing the partition that is going to be resized. Once the resize has finished, boot back into the old Linux as described.



0コメント

  • 1000 / 1000