Difference between pages "Hostname" and "Install/pt-br/Kernel"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
==Introduction==
=== Configurando e instalando o kernel Linux ===
A hostname is a unique name created to identify a machine on a network. In computer networking, a hostname  is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e-mail or Usenet. Hostnames may be simple names consisting of a single word or phrase, or they may be structured.
 
==Configuration==
Agora é hora de construir e instalar um kernel Linux, o qual é o coração de qualquer sistema Funtoo Linux. O kernel é carregado pelo boot loader, e interfaces diretamente com o hardware do seu sistema, e permite programas regulares (userspace) serem executador.
In Funtoo Linux <code>/etc/conf.d/hostname</code> is the only configuration file for setting a hostname. In OpenRC framework <code>/etc/conf.d/foo</code> is the configuration file for a corresponding Init script <code>/etc/init.d/foo</code>. With the case of hostname, default value in <code>/etc/conf.d/hostname</code> is set to ''localhost'', means when system boots and OpenRC's <code>/etc/init.d/hostname</code> script started a hostname getting only ''localhost'' name.  How it looks?  In your shell promt this will look in following way, an example for root:
 
Um kernel deve ser configurado propriamente para o hardware do seu sistema, desse modo ele suporta seus hard drives, file systems, placas de rede, e assim por diante. Usuários de Linux mais experientes podem escolher instalar o kernel sources e configurar e instalar seu próprio kernel. Se você não sabe como fazer isso, nós fornecemos ebuilds que construirão automaticamente um kernel "universal", módulos e initramfs para a inicialização do seu sistema que suporte todo o hardware. Esse é um jeito extremamente simples de construção de um kernel que colocará seu sistema para inicializar.
 
Qual é o nosso objetivo? Construir um kernel que reconhecerá todo o hardware em seu sistema necessário para inicialização, você será cumprimentado por um prompt de login amigável depois que a instalação estiver completa. Estas instruções lhe guiarão através do processo de instalação de um kernel no modo "fácil" -- sem exigir configuração do usuário, ao utilizar um kernel "universal".
 
==== Package Sets ====
 
Antes que instalemos um kernel, vamos cobrir um recurso do Portage chamado package sets. Portage, o sistema gerenciador/ports de pacotes para o Funtoo Linux, manterá rastro de pacotes do sistema assim como pacotes que você tem instalado ao invocar <code>emerge</code> diretamente. Esses pacotes que são parte do sistema base são considerados parte do conjunto de pacote do "sistema" (''system'' packages sets), enquanto pacotes que você tem instalado ao digitá-los na linha de comando (tal qual "gnome" em <code>emerge gnome</code>) serão adicionados ao conjunto de pacote "world". Isso proporciona um jeito fácil de atualizar o sistema inteiro.
 
No entanto, as vezes é bom ser capaz de atualizar o kernel todo por sim só, ou deixar uma atualização do kernel fora da sua regular atualização completa do sistema. Para fazer isso, criaremo uma nova configuração de pacote chamada "kernel".
 
==== Configuração de Pacote do Kernel ====
 
Para criar a configuração de pacote do kernel, realize os seguintes passos:
 
<console>
<console>
localhost ~ # ##i## Hello :)
(chroot) # ##i##mkdir /etc/portage/sets
(chroot) # ##i##echo sys-kernel/debian-sources > /etc/portage/sets/kernel
</console>
</console>
Let's play a bit with a configuration. Open <code>/etc/conf.d/hostname</code> with your favorite editor and set a hostname of your choice.  Below, I will use a real examples  from one of my working test boxes.
 
Agora, vamos querer definir uma variável USE para dizer ao <code>debian-sources</code> que construa um kernel "universal" e o initramfs para nós, para levar Funtoo Linux a funcionamento na inicialização. Para fazer isso, vamos configurar a variável <code>binary</code> USE para <code>debian-sources</code>, como a seguir:
 
<console>
<console>
localhost ~ # ##i## nano /etc/conf.d/hostname
(chroot) # ##i##echo "sys-kernel/debian-sources binary" >> /etc/portage/package.use
</console>
</console>
Let's set it to hostname="oleg-stable.host.funtoo.org". Save the file and restart  a hostname service:
 
Se as varáveis USE forem novas para você, você estará se familiarizando com elas um pouco mais enquanto utiliza o Funtoo Linux. Em sua essência, elas são "switches" que você pode definir para configurar opções que podem ser construídas em vários pacotes. Elas são utilizadas para assim personalizar seu Funtoo Linux system para que conheça as suas exatas necessidades. Nós adicionamos suporte para uma flag <code>binary</code> USE flag aos ebuilds <code>debian-sources</code>, assim como poucos outros de nossos kernel ebuilds, para tornar mais fácil para que novos usuários de consigam obter o Funtoo Linux funcionando e operando.
 
Agora, quando queremos somente atualizar os pacotes do nosso sistema, digitaremos <code>emerge -auDN @world</code>, e isso atualizará nossa configuração world, deixando de fora o kernel. Do mesmo modo, quando queremos atualizar somente o nosso kernel, digitaremos <code>emerge -au @kernel</code>, e isso atualizará nosso kernel, deixando de fora a configuração world.
 
==== Building the Kernel ====
 
{{Fancynote|1=
See [[Funtoo Linux Kernels]] for a full list of kernels supported in Funtoo Linux. We recommend <code>debian-sources</code> for new users.}}
 
{{fancyimportant|1=
<code>debian-sources</code> with <code>binary</code> USE flag requires at least 14GB free in <code>/var/tmp</code> and takes around 1 hour to build on a Intel Core i7 Processor.}}
 
Let's emerge our kernel:
 
<console>
<console>
localhost ~ # ##i## service hostname restart
(chroot) # ##i##emerge -1 @kernel
</console>
</console>
Now, let's examine our changes, after a restarting a hostname
<console>
oleg-stable ~ # ##i## Hello :)
</console>
== Diving deeper==
Notice, that in above output we seeing a shortened hostname and not a FQDN (Fully Qualified Domain Name). Don't be frustrated. This is  how  default bash promt <code>PS1</code> set. To get nice promts, please, follow http://www.funtoo.org/Prompt_Magic
Another way to test our settings is using a '''hostname''' command. Here we will show only  some of it's features. Let's try to execute '''hostname''' command:
<console>
oleg-stable ~ # ##i## hostname
oleg-stable.host.funtoo.org
</console>
Now we see our fully qualified domain name hostname just how we configured it in <code>/etc/conf.d/hostname</code> in above paragraph. To get a short hostname we need to set '''-s ''' (short) argument to hostname command.
<console>
oleg-stable ~ # ##i## hostname -s
oleg-stable
</console>
Good! Hostname offers more then just displaying a system host name but can also set one. Let's try:
<console>
oleg-stable ~ # ##i## hostname foo.bar.baz
oleg-stable ~ # ##i## hostname
foo.bar.baz
</console>
As you can see, we changed a hostname on-the-fly. This is not recommended way.
{{fancywarning|Please, notice that using '''hostname''' command to configure will work temporary for a current session and will be reverted back to a value set in <code>/etc/conf.d/hostname</code> file with next system restart.}}


Now that we got a brief description of a hostname and basic configuration steps, its time to reflect another important case which is directly related to a Funtoo Linux hostname generation, a hosts.
{{Important|Right now, the <code>-1</code> option is required to not add our <code>@kernel</code> set to <code>world-sets</code>. This allows you to emerge it independently from @world. If you forget to use this option, edit <code>/var/lib/portage/world-sets</code> and remove the <code>@kernel</code> line. This will prevent kernel updates from being included in @world updates.}}
 
Note that while use of the <code>binary</code> USE flag makes installing a working kernel extremely simple, it is one part of Funtoo Linux that takes a ''very'' long time to build from source, because it is building a kernel that supports ''all'' hardware that Linux supports! So, get the build started, and then let your machine compile. Slower machines can take up to several hours to build the kernel, and you'll want to make sure that you've set <code>MAKEOPTS</code> in <code>/etc/portage/make.conf</code> to the number of processing cores/threads (plus one) in your system before starting to build it as quickly as possible -- see the [[#/etc/portage/make.conf|/etc/portage/make.conf section]] if you forgot to do this.
 
{{fancynote|NVIDIA card users: the <code>binary</code> USE flag installs the Nouveau drivers which cannot be loaded at the same time as the proprietary drivers, and cannot be unloaded at runtime because of KMS. You need to blacklist it under <code>/etc/modprobe.d/</code>.}}


==Hosts case==
{{fancynote|For an overview of other kernel options for Funtoo Linux, see [[Funtoo Linux Kernels]]. There may be modules that the Debian kernel doesn't include, a situation where [http://www.funtoo.org/wiki/Funtoo_Linux_Kernels#Using_Debian-Sources_with_Genkernel genkernel] would be useful. Also be sure to see [[:Category:Hardware Compatibility|hardware compatibility]] information.}}
As per man page <code>hosts</code> stands for static table lookup for hostnames and it's configuration file is <code>/etc/hosts</code>. Here is how it looks
{{file|name=/etc/hosts|body=
# Auto-generated hostname. Please do not remove this comment.
127.0.0.1      oleg-stable.host.funtoo.org oleg-stable localhost localhost.localdomain
::1            oleg-stable.host.funtoo.org oleg-stable localhost localhost.localdomain
}}
As you can see it has entries from our <code>/etc/conf.d/hostname</code>. As you may have guessed, in Funtoo Linux <code>/etc/hosts</code> file entries are auto-generated, when OpenRC hostname service starts. Previously, it is used to edit <code>/etc/hosts</code> manually. In Funtoo Linux there is no such need.


What about custom hosts entries? This can be easily configured with '''aliases'''. For example you want to have a hosts for your remote router or a computer in home LAN. Let's try to modify <code>/etc/conf.d/hostname</code> with adding following - my remote computer oleg.distant.home has an IP 10.1.1.2:
Once <code>emerge</code> completes, you'll have a brand new kernel and initramfs installed to <code>/boot</code>, plus kernel headers installed in <code>/usr/src/linux</code>, and you'll be ready to configure the boot loader to load these to boot your Funtoo Linux system.
<console>
oleg-stable ~ # ##i## echo 'aliases="10.1.1.2 oleg.distant.home"' >> /etc/conf.d/hostname
oleg-stable ~ # ##i## service hostname restart
</console>
Examine our changes:
<console>
oleg-stable ~ # ##i## cat /etc/hosts
</console>
{{file|name=/etc/hosts|body=
# Auto-generated hostname. Please do not remove this comment.
10.1.1.2        oleg.distant.home
127.0.0.1      oleg-stable.host.funtoo.org oleg-stable localhost localhost.localdomain
::1            oleg-stable.host.funtoo.org oleg-stable localhost localhost.localdomain
}}
Please use the funtoo-dev mailing list and #funtoo irc channel  for hostname and OpenRC support, questions as well as bug reports on bugs.funtoo.org.

Revision as of 14:58, February 26, 2015

Configurando e instalando o kernel Linux

Agora é hora de construir e instalar um kernel Linux, o qual é o coração de qualquer sistema Funtoo Linux. O kernel é carregado pelo boot loader, e interfaces diretamente com o hardware do seu sistema, e permite programas regulares (userspace) serem executador.

Um kernel deve ser configurado propriamente para o hardware do seu sistema, desse modo ele suporta seus hard drives, file systems, placas de rede, e assim por diante. Usuários de Linux mais experientes podem escolher instalar o kernel sources e configurar e instalar seu próprio kernel. Se você não sabe como fazer isso, nós fornecemos ebuilds que construirão automaticamente um kernel "universal", módulos e initramfs para a inicialização do seu sistema que suporte todo o hardware. Esse é um jeito extremamente simples de construção de um kernel que colocará seu sistema para inicializar.

Qual é o nosso objetivo? Construir um kernel que reconhecerá todo o hardware em seu sistema necessário para inicialização, você será cumprimentado por um prompt de login amigável depois que a instalação estiver completa. Estas instruções lhe guiarão através do processo de instalação de um kernel no modo "fácil" -- sem exigir configuração do usuário, ao utilizar um kernel "universal".

Package Sets

Antes que instalemos um kernel, vamos cobrir um recurso do Portage chamado package sets. Portage, o sistema gerenciador/ports de pacotes para o Funtoo Linux, manterá rastro de pacotes do sistema assim como pacotes que você tem instalado ao invocar emerge diretamente. Esses pacotes que são parte do sistema base são considerados parte do conjunto de pacote do "sistema" (system packages sets), enquanto pacotes que você tem instalado ao digitá-los na linha de comando (tal qual "gnome" em emerge gnome) serão adicionados ao conjunto de pacote "world". Isso proporciona um jeito fácil de atualizar o sistema inteiro.

No entanto, as vezes é bom ser capaz de atualizar o kernel todo por sim só, ou deixar uma atualização do kernel fora da sua regular atualização completa do sistema. Para fazer isso, criaremo uma nova configuração de pacote chamada "kernel".

Configuração de Pacote do Kernel

Para criar a configuração de pacote do kernel, realize os seguintes passos:

(chroot) # mkdir /etc/portage/sets
(chroot) # echo sys-kernel/debian-sources > /etc/portage/sets/kernel

Agora, vamos querer definir uma variável USE para dizer ao debian-sources que construa um kernel "universal" e o initramfs para nós, para levar Funtoo Linux a funcionamento na inicialização. Para fazer isso, vamos configurar a variável binary USE para debian-sources, como a seguir:

(chroot) # echo "sys-kernel/debian-sources binary" >> /etc/portage/package.use

Se as varáveis USE forem novas para você, você estará se familiarizando com elas um pouco mais enquanto utiliza o Funtoo Linux. Em sua essência, elas são "switches" que você pode definir para configurar opções que podem ser construídas em vários pacotes. Elas são utilizadas para assim personalizar seu Funtoo Linux system para que conheça as suas exatas necessidades. Nós adicionamos suporte para uma flag binary USE flag aos ebuilds debian-sources, assim como poucos outros de nossos kernel ebuilds, para tornar mais fácil para que novos usuários de consigam obter o Funtoo Linux funcionando e operando.

Agora, quando queremos somente atualizar os pacotes do nosso sistema, digitaremos emerge -auDN @world, e isso atualizará nossa configuração world, deixando de fora o kernel. Do mesmo modo, quando queremos atualizar somente o nosso kernel, digitaremos emerge -au @kernel, e isso atualizará nosso kernel, deixando de fora a configuração world.

Building the Kernel

   Note

See Funtoo Linux Kernels for a full list of kernels supported in Funtoo Linux. We recommend debian-sources for new users.

   Important

debian-sources with binary USE flag requires at least 14GB free in /var/tmp and takes around 1 hour to build on a Intel Core i7 Processor.

Let's emerge our kernel:

(chroot) # emerge -1 @kernel
   Important

Right now, the -1 option is required to not add our @kernel set to world-sets. This allows you to emerge it independently from @world. If you forget to use this option, edit /var/lib/portage/world-sets and remove the @kernel line. This will prevent kernel updates from being included in @world updates.

Note that while use of the binary USE flag makes installing a working kernel extremely simple, it is one part of Funtoo Linux that takes a very long time to build from source, because it is building a kernel that supports all hardware that Linux supports! So, get the build started, and then let your machine compile. Slower machines can take up to several hours to build the kernel, and you'll want to make sure that you've set MAKEOPTS in /etc/portage/make.conf to the number of processing cores/threads (plus one) in your system before starting to build it as quickly as possible -- see the /etc/portage/make.conf section if you forgot to do this.

   Note

NVIDIA card users: the binary USE flag installs the Nouveau drivers which cannot be loaded at the same time as the proprietary drivers, and cannot be unloaded at runtime because of KMS. You need to blacklist it under /etc/modprobe.d/.

   Note

For an overview of other kernel options for Funtoo Linux, see Funtoo Linux Kernels. There may be modules that the Debian kernel doesn't include, a situation where genkernel would be useful. Also be sure to see hardware compatibility information.

Once emerge completes, you'll have a brand new kernel and initramfs installed to /boot, plus kernel headers installed in /usr/src/linux, and you'll be ready to configure the boot loader to load these to boot your Funtoo Linux system.