Handbook:Parts/Installation/Stage
Kurulum dosyasını yüklemek
Tarihi ve saati ayarlamak
Before installing Gentoo the clock must be set correctly. Due to Gentoo's web based services using security certificates, it might not be possible to download the installation files if the system clock is too far skewed. Also, files saved with a date in the future may cause strange errors after the initial installation has completed if the clock is corrected later.
Verify the current date and time by running the date command:
root #
date
Mon Oct 3 13:16:22 PDT 2021
If the date/time displayed is more than few minutes off, it should be updated in accuracy using one of the methods below.
Automatic
Most readers will desire to have their system update the time automatically using a time server.
Some motherboards do not include a Real-Time Clock (RTC), which will keep relatively accurate time even while the system is powered off. It is very important for these systems to automatically sync the system clock with a time server at every system start and on a regular internal thereafter. This is just as important for systems that do include a RTC, but have a failed battery.
Official Gentoo live environments include the chronyd command (available through the net-misc/chrony package) and a configuration file pointing to ntp.org time servers. It can be used to automatically sync the system clock to UTC time using a time server. Using this method requires a working network configuration and may not be available on all architectures.
Automatic time sync comes at a price. It will reveal the system's IP address and related network information to a time server (in the case of the example below ntp.org). Users with privacy concerns should be aware of this before setting the system clock using the below method.
root #
chronyd -q
Manual
For systems that do not have access to a time server, the date command can also be used to set the system clock. It will use the following format as an argument: MMDDhhmmYYYY
syntax (Month, Day, hour, minute and Year).
UTC time is recommended for all Linux systems. A timezone will be defined later in the installation which will modify the clock to display local time.
Örneğin sistemin zamanını 29 Mart 2014, 16:21 olarak ayarlamak için:
root #
date 032916212014
Choosing a stage tarball
Not every architecture has a multilib option. Many only run with native code. Multilib is most commonly applied to amd64.
Multilib (32 and 64-bit)
Choosing a base tarball for the system can save a considerable amount of time later on in the installation process, specifically when it is time to choose a system profile. The selection of a stage tarball will directly impact future system configuration and can save a headache or two later on down the line. The multilib tarball uses 64-bit libraries when possible, and only falls back to the 32-bit versions when necessary for compatibility. This is an excellent option for the majority of installations because it provides a great amount of flexibility for customization in the future. Those who desire their systems to be capable of easily switching profiles should download the multilib tarball option for their respective processor architecture.
Most users should not use the 'advanced' tarballs options; they are for specific software or hardware configurations.
No-multilib (pure 64-bit)
Selecting a no-multilib tarball to be the base of the system provides a complete 64-bit operating system environment. This effectively renders the ability to switch to multilib profiles improbable, although still technically possible.
Readers who are just starting out with Gentoo should not choose a no-multilib tarball unless it is absolutely necessary. Migrating from a no-multilib to a multilib system requires an extremely well-working knowledge of Gentoo and the lower-level toolchain (it may even cause our Toolchain developers to shudder a little). It is not for the faint of heart and is beyond the scope of this guide.
OpenRC
OpenRC is a dependency-based init system (responsible for starting up system services once the kernel has booted) that maintains compatibility with the system provided init program, normally located in /sbin/init. It is Gentoo's native and original init system, but is also deployed by a few other Linux distributions and BSD systems.
OpenRC does not function as a replacement for the /sbin/init file by default and is 100% compatible with Gentoo init scripts. This means a solution can be found to run the dozens of daemons in the Gentoo ebuild repository.
systemd
systemd is a modern SysV-style init and rc replacement for Linux systems. It is used as the primary init system by a majority of Linux distributions. systemd is fully supported in Gentoo and works for its intended purpose. If something seems lacking in the Handbook for a systemd install path, review the systemd article before asking for support.
It is technically possible to switch a running Gentoo installation from OpenRC to systemd and back. However, switching requires some effort and is outside the scope of this installation manual. Before downloading a stage tarball, decide whether OpenRC or systemd will be used as the target init system and download the relevant stage tarball.
Kurulum dosyasını indirmek
Kök dizinin bağlı olduğu klasöre gidin (muhtemelen /mnt/gentoo):
root #
cd /mnt/gentoo
Graphical browsers
Those using environments with fully graphical web browsers will have no problem copying a stage file URL from the main website's download section. Simply select the appropriate tab, right click the link to the stage file, then Copy Link to copy the link to the clipboard, then paste the link to the wget utility on the command-line to download the stage tarball:
root #
wget <PASTED_STAGE_URL>
Command-line browsers
More traditional readers or 'old timer' Gentoo users, working exclusively from command-line may prefer using links (www-client/links), a non-graphical, menu-driven browser. To download a stage, surf to the Gentoo mirror list like so:
root #
links https://www.gentoo.org/downloads/mirrors/
links
ile bir HTTP proxy (ağ geçidi) kullanmak istiyorsanız, -http-proxy seçeneği ile belirtebilirsiniz:
root #
links -http-proxy proxy.server.com:8080 https://www.gentoo.org/downloads/mirrors/
links
'e benzer bir tarayıcı olarak, dilerseniz lynx
de kullanabilirsiniz.
root #
lynx https://www.gentoo.org/downloads/mirrors/
Eğer proxy gerekiyorsa, http_proxy
ve/veya ftp_proxy
ortam değişkenlerini atayabilirsiniz:
root #
export http_proxy="http://proxy.sunucu.com:port"
root #
export ftp_proxy="http://proxy.sunucu.com:port"
Yansı listesinde, fiziki olarak size yakın bir yansı seçin. Genellikle HTTP yansılar yeterli olmakta, ancak dilerseniz diğer protokollerde erişim sağlanabilen yansılar da var. releases/amd64/autobuilds/ dizinine gidin. Kuruluma elverişli tüm dosyaları burada bulabilirsiniz (alt-mimariye göre dizinlere ayrılmış bir yapı da görebilirsiniz). Bir tane dosya seçip, indirmek için D tuşuna basın.
After the stage file download completes, it is possible to verify the integrity and validate the contents of the stage tarball. Those interested should proceed to the next section.
İşlem tamamlandığında Q tuluna basarak çıkabilirsiniz.
Verifying and validating
Most stages are now explicitly suffixed with the init system type (openrc or systemd), although some architectures may still be missing these for now.
Minimal kurulum CD'lerinde olduğu gibi, burada da bazı yardımcı dosyalar bulunmakta:
- .CONTENTS dosyası, ilgili kurulum dosyasında bulunan dosyaların listesini içerir
- .DIGESTS dosyası, kurulum dosyasının farklı algoritmalar ile çıkarılmış parmak izini içerir
- .DIGESTS.asc dosyası da tıpkı .DIGESTS dosyası gibi parmakizlerini içerir, ancak kriptografik olarak Gentoo projesi tarafından imzalanmış dosyadır
root #
wget https://distfiles.gentoo.org/releases/
- A .CONTENTS.gz is a compressed file that contains a list of all files inside the stage tarball.
- A .DIGESTS file that contains checksums of the stage file in using several cryptographic hash algorithms.
- A .sha265 file that contains checksum of the stage file in using only the SHA256 hash algorithm. Note that this file may not be available for download for all stage tarballs.
İndirdikten sonra, kurulum dosyasının bütünlüğünü kontrol edebilirsiniz. openssl
kullanarak parmak izi üretip, .DIGESTS veya .DIGESTS.asc dosyasındaki iz ile karşılaştırabilirsiniz.
Örneğin SHA512 izini onaylamak için:
root #
openssl dgst -r -sha512 stage3-amd64-<release>.tar.bz2
dgst
instructs the openssl command to use the Message Digest sub-command, -r
prints the digest output in coreutils format, and -sha512
selects the SHA512 digest.
Whirlpool kontrolü için:
root #
openssl dgst -r -whirlpool stage3-amd64-<release>.tar.bz2
Komutların çıktılarını .DIGESTS(.asc) dosyaları ile kıyaslayabilirsiniz. Eğer değerler uyuşmuyorsa indirdiğiniz dosya hatalı olabilir.
sha512sum
komutu da kullanabilirsiniz:
root #
sha512sum stage3-amd64-<release>.tar.bz2
The --check
option instructs sha256sum to read a list of expected files and associated hashes, and then print an associated "OK" for each file that calculates correctly or a "FAILED" for files that do not.
ISO kalıbı gibi, bu dosyanın da kriptografik imzasını .DIGESTS.asc yardımıyla onaylayabilirsiniz. Örnek olarak gpg
ile kontrol edelim:
For official Gentoo live images, the sec-keys/openpgp-keys-gentoo-release package provides PGP signing keys for automated releases. The keys must first be imported into the user's session in order to be used for verification:
root #
gpg --import /usr/share/openpgp-keys/gentoo-release.asc
For all non-official live images which offer gpg and wget in the live environment, a bundle containing Gentoo keys can be fetched and imported:
root #
wget -O - https://qa-reports.gentoo.org/output/service-keys.gpg | gpg --import
Verify the signature of the tarball and, optionally, associated checksum files:
root #
gpg --verify stage3-amd64-<release>.tar.bz2.DIGESTS.asc
If verification succeeds, "Good signature from" will be in the output of the previous command(s).
The fingerprints of the OpenPGP keys used for signing release media can be found on the release media signatures page.
Kurulum dosyasını açmak
Şimdi tar
komutunun yardımı ile kurulum paketini sistemimize çıkartıyoruz:
root #
tar xvjpf stage3-*.tar.bz2 --xattrs
Kullandığınız seçeneklerin (xvjpf
ve --xattrs
) doğruluğunu kontrol edin. x çıkartmaya, v detaylı bilgi almaya, j dosyanın bir bzip2 dosyası olduğuna, p dosya içerisindeki izinlerin korunması gerektiğine, f de komuta bir paketi parametre olarak vereceğimizi işaret eder. --xattrs
ise paketteki gelişmiş dosya etiketlerini de korumamız gerektiğini belirtir.
The options starting with the double dash (--
) do not have a short parameters. --xattrs-include='*.*'
is to include preservation of the the extended attributes in all namespaces stored in the archive. Finally, --numeric-owner
is used to ensure that the user and group IDs of the files being extracted from the tarball will remain the same as Gentoo's release engineering team intended (even if adventurous users are not using official Gentoo live environments for the installation process).
Paketimizi kurduğumuza göre derleme seçeneklerini düzenleme ile devam edebiliriz.
Derleme seçeneklerini düzenleme
Giriş
Gentoo'yu kendi ihtiyacımıza göre düzenlemek için, Portage davranışını etkileyecek olan bazı değişkenleri ayarlayabiliriz. Tüm bunlar tabi ki export
ile ayarlanabilir, ancak kalıcı olmaz. Bunun yerine Portage'ın okuduğu /etc/portage/make.conf dosyasında düzenlemeler yapacağız.
Technically variables can be exported via the shell's profile or rc files, however that is not best practice for basic system administration.
Portage reads in the make.conf file when it runs, which will change runtime behavior depending on the values saved in the file. make.conf can be considered the primary configuration file for Portage, so treat its content carefully.
Tüm geçerli değişkenler /mnt/gentoo/usr/share/portage/config/make.conf.example dosyasında var. Ancak başarılı bir kurulum için aşağıdakilerin ayarlanması yeterli.
For a successful Gentoo installation only the variables that are mentioned below need to be set.}}
Bir editör açıp (biz nano
kullanacağız) bahsedeceğimiz değişkenleri ayarlayabiliriz.
root #
nano -w /mnt/gentoo/etc/portage/make.conf
make.conf.example dosyasında da görülebileceği gibi dosyanın biçimlendirilme türü, yorum olan satıların "#" ile başlaması, diğer satırların da DEĞİŞKEN="içerik" şeklinde tanımlanması.
CFLAGS ve CXXFLAGS
CFLAGS ve CXXFLAGS değerleri, C ve C++ kodları derlememize yarayacak olan gcc derleyicisi tarafından kullanılmakta. Burada genel olarak tanımlayacağız ancak (yönetimi biraz karmaşık olsa da) sisteminizden maksimum performansı almak için her uygulamanın nasıl derlenmesi gerektiğini de tanımlayabilirsiniz.
make.conf dosyasında sistemin genelinde kullanılması faydalı olan seçenekler ayarlanmalıdır. Burada kararlı olduğundan emin olmadığınız, deneysel ayarlar uygularsanız faydadan çok zararını görürsünüz (çalışmayan veya hatalı çalışan uygulamalar).
Mümkün olan tüm değişkenleri anlatmayacağız. Dilerseniz GNU online belgeleri'ni veya gcc bilgilendirme sayfasını (Linux sistemlerde info gcc
komutuyla) inceleyebilirsiniz. make.conf.example dosyası da gayet açıklayıcıdır, okumanızı tavsiye ederiz.
İlk ayarlardan biri hedef mimariyi belirleyen -march=
veya -mtune=
bayrağı. Kullanılabilecek değişkenler make.conf.example dosyasında (yorumlu olarak) var. En sık kullanılan değer, derleyiciye mimariyi otomatik olarak seçmesini belirten native değişkeni.
Bir diğer değişken de gcc'nin optimizasyon seviyesini ayarlayan -O
bayrağı (sıfır değil, büyük o harfi). Kullanılabilecek değişkenler s (boyut optimizasyonu), 0 (yani sıfır, optimizasyonsuz), 1, 2, hatta daha fazla optimizasyon için 3. Her seviye önceki seviyeye bazı eklemelerde bulunur. -O3
sistem genelinde kullanıldığında bazı hatalara sebep olmaktadır, bu sebeple önerilen değer -O2
'dir.
Diğer bir popüler bayrak da -pipe
. Bu bayrak derlemenin bazı aşamalarında geçiş için geçici dosyalar yerine pipe (geçiş özelliği) kullanılmasını sağlar. Oluşturulan kodda bir değişiklik olmamakta, ancak derlemenin daha fazla RAM kullanarak daha hızlı tamamlanmasını sağlamaktadır. Düşük RAM'e sahip sistemlerde önerilmez.
-fomit-frame-pointer
gibi bazı değişkenler kullanılması uygulamalar hata ürettiğinde hataların ayıklanarak farkedilmesini zorlaştırıcı etkiler barındırmaktadır.
CFLAGS ve CXXFLAGS değerlendirilirken kullanmak istediğiniz bayrakları tek satırda toplayın. Kurulum paketinde gelen bayraklar genelde yeterli olmakta. Aşağıda da bir örnek görebilirsiniz:
CFLAGS="-march=native -O2 -pipe"
# Her iki değişken için de aynısını kullanalım
CXXFLAGS="${CFLAGS}"
GCC optimizasyon sayfasında farklı bayrakların sistemi nasıl etkileyeceğine dair detaylı açıklamalar bulabilirsiniz.
MAKEOPTS
MAKEOPTS
değişkeni aynı anda işlemci katmanında kaç tane derleme işleminin paralel olarak yapılması gerektiğini ayarlar. Her durumda olmasa da, genellikle sistemdeki işlemci çekirdeği sayısının bir fazlası en uygun değer olarak tanımlanır.
A good choice is the smaller of: the number of threads the CPU has, or the total amount of system RAM divided by 2 GiB.
Using a large number of jobs can significantly impact memory consumption. A good recommendation is to have at least 2 GiB of RAM for every job specified (so, e.g.
-j6
requires at least 12 GiB). To avoid running out of memory, lower the number of jobs to fit the available memory.When using parallel emerges (
--jobs
), the effective number of jobs run can grow exponentially (up to make jobs multiplied by emerge jobs). This can be worked around by running a localhost-only distcc configuration that will limit the number of compiler instances per host.MAKEOPTS="-j2"
Search for MAKEOPTS in man 5 make.conf for more details.
Hazırsanız başlayalım
/mnt/gentoo/etc/portage/make.conf dosyasını isteğinize göre düzenleyip dosyayı kaydedin (nano ile düzenliyorsanız Ctrl+X ile çıkış diyaloğunu açabilirsiniz).
Ardından temel sistem kurulumu bölümünden devam edebilirsiniz.
References