Comparatie intre Gentoo Linux si restul lumii

Maybe you are a bit reluctant against the Gentoo system. There is a common myth that says “Because Gentoo is a compiled system it will take forever to install or upgrade it and you’ll run into A LOT of trouble because you are not a developer and you don’t know how to compile programs.” This assertion is inherently untrue and is often made by ignorant people who hated Gentoo in the first place when they had the first contact with it and were used to binary systems such as Windows, MacOS and binary distributions of Linux. Other people would dare you to manually compile Linux when you tell them about Gentoo (saying “if you already are at it”) and go away loughing at you. I tell you, Linux From Scratch is NOT a system to use for production environements. Linux From Scratch is meant for educational purposes.

What is Gentoo?

Gentoo is an Operating System distribution which uses GNU programs and tools as its base layout and various kernels. It can use either a Linux, a * BSD, a MacOS Darwin kernel, and soon will be able to build using Windows Vista’s kernel (if you, of course, have a licence for it; this applies to the Darwin MacOSX’s kernel). So Gentoo is NOT only Linux. You may reffer to it as “Gentoo Linux”, “Gentoo FreeBSD”, ;Gentoo Darwin Gentoo Alt”.

So Gentoo is merely a package manager.

Why Gentoo?
Gentoo is about YOUR choice:

* You may choose what kernel to run – based upon your idea about stability of available kernels and other important factors at YOUR choice
* You may customize how the applications are being built – you may choose the ./configure options you want to enable or disable based on YOUR needs for that system
* You may use source packages or binary packages (known as GRP) – to install/update a system from sources or from binaries. You may even have a BINHOST costumized for YOUR business from which you install/upgrade other computers
* The packages are compiled on YOUR hardware and optimized for it – the level of customization is available to you for a lot of packages.
* To change a setting system wide to reflect a new need YOU have, you change one setting in one place and all the packages are rebuilt with that new setting at next upgrade.

Why is Gentoo more stable than other distributions?

* Gentoo mainly builds from sources and you know the hardware it will run on and the software you don’t need. Software that you don’t need has bugs that can make your system unstable or be a security risk. So you have the choice of not installing that software (weather or not it has bugs – you don’t need it in the first place). On other (binary) distributions you indeed have the choice of uninstalling that software (unless 1. you know it’s there, and 2. other programs you need were not compiled using the libraries provided by the software you want to uninstall). E.g. try to uninstall Internet Explorer from Windows because you use Firefox.

Why overclock your systems when you haven’t optimized your software yet? You should make sure you get the most out of your hardware, I mean make sure YOUR MONEY are well used.

You may argue that FreeBSD is lot more stable and provides the same costumization level… Is it?

* It’s world will build along with it’s kernel. The baselayout includes a lot of packages and the kernel is among them. Making regular updates to world is discuraged and they tell you that you’ll be better if you use a release. Indeed you are.
* The development is centered to a small team. How can a small team have more ideas than a big team (like the Linux kernel has)? Doesn’t this resamble the Microsoft’s team centered in one place with a finite number of people working on it?
* How often a Linux kernel is changed? How often a FreeBSD/Windows kernel gets updated (as release)?
* How much documentation you have to dig through to learn how to costumize your FreeBSD versus how much documentation you have to read to costumize Gentoo?
* Gentoo’s documentation project has only the documentation needed to get you started. After you read it and start using Gentoo, you’ll learn the rest very easily from the context. (That’s my experience.) How big is the FreeBSD’s manual, again? Does a big manual stand for some serious stuff? I think NOT! Things should be self explanatory and a manual should help newcomers to find their way.

Where does the Gentoo ideea come from? What does it combine? What you should already know when you start working with it?

* Gentoo doesn’t assume what programs you want installed on your system. Initially it is an archive you have to extract on the partition(s) you want to make a root Gentoo partition. It doesn’t even contain a kernel or a boot loader. It contains some utilities needed to build your system (a compiler, libraries and utilities for compilation of software and for file and network management).
* Gentoo is a mixture of features taken from Linux, FreeBSD and Windows
o From Linux it took its distributed development and its developers, and of course the vast world of software available
o From FreeBSD it took the idea of ports and came up with portage and its package management tools and improuved it
o From Windows it took the idea of ease of use, automation and user friendlyness
o From Cascading Style Sheets (CSS) and Object Oriented Programming (OOP) Gentoo took the idea of inheritance. This idea makes a lot of a difference both for users and for developers. It makes portage the most advanced package manager of the world.

Why is it better to build the software instead of installing binaries?

* Once upon a time computers didn’t have a lot of processing power and drive space
* To build a program written in a high level programming language would require you to be a developer
* Internet connections were slow or unavailable
* Software development was a tedious task and new versions came out once every few years.
* The good old days are gone and we must stay current with our software for various reasons: to have new important features for the software we use, to be on the safe side when it comes to security bugs, to have a clean and bug free software and to have optimized for performance new versions of our software. So these days are better than the good old days, as long as we adapt to them and keep up.
* For a developer is easier to adapt a build system than to build new versions of each and every software he decides for us to install on OUR system. This is why Gentoo doesn’t have a version of its own. It is a collection of software it is automatically updating as the time passes by and new versions are available. There are no two Gentoo identical systems. It’s like people. The variations make our world interesting and evolving.
* The only two things that have versions in Gentoo are: the initial tar ball you unarchive when starting your instalation (don’t worry about this, because as soon as you start installing software, it will rebuild the software inside it smile and get it to the latest stable version available) and package management system’s version (like any other software)

But what if I want to have a stable system, not the newest software available?

* “New” doesn’t mean “unstable” nor “stable” means “old”
* Let’s take a package for explaining how Gentoo is testing and making releases of packages inside it: skype
o On skype’s site there are two versions of the software: one stable and one beta
o On Gentoo you may find that the package has three states: stable, testing and unstable
o The unstable version corresponds to the beta version from the upstream provider of the package (the original developer). This version is “hard masked” – this means that the package manager will not display it when interogated about skype and will refuse to install it unless explicitly told so.
o The testing version is the “stable version” from the developer site. Right after the developer has released it, on Gentoo it enters in a testing state to see if users and Gentoo mainainers of the package find some bugs or not while using it on various platforms and configurations. This version is named prefixed by a ~ (e.g. net-im/skype ~arch) – arch is the architecture of your processor: x86, amd64, ppc, ppc64, sparc, alpha, etc.
o After a week or two after the last bug was resolved, the package enters the stable state. This doesn’t mean that it is bug free, but its bugs are very well hidden. The package is called by its name (e.g. net-im/skype)
* If the package is marked as stable for an architecture it doesn’t mean is stable on all of them. Or even in the testing phase. Also, unstable versions are called unsupported.
* You may notice (if you are a developer) that the build process doesn’t radically modify from one version to another, so, when a new verion of the software is avilable, the developer just copies the “build process description file”, changes its version and make the small changes he desires. And he’s done for release. It’s taking him about 10 – 15 minutes (if he’s not doing major changes) to update the database to support the new software version.
* All bugs from software runned on a Gentoo system should be reported to Gentoo developers and they will decide to fix it or to report it upstream.

Where do I find developer support? On the irc.freenode.net server there is a $gentoo channel. People there are willing to help.

Building a system

You should keep in mind that if you install Gentoo for the first time, most probably will do it wrong. I mean you will find some errors you did that led to an not very optimized system and you’ll fell you need to reinstall it after a couple of months, when you become used to it. This is not wrong. It just means that you are learning. When you are building a server, it will take a lot less than a workstation. The X window system and KDE or Gnome or XFce will take about 3 days to compile, unless you use a BINHOST – a server that provides already compiled packages ready to be unarchived to the live filesystem.

To build a gentoo system:

1. Boot the system into Linux (from live CDs or an already installed system)
2. On an empty partition(s)/disk: partition the disk as you see fit (keep the swap partition at the begining of the disk for fast access to it; keep a separate /boot and /home partition; reserve about 15 GB for the system, the rest should be for /home; the boot partition should be about 64 MB (yes MB, not GB); the swap partition should be 1 GB, regardless how much memory you have)
3. Format the partitions, mount the root partition, make /boot and /home directories and mount the other partitions inside those directories and change directory to the root partition: e.g. cd /mnt/gentoo
4. Get the stage3 for your architecture (i686 or amd64) tarball from the main site with wget
5. Untar it: tar xjpf stage*; # now you have a functional system inside /mnt/gentoo directory
6. Now you should edit the files in /mnt/gentoo/etc/conf.d to suit your needs; the most important of all is make.conf. Now it’s time you should read from the Gentoo Docs the instalation guide -> jump to make.conf directly
7. You have to make /dev available for that system: mount -o bind /dev /mnt/gentoo/dev
8. Copy over the /etc/resolv.conf file: cp /etc/resolv.conf /mnt/gentoo/etc/
9. After you are done with make.conf (don’t set the USE=”” variable just yet – wait a couple of steps) you may run the system inside the /mnt/gentoo directory: chroot /mnt/gentoo /bin/bash; then env-update && source /etc/profile
10. Mount /proc file system: mount -t proc proc /proc
11. Let’s get the package database from a mirror: emerge –sync (it will complain about portage being empty – it’s ok for now – it is really empty, it’s a new system, you know?)
12. Let’s get the current tools up to date: emerge -uDNpv portage (u = update; D = deep = update the dependencies also; N = newuse (I’ll talk about it later); p = pretend (just simulate the update); v = verbose) -> you’ll get the list of programs needed to be updated along with portage (the package manager) and right next to the name of the package you find some “use flags”. These use flags reprezent optional components of the programs that will be built. You can set or unset them in make.conf, the USE=”” variable. After you set or unset (prefix them with a minus sign to unset something) some of these variables, you should run emerge -uDNpv portage again to see new packages that have been pulled in by your modifications and set their use flags also, then run emerge -uDNpv portage again and change use flags again until you are satisfied with it and don’t need any changes. Then run emerge -uDN portage and wait until it finishes.
13. The descriptions of the use-flags is available in /usr/portage/profiles/use.desc and /usr/portage/profiles/use.local.desc
14. Use flags are of three types: global useflags – that have the same meaning to all packages they affect and can be found to almost all packages (like static, debug, doc, ipv6, unicode, java); local useflags – that affect packages differently or can be found for only one package; configuration use-flags: the one you don’t set in USE= but in other variables like ALSA_CARDS or VIDEO_CARDS or APACHE_MODULES or APACHE_MPMS.
15. After finishing updating portage, move to the next step: emerge -uDNpv system and repeat the previous step but with “system” as emerge’s target instead of “portage” – this should finish in about 6 hours… You should edit /etc/locale.gen to save some compile time. The build time depends on the time that has passed since the release of the tarball. glibc is the biggest package to compile here alongside with gcc (which compiles twice – see Linux From Scratch docs for an explanation).
16. Do it again with emerge -uDNpv world – it shouldn’t find anything to update this time, as only the system is prezent and no other custom package
17. emerge can have the following targets:
* “–sync” to synchronize the packages database
* “system” to update the collection of packages that are considered the base system – you should never unmerge one of these packages. Among them are: programing languages: gcc, python, perl, bash and others; libraries: glibc, perl and python modules, and others; system tools: GNU bin-utils – tar, cd, rm, libtool, etc., wget and rsync, nano, mount, hostname, init, etc; and scripts: /etc/init.d, and others.
* a package name to install/update a package
* “world” includes everything
18. You should proceed to emerge -uDNpv some important system components: gentoo-sources or vanilla-sources (that’s the kernel), grub or lilo (that’s the boot loader), syslog-ng or metalog (the system logger), reiserfsutils and e2fstools (provide disk checkers), portage-utils, genkernel, sudo, superadduser, vim, screen, mc, gentoolkit, dhcpcd or dhcp or pump (to get dhcpcd or dhclient or pump – the dhcp clients available), pciutils (to get lspci and lsusb), lsof, iproute2 (to get ip and ss and tc), mdadm, vixie_cron (to get cron), microcode-ctl (if you have (an) intel processor(s) and want to update their microcode – recomended), iptables (to build a firewall), iptraf, tcpdump (to debug network connections) and g-cpan (a tool to install/update perl modules from cpan).
19. It’s time for you to compile your kernel: edit /etc/genkernel.conf to suit your needs (experience with compiling kernels should help you here)
20. Run genkernel –menuconfig all and configure your kernel
21. When you are done, let it finish and then edit /boot/grub/grub.conf and set up grub on your disk. – The Gentoo Docs will help you a lot here.
22. Reboot yur new system
23. Add some services to the default runlevel: rc-update add SomeService default: syslog-ng or metalog, vixie-cron, net.eth0, sshd and microcode_ctl
24. To find packages: emerge -s keyword or q search keyword
25. All packages are located in /usr/portage/_category_/_package_
26. Source tarballs are located in /usr/portage/distfiles
27. Binary tarballs (tbz2) are located in /usr/portage/packages
28. To install a testing version of a package: echo “_category_/_package_ ~arch” >>/etc/portage/package.keywords (e.g. echo “net-im/skype ~x86” >>/etc/portage/package.keywords or “net-im/skype ~amd64”)
29. To disable or enable a use flag for a certain package: echo “sci-geosciences/mapserver -apache php” >>/etc/portage/package.use – keep an alphabetical order here and in make.conf
30. To get the beta version of skype: echo “=net-im/skype-2.0.0.65” >>/etc/portage/package.unmask and add “net-im/skype ~arch” to your /etc/portage/package.keywords
31. When you emerge some packages, be sure to look at their useflags before they are built: emerge -uDNpv package1 package2 … packageN
32. You can’t specify multiple targets to emerge when using –sync, system or world keywords
33. You can find a list of installed packages in /var/lib/portage/world

UPDATING a system

It’s the easiest part. Even when changing use-flags. You will only have to perform a few steps:

* Automatic steps

1. emerge –sync – will get the new ebiulds available in Gentoo from a rsync mirror (you may want to use emerge-webrsync if you have acces to the Internet only on port 80)
2. emerge -uDN portage – will update portage tools and their dependencies
3. emerge -uDN system – will update all packages that make up your system – see above for some examples
4. emerge -uDN world – will update all other packages present in your system and their dependencies
5. revdep-rebuild – after un update to a library package, the programs that used to use the old library won’t start anymore (they can’t find the old files you just uninstalled, they should be rebuilt using the new version of the library)
6. module-rebuild populate – will search for custom kernel modules you need like nvidia kernel module or acer-acpi and if you have a new kernel around, those modules should be installed for that new kernel you have; it will just build a database with those modules and/or update it
7. module-rebuild rebuild – will read the database it created in the previous step and rebuild any required modules
* Manual step
1. dispatch-conf or etc-update – will interactively merge the differencies between old and new configuration files from /etc

Done.

Autor:Sorin