Difference between revisions of "Beginners' Guide/Installation (Português)"

From ArchWiki
Jump to: navigation, search
Line 459: Line 459:
 
  # ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
 
  # ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
  
 +
==== Hardware clock ====
  
 +
Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.
  
===Select Packages===
+
You can generate {{ic|/etc/adjtime}} automatically by using one of the following commands:
  
All packages during installation are from the [core] repository. They are further divided into '''Base''', and '''Base-devel'''. Package information and brief descriptions are available [http://www.archlinux.org/packages/?repo=Core&arch=i686&limit=all&sort=pkgname here].
+
* '''UTC''' (recommended)
  
First, select the package category:
+
: {{Note|Using [[Wikipedia:Coordinated Universal Time|UTC]] for the hardware clock does not mean that software will display time in UTC.}}
{{Note | For expedience, all packages in '''base''' are selected by default. Use the space-bar to select and de-select packages.}}
+
; Base : Packages from the [core] repo to provide the minimal base environment. Always select this and only remove packages that will not be used.
+
; Base-devel : Extra tools from [core] such as {{ic|make}}, and {{ic|automake}}. Most beginners should choose to install it, as many will probably need it later.
+
  
After category selection, you will be presented with the full lists of packages, allowing you to fine-tune your selections. Use the space bar to select and unselect.
+
: {{bc|# hwclock --systohc --utc}}
  
{{Note | If connection to a wireless network is required, remember to select and install the '''wireless_tools''' package. Some wireless interfaces also need [[Wireless_Setup#ndiswrapper|'''ndiswrapper''']] and/or a specific [[Wireless_Setup#Drivers_and_firmware|'''firmware''']]. If you plan to use WPA encryption, you will need [[WPA_Supplicant|'''wpa_supplicant''']]. The [[Wireless_Setup|Wireless Setup]] page will help you choose the correct packages for your wireless device. Also strongly consider installing [[Netcfg|'''netcfg''']], which will help you set up your network connection and profiles after you reboot into your new system.}}
+
* '''localtime''' (discouraged; used by default in Windows)
  
After selecting the needed packages, leave the selection screen and continue to the next step, '''Install Packages'''.
+
: {{Warning|Using ''localtime'' may lead to several known and unfixable bugs. However, there are no plans to drop support for ''localtime''.}}
  
===Install Packages===
+
: {{bc|# hwclock --systohc --localtime}}
  
''Install Packages'' will install the selected packages to your new system.  If you selected a CD/USB as the source, package versions from the CD/USB will be installed. If you opted for a Netinstall, fresh packages will be downloaded from the internet and installed.
+
If you have (or planning on having) a dual boot setup with Windows:
  
{{Note|In some installers, you will be asked if you wish to keep the packages in the pacman cache. If you choose 'yes', you will have the flexibility to [[Downgrade packages|downgrade]] to previous package versions in the future, so this is recommended (you can always clear the cache in the future).}}
+
* Recommended: Set both Arch Linux and Windows to use UTC. A quick [[Time#UTC_in_Windows|registry fix]] is needed. Also, be sure to prevent Windows from synchronizing the time on-line, because the hardware clock will default back to ''localtime''. If you want such functionality (NTP sync), you should use [[ntpd]] on your Arch Linux installation instead.
  
After the packages have been downloaded, the installer will check their integrity. Next it will create the kernel from the packages downloaded.
+
* Not recommended: Set Arch Linux to ''localtime'' and disable any time-related services, like {{ic|ntpd.service}}. This will let Windows take care of hardware clock corrections and you will need to remember to boot into Windows at least two times a year (in Spring and Autumn) when [[Wikipedia:Daylight_savings_time|DST]] kicks in. So please don't ask on the forums why the clock is one hour behind or ahead if you usually go for days or weeks without booting into Windows.
  
===Configure the System===
+
==== Kernel modules ====
{{Tip|Closely following and understanding these steps is of key importance to ensure a properly configured system.}}
+
  
At this stage of the installation, you will configure the primary configuration files of your Arch Linux base system. Previous versions of the installer included [[Hwdetect|hwdetect]] to gather information for your configuration. This has been deprecated and replaced with '''[[Udev|udev]]''', which should handle most module loading automatically at boot.
+
{{Tip|This is just an example, you do not need to set it. All needed modules are automatically loaded by udev, so you will rarely need to add something here. Only add modules that you know are missing.}}
  
Now you will be asked which text editor you want to use; choose [[Nano|nano]], [http://joe-editor.sourceforge.net/ joe] or [[Vim|vi]]. {{ic|nano}} is generally considered the easiest of the three. Please see the releated wiki pages of the editor you wish to use for instructions on how to use them. You will be presented with a menu including the main configuration files for your system.
+
For kernel modules to load during boot, place a {{ic|*.conf}} file in {{ic|/etc/modules-load.d/}}, with a name based on the program that uses them.
  
{{Note|It is very important at this point to edit, or at least verify by opening, every configuration file. The installer script relies on your input to create these files on your installation. A common error is to skip over these critical steps of configuration.}}
+
{{hc|# nano /etc/modules-load.d/virtio-net.conf|
 +
# Load 'virtio-net.ko' at boot.
  
'''Can the installer handle this more automatically?'''
+
virtio-net}}
  
Hiding the process of system configuration is in direct opposition to '''''[[The Arch Way]]'''''. While it is true that recent versions of the kernel and hardware probing tools offer excellent hardware support and auto-configuration, Arch presents the user all pertinent configuration files during installation for the purposes of ''transparency and system resource control''. By the time you have finished modifying these files to your specifications, you will have learned the simple method of manual Arch Linux system configuration and become more familiar with the base structure, leaving you better prepared to use and maintain your new installation productively.
+
If there are more modules to load per {{ic|*.conf}}, the module names can be separated by newlines. A good example are the [[VirtualBox#Arch_Linux_guests|VirtualBox Guest Additions]].
  
====/etc/rc.conf====
+
Empty lines and lines starting with {{ic|#}} or {{ic|;}} are ignored.
Arch Linux uses the file {{ic|/etc/rc.conf}} as the principal location for system configuration. This one file contains a wide range of configuration information, principally used at system startup. As its name directly implies, it also contains settings for and invokes the /etc/rc* files, and is, of course, sourced ''by'' these files.
+
  
----
+
==== Hostname ====
  
=====LOCALIZATION section=====
+
Add your ''hostname'' in {{ic|/etc/hostname}}:
  
<div style='float:right;margin: 0 0 0 0.5em'>
+
  # echo '''myhostname''' > /etc/hostname
<div style='text-align:center;'>'''''Example for LOCALIZATION:'''''</div>
+
  LOCALE=&quot;en_US.utf8&quot;
+
DAEMON_LOCALE=&quot;no&quot;
+
HARDWARECLOCK=&quot;localtime&quot;
+
TIMEZONE=&quot;US/Eastern&quot;
+
KEYMAP=&quot;us&quot;
+
CONSOLEFONT=
+
CONSOLEMAP=
+
USECOLOR=&quot;yes&quot;
+
VERBOSE=&quot;3&quot;
+
</div>
+
:; LOCALE : This sets your system locale, which will be used by all i18n-aware applications and utilities. You can get a list of the available locales by running {{ic|locale -a}} from the command line. This setting's default is usually fine for US English users. However if you experience any problems such as some characters not printing right and being replaced by squares you may want to go back and replace &quot;en_US.utf8&quot; with just &quot;en_US&quot;.
+
:; DAEMON_LOCALE : Specifies whether or not to use the daemon locale (with "yes" or "no"). Will use the environment variable $LOCALE as the value of the locale if specified as "yes", otherwise will use the C locale (if left at the default value of "no").
+
:; HARDWARECLOCK : Specifies whether the hardware clock, which is synchronized on boot and on shutdown, stores '''UTC''' time, or '''localtime'''. UTC is recommended because it greatly simplifies changing timezones and daylight savings time [https://wiki.archlinux.org/index.php/Beginner%27s_Guide#Set_Clock].
+
:; TIMEZONE : Specify your TIMEZONE. (All available zones are under {{ic|/usr/share/zoneinfo/}}).
+
:; KEYMAP :  The available keymaps are in {{ic|/usr/share/kbd/keymaps}}. Please note that this setting is only valid for your TTYs, not any graphical window managers or '''X'''.
+
:; CONSOLEFONT : Available console fonts reside under {{ic|/usr/share/kbd/consolefonts/}} if you must change. The default (blank) is safe.
+
:; CONSOLEMAP : Defines the console map to load with the setfont program at boot. Possible maps are found in {{ic|/usr/share/kbd/consoletrans}}, if needed. The default (blank) is safe.
+
:; USECOLOR : Select &quot;yes&quot; if you have a color monitor and wish to have colors in your consoles.
+
:; VERBOSE : Level of verbosity, on a scale of 1 to 8.
+
  
----
+
Set it to your liking (e.g. ''arch''). This is the name of your computer. And add it to {{ic|/etc/hosts}}, as well:
  
=====HARDWARE Section=====
+
{{Warning|This format, including {{ic|localhost}} and your actual hostname, is required for program compatibility. Errors in these entries may cause poor network performance and/or certain programs to open very slowly, or not work at all.}}
  
<div style='float:right;margin: 0 0 0 0.5em'>
+
{{hc|# nano /etc/hosts|
<div style='text-align:center;'>'''''Example for HARDWARE:'''''</div>
+
127.0.0.'''myhostname''' localhost
  # Scan hardware and load required modules at boot
+
::1        '''myhostname''' localhost
MOD_AUTOLOAD=&quot;yes&quot;
+
   
MODULES=(loop)
+
#192.168.1.100 '''myhostname'''.domain.org '''myhostname'''  #Uncomment if you use a static IP and remove this comment.}}
</div>
+
:; MOD_AUTOLOAD : Setting this to &quot;yes&quot; will use '''udev''' to automatically probe hardware and load the appropriate modules during boot, (convenient with the default modular kernel). Setting this to &quot;no&quot; will rely on the user's ability to specify this information manually, or compile their own custom kernel and modules, etc.
+
:; MODULES : Specify additional MODULES if you know that an important module is missing. If your system has any floppy drives, add "floppy". If you will be using loopback filesystems, add "loop".
+
----
+
  
====/etc/locale.gen====
+
{{Note|{{ic|127.0.0.1}} and {{ic|::1}} are the IPv4 and IPv6 addresses of the local [[Wikipedia:localhost|loopback]] network interface.}}
The {{ic|/usr/sbin/locale-gen}} command reads from '''/etc/locale.gen''' to generate specific locales. They can then be used by '''glibc''' and any other locale-aware program or library for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards.
+
  
By default {{ic|/etc/locale.gen}} is an empty file with commented documentation. Once edited, the file remains untouched. {{ic|locale-gen}} runs on every '''glibc''' upgrade, generating all the locales specified in {{ic|/etc/locale.gen}}.
+
{{Tip|For convenience, you may also use {{ic|/etc/hosts}} aliases for hosts on your network, and/or on the Web.
  
Choose the locale(s) you need (remove the # in front of the lines you want), e.g.:
+
192.168.1.90 media
en_US ISO-8859-1
+
  192.168.1.88 data
  en_US.UTF-8
+
  
The installer will now run the locale-gen script, which will generate the locales you specified. You may change your locale in the future by editing /etc/locale.gen and subsequently running 'locale-gen' as root.
+
The above example would allow you access to a media and data server on your network by name and without the need for typing out their respective IP addresses.}}
  
{{Note|If you fail to choose your locale, this will lead to a "The current locale is invalid..." error. This is perhaps the most common mistake by new Arch users.}}
+
=== Configure the network ===
  
====Pacman-Mirror====
+
You need to configure the network again, but this time for your newly installed environment. The procedure and prerequisites are very similar to the one described [[#Establish_an_internet_connection|above]], except we are going to make it persistent and automatically run at boot.
Choose a mirror repository for '''{{ic|pacman}}'''. Remember that archlinux.org is throttled, limiting downloads to 50KB/s.  Check [[Mirrors]] for more details about selecting a pacman mirror.
+
  
====Root password====
+
{{Note|For more in-depth information on network configration, visit [[Configuring Network]] and [[Wireless Setup]].}}
Finally, set a root password and make sure that you remember it later. Return to the main menu and continue with installing bootloader.
+
  
====Done====
+
==== Wired ====
When you select "Done", the system will rebuild the images and put you back to the Main Menu.  This may take some time.
+
  
===Install Bootloader===
+
; Dynamic IP
Because we have no secondary operating system in our example, we will need a bootloader. [[GRUB]] is the recommended bootloader and will be used in the following examples. Alternatively, you may choose [[LILO]] or [[Syslinux]]. Please see the related wiki and documentation pages if you choose to use a bootloader other than GRUB.
+
  
The provided '''GRUB''' configuration ({{ic|/boot/grub/menu.lst}}) should be sufficient, but verify its contents to ensure accuracy (specifically, ensure that the root (/) partition is specified by UUID on line 3). You may want to alter the resolution of the console  by adding a vga=<number> kernel argument corresponding to your desired virtual console resolution. (A table of resolutions and the corresponding numbers is printed in the {{ic|menu.lst}}.)
+
If you only use a single fixed wired network connection, you do not need a network management service and can simply enable the {{ic|dhcpcd}} service:
  
Explanation:
+
# systemctl enable dhcpcd@.service
  
; title : A printed menu selection. &quot;Arch Linux (Main)&quot; will be printed on the screen as a menu selection.
+
Alternatively, you can use {{Pkg|netcfg}}'s {{ic|net-auto-wired}}, which gracefully handles dynamic connections to new networks:
; root : '''GRUB''''s root; the drive and partition where the kernel (/boot) resides, according to system BIOS. (More accurately, where GRUB's stage2 file resides). '''NOT necessarily the root''' (/) file system, as they can reside on separate partitions. GRUB's numbering scheme starts at 0, and uses an hd''x,x'' format regardless of IDE or SATA, and enclosed within parentheses. The example indicates that /boot is on the first partition of the first drive, according to the BIOS, so (hd0,0).
+
; kernel : This line specifies:
+
:* The path and filename of the kernel '''''relative to GRUB's root'''''. In the example, /boot is merely a directory residing on the same partition as / and '''vmlinuz26''' is the kernel filename; {{ic|/boot/vmlinuz26}}. If /boot were on a separate partition, the path and filename would be simply {{ic|/vmlinuz26}}, being relative to '''GRUB''''s root.
+
  
:* The {{ic|1=root=}} argument to the kernel statement specifies the partition containing the root (/) directory in the booted system, (more accurately, the partition containing {{ic|/sbin/init}}). An easy way to distinguish the 2 appearances of 'root' in {{ic|/boot/grub/menu.lst}} is to remember that the first root statement ''informs GRUB where the kernel resides'', whereas the second {{ic|1=root=}} kernel argument ''tells the kernel where the root filesystem (/) resides''.
+
# pacman -S netcfg ifplugd
 +
# cd /etc/network.d
 +
# ln -s examples/ethernet-dhcp .
 +
# systemctl enable net-auto-wired.service
  
:* Kernel options. In our example, '''ro''' mounts the filesystem as read-only during startup, (usually a safe default; you may wish to change this in case it causes problems booting). Depending on hardware, rootdelay=8 may need to be added to the kernel options in order to be able to boot from an external usb hard drive.
+
; Static IP
  
; initrd : The path and filename of the initial RAM filesystem '''relative to GRUB''''s root. Again, in the example, /boot is merely a directory residing on the same partition as / and '''kernel26.img''' is the initrd filename; '''/boot/kernel26.img'''. If /boot were on a separate partition, the path and filename would be simply '''/kernel26.img''', being relative to '''GRUB''''s root.
+
Install {{Pkg|netcfg}} and {{Pkg|ifplugd}}, which are required for {{ic|net-auto-wired}}:
  
''Example''
+
  # pacman -S netcfg ifplugd
  title  Arch Linux (Main)
+
root  (hd0,0)
+
kernel /boot/vmlinuz26 root=/dev/sda1 ro
+
initrd /boot/kernel26.img
+
  
''Example for /boot on a separate partition''
+
Copy a sample profile from {{ic|/etc/network.d/examples}} to {{ic|/etc/network.d}}:
title  Arch Linux (Main)
+
root  (hd0,0)
+
kernel /vmlinuz26 root=/dev/sda3 ro
+
initrd /kernel26.img
+
  
Install the '''GRUB''' bootloader to the master boot record (/dev/sda in our example).
+
# cd /etc/network.d
 +
# cp examples/ethernet-static .
  
{{Warning|Make sure to install GRUB on '''/dev/sdX''' and '''not /dev/sdX''#'''''! This is a common mistake.}}
+
Edit the profile as needed:
  
{{tip|For more details, see the [[GRUB]] wiki page.}}
+
# nano ethernet-static
 +
 
 +
Enable the {{ic|net-auto-wired}} service:
 +
 
 +
# systemctl enable net-auto-wired.service
 +
 
 +
==== Wireless ====
 +
 
 +
You will need to install other programs to configure and manage wireless network profiles, such as [[netcfg]].
 +
 
 +
[[NetworkManager]] and [[Wicd]] are other popular alternatives.
 +
 
 +
* Install the required packages:
 +
 
 +
# pacman -S wireless_tools wpa_supplicant wpa_actiond netcfg dialog
 +
 
 +
If your wireless adapter requires a firmware (as described in the above [[#Wireless|Establish an internet connection]] section and also [[Wireless_Setup#Drivers_and_firmware|here]]), install the package containing your firmware. For example:
 +
 
 +
# pacman -S zd1211-firmware
 +
 
 +
* Connect to the network with {{ic|wifi-menu}} (optionally checking the interface name with {{ic|ip link}}, but usually it's {{ic|wlan0}}), which will generate a profile file in {{ic|/etc/network.d}} named after the SSID. There are also templates available in {{ic|/etc/network.d/examples/}} for manual configuration.
 +
 
 +
# wifi-menu
 +
 
 +
* Enable the {{ic|net-auto-wireless}} service, which will connect to known networks and gracefully handle roaming and disconnects:
 +
 
 +
# systemctl enable net-auto-wireless.service
 +
 
 +
{{Note|[[Netcfg]] also provides {{ic|net-auto-wired}}, which can be used in conjunction with {{ic|net-auto-wireless}}.}}
 +
 
 +
* Make sure that the correct wireless interface (usually {{ic|wlan0}}) is set in {{ic|/etc/conf.d/netcfg}}:
 +
 
 +
{{hc|# nano /etc/conf.d/netcfg|2=
 +
WIRELESS_INTERFACE="wlan0"}}
 +
 
 +
It is also possible to define a list of network profiles that should be automatically connected, using the {{ic|AUTO_PROFILES}} variable in {{ic|/etc/conf.d/netcfg}}. If {{ic|AUTO_PROFILES}} is not set, all known wireless networks will be tried.
 +
 
 +
==== xDSL (PPPoE), analog modem or ISDN ====
 +
 
 +
For xDSL, analog modem (dial-up) and ISDN, see [[Direct Modem Connection]].
 +
 
 +
=== Configure pacman ===
 +
 
 +
Pacman is the Arch Linux '''pac'''kage '''man'''ager. It is highly recommended to study and learn how to use it. Read {{ic|man pacman}}, have a look at the [[pacman]] article, or check out the [[Pacman Rosetta]] article for a comparison to other popular package managers.
 +
 
 +
For repository selections and pacman options, edit {{ic|pacman.conf}}:
 +
 
 +
{{Note|When choosing repos, be sure to uncomment both the {{ic|[''repo_name'']}} header lines, as well as the {{ic|Include}} lines. Failure to do so will result in the selected repository being omitted! This is a very common error.}}
 +
 
 +
# nano /etc/pacman.conf
 +
 
 +
Most people will want to use {{ic|[core]}}, {{ic|[extra]}} and {{ic|[community]}}.
 +
 
 +
If you installed Arch Linux x86_64, it's recommended that you enable the {{ic|[multilib]}} repository, as well (to be able to run both 32 bit and 64 bit applications):
 +
 
 +
[multilib]
 +
Include = /etc/pacman.d/mirrorlist
 +
 
 +
See [[Official Repositories]] for more information, including details about the purpose of each repository.
 +
 
 +
For software unavailable directly through pacman, see [[Arch User Repository]].
 +
 
 +
=== Create an initial ramdisk environment ===
 +
 
 +
{{Tip|Most users can skip this step and use the defaults provided in {{ic|mkinitcpio.conf}}. The initramfs image (from the {{ic|/boot}} folder) has already been generated based on this file when the {{Pkg|linux}} package (the Linux kernel) was installed earlier with {{ic|pacstrap}}.}}
 +
 
 +
Here you need to set the right [[Mkinitcpio#HOOKS|hooks]] if the root is on a USB drive, if you use RAID, LVM, or if {{ic|/usr}} is on a separate partition.
 +
 
 +
Edit {{ic|/etc/mkinitcpio.conf}} as needed and re-generate the initramfs image with:
 +
 
 +
# mkinitcpio -p linux
 +
 
 +
=== Set the root password and add a regular user ===
 +
 
 +
Set the root password with:
 +
 
 +
# passwd
 +
 
 +
{{Warning|Linux is a multi-user operating system. You should not perform everyday tasks using the root account. It is considered a very poor practice and could be extremely dangerous. The root account should only be used for administrative tasks.}}
 +
 
 +
Then add a normal user account. For a more interactive way, you can use {{ic|adduser}}. However, below is the non-interactive way. The user ''archie'' is just an example.
 +
 
 +
# useradd -m -g users -s /bin/bash ''archie''
 +
# passwd ''archie''
 +
 
 +
If you wish to start over, use {{ic|userdel}}. The {{ic|-r}} option will remove the user's home directory and its content, along with the user's settings (the so-called "dot" files).
 +
 
 +
# userdel -r ''archie''
 +
 
 +
For more information, read [[Users and Groups]].
 +
 
 +
=== Install and configure a bootloader ===
 +
 
 +
==== For BIOS motherboards ====
 +
 
 +
For BIOS systems, there are three bootloaders - Syslinux, GRUB, and [[LILO]]. Choose the bootloader as per your convenience. Below only Syslinux and GRUB are explained.
 +
 
 +
* Syslinux is (currently) limited to loading only files from the partition where it was installed. Its configuration file is considered to be easier to understand. An example configuration can be found [https://bbs.archlinux.org/viewtopic.php?pid=1109328#p1109328 here].
 +
 
 +
* GRUB is more feature-rich and supports more complex scenarios. Its configuration file(s) is more similar to a scripting language, which may be difficult for beginners to manually write. It is recommended that they automatically generate one.
 +
 
 +
===== Syslinux =====
 +
 
 +
Install the {{Pkg|syslinux}} package and then use the {{ic|syslinux-install_update}} script to automatically ''install'' the files ({{ic|-i}}), mark the partition ''active'' by setting the boot flag ({{ic|-a}}), and install the ''MBR'' boot code ({{ic|-m}}):
 +
 
 +
{{Note|If you have partitioned the drive as GPT, install {{Pkg|gptfdisk}} package, as well ({{ic|pacman -S gptfdisk}}), because it contains {{ic|sgdisk}}, which will be used to set the GPT-specific boot flag.}}
 +
 
 +
# pacman -S syslinux
 +
# syslinux-install_update -iam
 +
 
 +
Configure {{ic|syslinux.cfg}} to point to the right root partition. This step is vital. If it points to the wrong partition, Arch Linux will not boot. Change {{ic|/dev/sda3}} to reflect your root partition ''(if you partitioned your drive as we did in [[#Prepare_the_storage_drive|the example]], your root partition is sda1)''. Do the same for the fallback entry.
 +
 
 +
{{hc|# nano /boot/syslinux/syslinux.cfg|2=
 +
...
 +
LABEL arch
 +
        ...
 +
        APPEND root=/dev/sda3 ro
 +
        ...}}
 +
 
 +
For more information on configuring and using Syslinux, see [[Syslinux]].
 +
 
 +
===== GRUB =====
 +
 
 +
{{Note|For GPT-partitioned drives on BIOS motherboards, GRUB needs a 2 MiB "[[GRUB#GPT_specific_instructions|BIOS Boot Partition]]".}}
 +
 
 +
{{Note|Please do not use {{ic|/dev/sda''X''}} in the below command. You may use {{ic|/dev/sdb}} if you installed Arch there, as long as you set that drive to boot first from the BIOS settings.}}
 +
 
 +
# pacman -S grub-bios
 +
# grub-install --target=i386-pc --recheck /dev/sda
 +
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
 +
 
 +
While using a manually created {{ic|grub.cfg}} is absolutely fine, it's recommended that beginners automatically generate one:
 +
 
 +
{{Tip|To automatically search for other operating systems on your computer, install {{Pkg|os-prober}} ({{ic|pacman -S os-prober}}) before running the next command.}}
 +
 
 +
# grub-mkconfig -o /boot/grub/grub.cfg
 +
 
 +
For more information on configuring and using GRUB, see [[GRUB]].
 +
 
 +
==== For UEFI motherboards ====
 +
 
 +
For UEFI boot, the drive needs to be GPT-partitioned, and a UEFI System Partition (512 MiB or higher, FAT32, type {{ic|EF00}}) must be present and mounted on {{ic|/boot/efi}}. If you have followed this guide from the beginning, you've already done all of these.
 +
 
 +
While there are other [[UEFI_Bootloaders|UEFI bootloaders]] available, using EFISTUB is recommended. Below are instructions for setting up EFISTUB and GRUB.
 +
 
 +
{{Note|Syslinux does not yet support UEFI.}}
 +
 
 +
===== EFISTUB =====
 +
 
 +
The Linux kernel can act as its own bootloader using EFISTUB. This is the UEFI boot method recommended by developers and simpler compared to {{ic|grub-efi-x86_64}}. The below steps set up rEFInd (a fork of rEFIt) to provide a menu for EFISTUB kernels, as well as for booting other UEFI bootloaders. You can also use [[UEFI_Bootloaders#Using_gummiboot|gummiboot]] (not tested) instead of rEFInd. Both rEFInd and gummiboot can detect Windows UEFI bootloader in case of dual-boot.
 +
 
 +
1. Boot in UEFI mode and load {{ic|efivars}} kernel module before chrooting:
 +
 
 +
# modprobe efivars      # before chrooting
 +
 
 +
2. Mount the UEFISYS partition at {{ic|/mnt/boot/efi}}, chroot and [[UEFI_Bootloaders#Setting_up_EFISTUB|copy the kernel and initramfs files]] to {{ic|/boot/efi}}.
 +
 
 +
3. Every time the kernel and initramfs files are updated in {{ic|/boot}}, they need to be updated in {{ic|/boot/efi/EFI/arch}}. This can be automated either [[UEFI_Bootloaders#Sync_EFISTUB_Kernel_in_UEFISYS_partition_using_Systemd|using systemd]] or [[UEFI_Bootloaders#Sync_EFISTUB_Kernel_in_UEFISYS_partition_using_Incron|using incron]] (for non-systemd setups).
 +
 
 +
4. Install the following packages:
 +
 
 +
# pacman -S refind-efi-x86_64 efibootmgr
 +
 
 +
5. Install rEFInd to the UEFISYS partition (summarized from [[UEFI Bootloaders#Using rEFInd]]):
 +
 
 +
# mkdir -p /boot/efi/EFI/arch/refind
 +
# cp /usr/lib/refind/refindx64.efi /boot/efi/EFI/arch/refind/refindx64.efi
 +
# cp /usr/lib/refind/config/refind.conf /boot/efi/EFI/arch/refind/refind.conf
 +
# cp -r /usr/share/refind/icons /boot/efi/EFI/arch/refind/icons
 +
 
 +
6. Create a {{ic|refind_linux.conf}} file with the kernel parameters to be used by rEFInd:
 +
 
 +
{{hc|# nano /boot/efi/EFI/arch/refind_linux.conf|2=
 +
"Boot to X"          "root=/dev/sdaX ro rootfstype=ext4 systemd.unit=graphical.target"
 +
"Boot to console"    "root=/dev/sdaX ro rootfstype=ext4 systemd.unit=multi-user.target"}}
 +
 
 +
7. Add rEFInd to UEFI boot menu using [[UEFI#efibootmgr|efibootmgr]].
 +
 
 +
{{Warning|Using {{ic|efibootmgr}} on Apple Macs may brick the firmware and may need reflash of the motherboard ROM. For Macs, use {{AUR|mactel-boot}}, or "bless" from within Mac OS X.}}
 +
 
 +
# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Arch Linux (rEFInd)" -l '\\EFI\\arch\\refind\\refindx64.efi'
 +
 
 +
{{Note|In the above command, X and Y denote the drive and partition of the UEFISYS partition. For example, in {{ic|/dev/sdc5}}, X is "c" and Y is "5".}}
 +
 
 +
8. (Optional) As a fallback, in case {{ic|efibootmgr}} created boot entry does not work, copy {{ic|refindx64.efi}} to {{ic|/boot/efi/EFI/boot/bootx64.efi}} as follows:
 +
 
 +
# cp -r /boot/efi/EFI/arch/refind/* /boot/efi/EFI/boot/
 +
# mv /boot/efi/EFI/boot/refindx64.efi /boot/efi/EFI/boot/bootx64.efi
 +
 
 +
===== GRUB =====
 +
 
 +
{{Note|In case you have a system with 32-bit EFI, like pre-2008 Macs, install {{ic|grub-efi-i386}} instead, and use {{ic|1=--target=i386-efi}}.}}
 +
 
 +
# pacman -S grub-efi-x86_64 efibootmgr
 +
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck
 +
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
 +
 
 +
Run the next command to create a menu entry for GRUB in the UEFI boot menu. See [[UEFI#efibootmgr|efibootmgr]] for more info.
 +
 
 +
# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Arch Linux (GRUB)" -l '\\EFI\\arch_grub\\grubx64.efi'
 +
 
 +
While using a manually created {{ic|grub.cfg}} is absolutely fine, it's recommended that beginners automatically generate one:
 +
 
 +
{{Tip|To automatically search for other operating systems on your computer, install {{Pkg|os-prober}} ({{ic|pacman -S os-prober}}) before running the next command.}}
 +
 
 +
# grub-mkconfig -o /boot/grub/grub.cfg
 +
 
 +
For more information on configuring and using GRUB, see [[GRUB]].
 +
 
 +
=== Update the system ===
 +
 
 +
{{Warning|1=System updates should be performed with care. It is very important to read and understand [https://bbs.archlinux.org/viewtopic.php?id=57205 this] before proceeding.}}
 +
 
 +
Often, the developers will provide important information about required configurations and modifications for known issues. The Arch Linux user is expected to consult these places before performing an upgrade:
 +
 
 +
* [https://archlinux.org/news/ Arch news]. If you did not read this before an upgrade and you encounter an error, check the news ''before'' you post a question on the forum!
 +
* [https://archlinux.org/pipermail/arch-announce/ Announce mailing list].
 +
 
 +
Sync, refresh the package database, and upgrade your entire system with:
 +
 
 +
# pacman -Syu
 +
 
 +
Or, same thing:
 +
 
 +
# pacman --sync --refresh --sysupgrade
 +
 
 +
If you are prompted to upgrade pacman itself at this point, respond by pressing {{Keypress|Y}}, and then reissue the {{ic|pacman -Syu}} command when finished.
 +
 
 +
{{Note|Occasionally, configuration changes may take place requiring user action during an update; read pacman's output for any pertinent information. See [[Pacnew and Pacsave Files]] for more details.}}
 +
 
 +
Keep in mind that Arch is a '''rolling release''' distribution. This means the user doesn't have to reinstall or perform elaborate system rebuilds to upgrade to the newest version. Issuing {{ic|pacman -Syu}} periodically (and noting the above warning) keeps the entire system up-to-date and on the bleeding edge. At the end of this upgrade, the system will be completely current.
 +
 
 +
See [[Pacman]] and [[FAQ#Package Management]] for answers regarding updating and managing packages.
 +
 
 +
=== Unmount the partitions and reboot ===
 +
 
 +
Exit from the chroot environment:
 +
 
 +
# exit
 +
 
 +
Since the partitions are mounted under {{ic|/mnt}}, we use the following command to unmount them:
 +
 
 +
# umount /mnt/{boot,home,}
 +
 
 +
Reboot the computer:
  
===Reboot===
 
That's it; You have configured and installed your Arch Linux base system. Exit the install, and reboot:
 
 
  # reboot
 
  # reboot
{{Tip|Be sure to remove the installation media and perhaps change the boot preference in your BIOS; otherwise you may boot back into the installation!}}<noinclude>
+
 
 +
{{Tip|Be sure to remove the installation media, otherwise you will boot back into it.}}<noinclude>
 
{{Beginners' Guide navigation (Português)}}</noinclude>
 
{{Beginners' Guide navigation (Português)}}</noinclude>

Revision as of 19:50, 17 October 2012

Dica: Esta é parte de um artigo multi-páginas do "The Beginners' Guide" ("O Guia para Iniciantes"). Clique aqui se preferir ler o artigo completo.

Instalação

A partir deste momento, você está automaticamente logado em uma shell como usuário root.

Nota: O Framework de instalação do Arch Linux foi descotinuado, portanto, o procedimento de executar o script /arch/setup não funcionará.

Alterar a linguagem

Tip: Este passo é opcional para a maioria dos usuários. Útil apenas se desejas o sistema em sua linguagem nativa, editar arquivos de configuração adicionando caracteres especiais, ou configurar senhas de Wi-Fi com tais caracteres ou receber mensagens do sistema na sua linguagem.

Por padrão, a linguagem do teclado é a us. Para utilizadores do Brasil:

# loadkeys br-abnt2

Para utilizadores de outras comunidades lusófonas:

# loadkeys pt-latin9

A fonte de letra do console também pode ser alterada, pois a maioria das linguagens utiliza o padrão de 26 letras do. Nestes casos, alguns caracteres podem aparecer na tela como quadrados brancos ou outros símbolos esquisitos. Note que o comando abaixo é case-sensitive, portanto, digite exatamente da forma como está escrito:

# setfont Lat2-Terminus16

Por padrão, a linguagem da instalação é o Inglês(US). Para alterar a linguagem durante o processo de instalação, basta remover o # na localização desejada no arquivo /etc/locale.gen, junto com a entrada em inglês. Priorize a escolha a entrada UTF-8. Utilize o editor de sua escolha, apesar deste manual utilizar o nano.

Pressione Template:Keypress para sair, e quando perguntado para salvar as alterações, pressione Template:Keypress seguido de Template:Keypress para sobrescrever o arquivo.

# nano /etc/locale.gen
en_US.UTF-8 UTF-8
pt_BR.UTF-8 UTF-8
# locale-gen
# export LANG=pt_BR.UTF-8 

ou

# nano /etc/locale.gen
en_US.UTF-8 UTF-8
pt_PT.UTF-8 UTF-8
# locale-gen
# export pt_PT.UTF-8 UTF-8

Lembre-se, Template:Keypress ativa e desativa um mapa de teclado.

Estabelecendo conexão com a internet

O serviço The dhcpcd inicia automaticamente em tempo de inicialização, e tentará iniciar uma conexão cabeada se disponível. Tente pingar um site para verificar a disponibilidade. Como o google tá sempre online...

# ping -c 3 www.google.com
PING www.l.google.com (74.125.132.105) 56(84) bytes of data.
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=1 ttl=50 time=17.0 ms
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=2 ttl=50 time=18.2 ms
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=3 ttl=50 time=16.6 ms

--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 16.660/17.320/18.254/0.678 ms

Caso você receba o erro ping: unknown host, você deverá configurar a rede manualmente, como descrito abaixo.

Caso contrário, vá para o tópico Preparando os Discos.

Rede Cabeada

Siga o seguinte procedimento para configurar sua conexão cabeada com um endereço IP estático.

Caso o seu computador esteja conectado a uma rede Ethernet, na maioria dos casos, você possuirá uma interface chamada eth0. Caso você tenha interfaces adicionais(como por exemplo, uma interface integrada a placa-mãe) elas seguirão a sequência eth1, eth2, etc.

Você precisa conhecer as seguintes informações:

  • Endereço IP estático.
  • Máscara de rede.
  • Endereço do Gateway
  • Endereço do DNS
  • Nome do domínio(a memos que esteja em uma LAN local, onde pode ignorar tal informação).


Para ativar uma interface de rede como a eth0:

# ip link set eth0 up

Adicione um endereço:

# ip addr add <ip address>/<subnetmask> dev <interface>

Exemplo:

# ip addr add 192.168.1.2/24 dev eth0

Para maiores opções, execute man ip.

Adicione o seu gateway da seguinte forma, substituindo o endereço IP pelo do seu gateway em questão:

# ip route add default via <ip address>

Exemplo:

# ip route add default via 192.168.1.1

Edite o arquivo resolv.conf, substituindo no parametro "nameserver" os endereços IP dos DNS's disponíveis, e o valor do seu domínio no parametro "search".

# nano /etc/resolv.conf
nameserver 61.23.173.5
nameserver 61.95.849.8
search example.com
Nota: Apenas três endereços nameserver podem ser incluídos neste arquivo.

A partir daqui, você deve ter acesso a rede cabeada. Caso contrário, dê uma verificada na página Configuring Network (Português).

Wireless

Siga este procedimento caso você precise de conectividade (Wi-Fi) durante o processo de instalação.

Os drivers e utilitários para conexão sem fio agora estão disponíveis na mídia de instalação. Um bom conhecimento do seu hardware sem fio será de suma importância para a obter sucesso na configuração. Note que seguindo o procedimento deste passo-a-passo habilitará seu hardware durante a utilização do sistema live ou executando em determinado processo da instalação. Estes passos precisam ser repetidos após um reboot no sistema.

Note também que estes passos são opcionais, pois se a conexão sem fio é desnecessária ao processo de instalação, estas configurações podem ser executadas em um período posterior.

Nota: Os exemplos a seguir usam a nomenclatura wlan0 para a interface de rede e linksys para a ESSID. Lembre de alterar estes valores de acordo com a sua configuração.

O procedimento básico será:

  • (opcional) Identificar a sua interface wireless:
# lspci | grep -i net

Ou, se utilizando uma placa externa(usb):

# lsusb
  • Certifique-se de que o udev carregou o driver apropriado, e que uma interface utilizável foi criada, através do comando iwconfig:
Note: Caso você não visualize uma saída de tela similar a esta, sua placa wireless não foi carregada. Neste caso, você deverá carregar o módulo do driver por sua conta. Veja Wireless Setup (Português) para informações mais detalhadas.
# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0    unassociated  ESSID:""
         Mode:Managed  Channel=0  Access Point: Not-Associated
         Bit Rate:0 kb/s   Tx-Power=20 dBm   Sensitivity=8/0
         Retry limit:7   RTS thr:off   Fragment thr:off
         Power Management:off
         Link Quality:0  Signal level:0  Noise level:0
         Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Neste exemplo, wlan0 é a interface disponívei.

  • Para levantar a interface:
# ip link set wlan0 up

Uma pequena porcentagem dos dispositivos sem fio também necessitam de um firmware para o driver correspondente. Caso sua interface precide se um, o "erro comum" que pode acontecer ao levantar a interface é o seguinte:

# ip link set wlan0 up
SIOCSIFFLAGS: No such file or directory

Caso tenha dúvidas, utilize o dmesg para buscar por informações no log de kernel e encontrar qual o possível firmware a ser utilizado.

Exemplo de saída de um dispositivo da Intel, requisitando o firmware durante o boot:

# dmesg | grep firmware
firmware: requesting iwlwifi-5000-1.ucode

Caso não haja saída, pode ser concluído que nenhuma firmware é necessária para a sua placa.

Warning: Pacotes de firmware de dispositivos sem fio são pré-instalados dentro de /usr/lib/firmware no ambiente de instalação(liveCD ou liveUSB), porém, devem ser explicitamente instalados ao seu sistema para serem funcionais após o reiniciar da instalação!. A instalação de pacotes será aborada mais tarde neste guia. Certifique-se da instalação de ambos, o módulo e a firmware antes de reiniciar! Veja Wireless Setup (Português) caso esteja incerto dos requisitos de firmware correspondentes ao seu sistema em particular.

Após, utilize o pacote netcfg, e seu utilitário wifi-menu para conectar a rede:

# wifi-menu wlan0

A partir de agora, você já deve ter uma conexão de internet funcionando. Caso contrário, verifique a página Wireless Setup (Português).

ADSL/DSL(PPPoE), modem analógico ou ISDN

Caso você tenha um roteador configurado em modo bridge, rode:

 # pppoe-setup

Para usar a conexão configurada, rode:

# pppoe-start

Possivelmente você precisará fazer ajustes ao arquivo resolv.conf:

# echo nameserver 8.8.8.8 > /etc/resolv.conf

Se você tentando conectar-se através de um mode analógico(dial-up) ou uma conexão ISDN, veja Direct Modem Connection (Português).

Configurando servidor proxy

Caso seu computador esteja atrás de um servidor proxy, exporte as variáveis de ambiente http_proxy e ftp_proxy. Clique aqui para maiores informações.

Preparando os Discos

Warning: O Particionamento pode causar destruição de dados. Recomendamos fortemente que efetue um backup de qualquer informação importante antes de proceder com este passo.

Para completos iniciantes, encorajamos ferramentas gráficas de particionamento. O GParted é um bom exemplo de uma distribuição Linux live, assim como Parted Magic,,, etc. Um dispositivo deve ser primeiramente particionado e então as partições serão formatadas com um sistema de arquivos antes de reiniciar.

Caso já tenha executado este passo, prossiga para Montando as partições. Caso contrário, siga o exemplo:

Exemplo

A mídia de instalação do Arch Linux provê as seguinter ferramentas de particionamento:

  • gdisk – Suporta apenas tabelas de partição GPT.
  • cfdisk – Suporta apenas tabelas de partição MBR.

Este exemplo utiliza o cfdisk, mas ele pode ser facilmente adaptado para o gdisk, que permite o perticionamento em tabelas do tipo GPT.

Notas sobre o boot UEFI:
  • Se você possui uma placa-mãe com suporte a UEFI, você precisará criar uma partição UEFI extra.
  • É recomendado sempre usar GPT para boot UEFI, pois algumas firmwares UEFI não permitem inicialização EFI-MBR.
Notas sobre o particionamento GPT:
  • Se você não está configurando dual boot com o Windows, utilize GPT ao invés de MBR. Leia a lista de vantagens da GPT.
  • Se você possui uma placa mãe com BIOS(ou planeja iniciar em modo de compatibilidade BIOS) e deseja configurar o GRUP em um driver particionado via GPT, você precisará criar uma Partiçaõ de boot BIOS de 2 MiB. O Syslinux não precisa de uma.
Note: Caso esteja instalando o Arch de um driver USB, veja Instalando o Arch Linux de um driver USB.
# cfdisk /dev/sda

Este exemplo mostrará um sistema que terá 15 GB de partição raíz (/), 1GB de partição swap, e o espaço remanescente será destinado ao /home.

Vale enfatizar que particionamento de disco trata-se de gosto pessoal, e que este exemplo existe para propósitos ilustrativos. Veja Particionamento.

Raíz:

Swap:

Home:

O resultado do particionamento ficara parecido com este:

Name    Flags     Part Type    FS Type          [Label]       Size (MB)
-----------------------------------------------------------------------
sda1    Boot       Primary     Linux                             15360
sda2               Primary     Linux swap / Solaris              1024
sda3               Primary     Linux                             133000*

Verifique novamente, e se certifique que você está contente com os tamanhos das partições assim como o layout delas antes de continuar.

Se quiser reiniciar o processo, você pode simplesmente selecionar "Sair" (ou pressionar Template:Keypress) para sair do particionador sem salvar quaisquer alterações feitas no disco. Depois, basta executar o cfdisk novamente.

Se tiver satisfeito, selecione Gravar (ou pressione Template:Keypress) para finalizar a gravação da tabela de partições para o disco. Digite "Sim"(yes) e selecione Sair (ou pressionar Template:Keypress) para sair do cfdisk.

Particionar não é o bastante; As partições precisam de um sistema de arquivos. Para formatar as partições com um sistema de arquivos ext4:

Warning: Verifique e "re-Verifique" se é realmente a partição /dev/sda1 que você deseja formatar. Pode mudar de caso para caso.
# mkfs.ext4 /dev/sda1
# mkfs.ext4 /dev/sda3

E para formatar e ativar a partição de swap:

# mkswap /dev/sda2
# swapon /dev/sda2

Montando as Partições

Cada partição é identificada por um sufixo numeral. Por exemplo, sda1 especifica a primeira partição do primeiro driver, enquanto sda designa o disco por completo.

Para ver o layout de particionamento atual:

# lsblk /dev/sda

Preste atenção na ordem de montagem, pois ela é importante.

Primeiro, monte a partição raíz em /mnt. Seguindo o exemplo abaixo (em seu sistema, pode ser diferente) seria algo como:

# mount /dev/sda1 /mnt

Monte então a partição destinada ao /home e outras separadas para o /boot, /var, etc, caso desejar:

# mkdir /mnt/home
# mount /dev/sda3 /mnt/home

No caso da partição /boot ser separada:

# mkdir /mnt/boot
# mount /dev/sdaX /mnt/boot

Se a sua placa-mãe possuir suporte a UEFI, monte a partição da seguinte maneira:

# mkdir /mnt/boot/efi
# mount /dev/sdaX /mnt/boot/efi

Selecionando um repositório

Antes de instalar, você pode desejar configurar seu arquivo mirrorlist para apontar pra um repositório de seu interesse. Uma cópia deste arquivo será instalado no seu sistema através do pacstrap

# nano /etc/pacman.d/mirrorlist
##
## Arch Linux repository mirrorlist
## Sorted by mirror score from mirror status page
## Generated on 2012-MM-DD
##

Server = http://mirror.example.xyz/archlinux/$repo/os/$arch
...

Se desejar, você pode configurar para que este seja o único repositório disponível, excluindo todo o resto (usando Template:Keypress), porém, é uma boa idéia ter mais de um repositório disponível, caso um deles esteja offline.

Tip:
  • Use o Mirrorlist Generator para obter uma lista atualizada dos repositórios de seu país. Repositórios HTTP são mais rápidos que FTP, devido a um conceito chamado keepalive. Via FTP, o pacman precisa enviar um sinal a cada momento que um pacote é baixando, resultando em uma pequena pausa. Para outras formas de gerar repositórios, veja organizando repositórios e Reflector.
  • Arch Linux MirrorStatus reporta diversos aspectos sobre os repositórios como problemas de rede, problemas de coleta de dados, última data de sincronia, etc.
Note:
  • Sempre que mudar sua lista de repositoŕios, lembre-se de forçar o pacman a atualizar todas as listas de pacotes através de um pacman -Syy. Esta ação é considerada uma boa prática e pode evitar dores de cabeça. Veja Mirrors para maiores informações.
  • Se estiver usando uma mídia de instalação antiga, suas listas de repositórios podem estar desatualizadas, podendo causar problemas na atualização relacionadas ao FS#22510. Por isto, utilize sempre a última mídia disponível como descrito acima.
  • Alguns problemas foram reportados nos fórums do Arch Linux relacionados a rede, impedindo o pacman a atualizar/sincronizar repositórios(veja [1] e [2]). Quando instalando o Arch Linux nativamente, estes problemas são contornados substituindo o "baixador de arquivos" do pacman por uma alternativa(veja Aumento de performance do Pacman para maiores detalhes). Quando instalar o Arch Linux como hóspede no [VirtualBox]], este problema pode ocorrer ao usar uma interface do tipo "Host interface" ao invés de "NAT" nas configurações desta máquina.

Instalando o sistema Base

O sistema base é instalado usando o script pacstrap.

# pacstrap /mnt base base-devel
Note: Caso o pacman falhe ao verificar os pacotes, verifique a data/hora do seu sistema. Se a data for inválida (exemplo, ano 2010), algumas chaves serão consideradas expiradas(ou inválidas), e verificações de assinatura dos pacotes falharão, junto com a interrupção da instalação. Certifique-se de corrigir o horário do sistema, fazendo isto manualmente ou através do cliente ntp, e tente rodar o pacstrap novamente. Veja o artigo tempo para maiores detalhes sobre correção da data do sistema.
  • base: Softwares que fazem parte do repositório [core], fazendo parte do ambiente mínimo necessário.
  • base-devel: Ferramentas extras fora do [core] como make e automake. A maioria dos iniciantes irá instalar este grupo, que será necessário para aumentar o sistema no futuro. O base-devel é um grupo necessári para a instalação de pacotes vindos do Arch User Repository.

Isto lhe dará um ambiente Arch básico. Outros pacotes podem ser instalados mais tarde através do pacman.

Crie um FSTAB

Crie um arquivo fstab com o seguinte comando. Se preferir utilizar UUIDs ou labels, adicione as opções -U ou -L respectivamente. É interessante verificar esta informação antes de continuar:

Nota: Se erros forem encontrados durante a execução do genfstab, não rode o genfstab novamente; apenas edite o arquivo fstab.
file.}}
# genfstab -p /mnt >> /mnt/etc/fstab
# nano /mnt/etc/fstab

Apenas a partição raíz (/) precisa de 1 no último campo. O restante, deve ter 2 ou 0 (veja definições do fstab).

Adicionalmente, data=ordered deve ser removido. Esta opção é usada automaticamente você definindo-a ou não, então, pode ser removida para manter a "clareza" do arquivo fstab.

Chroot e configuração do sistema base

Depois, faremos um chroot ao nosso novo sistema recém instalado:

# arch-chroot /mnt

Neste estágio da instalação, você configurará arquivos primários na base do seu Arch Linux. Estes podem ser criados caso existam ou não, ou editados caso deseje mudar a configuração padrão.

Entender todos os passos descritos é de suma importancia para garantir a configuração perfeita do sistema.

Localização(locale)

Localizações utilizadas pela glibc e outros programas e bibliotecas com tal capacidade para renderizar texto, mostrarão de forma correta opções regionais monetárias, de formato de data, de idiossincrasia, e outros padrões específicos de cada localidade.

Dois arquivos precisam ser editados: locale.gen e locale.conf.

  • O arquivo locale.gen é limpo por padrão(todas linhas comentadas) e você precisará remover o # das linhas desejadas. Você deverá descomentar mais linhas que apenas o Inglês (US), assim que escolher a codificação UTF-8: encoding:
# nano /etc/locale.gen
en_US.UTF-8 UTF-8
pt_BR.UTF-8 UTF-8
# locale-gen

Este comando irá rodar em cada atualização de glib, gerando novamente todas as localizações configuradas no /etc/locale.gen.

  • O arquivo locale.conf não existe por padrão. Configurar a variável LANG será o suficiente. Esta variável será utilizada como padrão por outras variáveis
# echo LANG=pt_BR.UTF-8 > /etc/locale.conf
# export LANG=pt_BR.UTF-8

Para usar outras variáveis do tipo LC_*, primeiro rode o comando locale para verificar as opções disponíveis. Um exemplo avançado pode ser encontrado aqui.

Warning: O uso da variável LC_ALL é desencorajado por sobrepor tudo.

Fontes de console e Mapa de teclado

Se você alterou o mapa do teclado no inicio do processo de instalação, recarregue tal configuração novamente pois seu ambiente mudou. Exemplo:


# loadkeys br-abnt2
# setfont Lat2-Terminus16

Para utilizadores de outras comunidades lusófonas:

# loadkeys pt-latin9
# setfont Lat2-Terminus16

Para que tais configurações persistam após um reboot, edite o arquivo vconsole.conf:

# nano /etc/vconsole.conf
KEYMAP=br-abnt2
FONT=Lat2-Terminus16
FONT_MAP=
  • KEYMAP – Tenha em mente que esta configuração é válida apenas para as suas TTYs, e não para gerenciadores gráficou ou seu Xorg.
  • FONT – Fontes disponíveis estão localizadas em /usr/share/kbd/consolefonts/. A fonte padrão é livre de falhas, porém, pode fazer com que caracteres estrangeiros apareçam como quadrados ou outros símbolos. É recomandado a fonte Lat2-Terminus16 pois de acordo com o /usr/share/kbd/consolefonts/README.Lat2-Terminus16, suporta "todos as linguagens l10".
  • FONT_MAP – Mapa de console a ser carregado durante o boot. Leia man setfont. O padrão(em branco) é seguro

Veja See fontes de console e man vconsole.conf para maiores informações.

Fuso Horário

Os fusos horário disponíveis podem ser encontrados nos diretórios /usr/share/zoneinfo/<Zona>/<SubZona>

Para visualizar uma <Zona> disponível, liste o conteúdo de /usr/share/zoneinfo/:

# ls /usr/share/zoneinfo/

De forma similar, a informação de uma <SubZona> pode ser obtida:

# ls /usr/share/zoneinfo/Europe

Crie um link simbólico para /etc/localtime com origem no seu fuso horário seguindo o padrão /usr/share/zoneinfo/<Zona>/<SubZona> .

Examplo:

# ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime

Hardware clock

Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.

You can generate /etc/adjtime automatically by using one of the following commands:

  • UTC (recommended)
Note: Using UTC for the hardware clock does not mean that software will display time in UTC.
# hwclock --systohc --utc
  • localtime (discouraged; used by default in Windows)
Warning: Using localtime may lead to several known and unfixable bugs. However, there are no plans to drop support for localtime.
# hwclock --systohc --localtime

If you have (or planning on having) a dual boot setup with Windows:

  • Recommended: Set both Arch Linux and Windows to use UTC. A quick registry fix is needed. Also, be sure to prevent Windows from synchronizing the time on-line, because the hardware clock will default back to localtime. If you want such functionality (NTP sync), you should use ntpd on your Arch Linux installation instead.
  • Not recommended: Set Arch Linux to localtime and disable any time-related services, like ntpd.service. This will let Windows take care of hardware clock corrections and you will need to remember to boot into Windows at least two times a year (in Spring and Autumn) when DST kicks in. So please don't ask on the forums why the clock is one hour behind or ahead if you usually go for days or weeks without booting into Windows.

Kernel modules

Tip: This is just an example, you do not need to set it. All needed modules are automatically loaded by udev, so you will rarely need to add something here. Only add modules that you know are missing.

For kernel modules to load during boot, place a *.conf file in /etc/modules-load.d/, with a name based on the program that uses them.

# nano /etc/modules-load.d/virtio-net.conf
# Load 'virtio-net.ko' at boot.

virtio-net

If there are more modules to load per *.conf, the module names can be separated by newlines. A good example are the VirtualBox Guest Additions.

Empty lines and lines starting with # or ; are ignored.

Hostname

Add your hostname in /etc/hostname:

# echo myhostname > /etc/hostname

Set it to your liking (e.g. arch). This is the name of your computer. And add it to /etc/hosts, as well:

Warning: This format, including localhost and your actual hostname, is required for program compatibility. Errors in these entries may cause poor network performance and/or certain programs to open very slowly, or not work at all.
# nano /etc/hosts
127.0.0.1   myhostname localhost
::1         myhostname localhost
 
#192.168.1.100 myhostname.domain.org myhostname   #Uncomment if you use a static IP and remove this comment.
Note: 127.0.0.1 and ::1 are the IPv4 and IPv6 addresses of the local loopback network interface.
Tip: For convenience, you may also use /etc/hosts aliases for hosts on your network, and/or on the Web.
192.168.1.90 media
192.168.1.88 data
The above example would allow you access to a media and data server on your network by name and without the need for typing out their respective IP addresses.

Configure the network

You need to configure the network again, but this time for your newly installed environment. The procedure and prerequisites are very similar to the one described above, except we are going to make it persistent and automatically run at boot.

Note: For more in-depth information on network configration, visit Configuring Network and Wireless Setup.

Wired

Dynamic IP

If you only use a single fixed wired network connection, you do not need a network management service and can simply enable the dhcpcd service:

# systemctl enable dhcpcd@.service

Alternatively, you can use netcfg's net-auto-wired, which gracefully handles dynamic connections to new networks:

# pacman -S netcfg ifplugd
# cd /etc/network.d
# ln -s examples/ethernet-dhcp .
# systemctl enable net-auto-wired.service
Static IP

Install netcfg and ifplugd, which are required for net-auto-wired:

# pacman -S netcfg ifplugd

Copy a sample profile from /etc/network.d/examples to /etc/network.d:

# cd /etc/network.d
# cp examples/ethernet-static .

Edit the profile as needed:

# nano ethernet-static

Enable the net-auto-wired service:

# systemctl enable net-auto-wired.service

Wireless

You will need to install other programs to configure and manage wireless network profiles, such as netcfg.

NetworkManager and Wicd are other popular alternatives.

  • Install the required packages:
# pacman -S wireless_tools wpa_supplicant wpa_actiond netcfg dialog

If your wireless adapter requires a firmware (as described in the above Establish an internet connection section and also here), install the package containing your firmware. For example:

# pacman -S zd1211-firmware
  • Connect to the network with wifi-menu (optionally checking the interface name with ip link, but usually it's wlan0), which will generate a profile file in /etc/network.d named after the SSID. There are also templates available in /etc/network.d/examples/ for manual configuration.
# wifi-menu
  • Enable the net-auto-wireless service, which will connect to known networks and gracefully handle roaming and disconnects:
# systemctl enable net-auto-wireless.service
Note: Netcfg also provides net-auto-wired, which can be used in conjunction with net-auto-wireless.
  • Make sure that the correct wireless interface (usually wlan0) is set in /etc/conf.d/netcfg:
# nano /etc/conf.d/netcfg
WIRELESS_INTERFACE="wlan0"

It is also possible to define a list of network profiles that should be automatically connected, using the AUTO_PROFILES variable in /etc/conf.d/netcfg. If AUTO_PROFILES is not set, all known wireless networks will be tried.

xDSL (PPPoE), analog modem or ISDN

For xDSL, analog modem (dial-up) and ISDN, see Direct Modem Connection.

Configure pacman

Pacman is the Arch Linux package manager. It is highly recommended to study and learn how to use it. Read man pacman, have a look at the pacman article, or check out the Pacman Rosetta article for a comparison to other popular package managers.

For repository selections and pacman options, edit pacman.conf:

Note: When choosing repos, be sure to uncomment both the [repo_name] header lines, as well as the Include lines. Failure to do so will result in the selected repository being omitted! This is a very common error.
# nano /etc/pacman.conf

Most people will want to use [core], [extra] and [community].

If you installed Arch Linux x86_64, it's recommended that you enable the [multilib] repository, as well (to be able to run both 32 bit and 64 bit applications):

[multilib]
Include = /etc/pacman.d/mirrorlist

See Official Repositories for more information, including details about the purpose of each repository.

For software unavailable directly through pacman, see Arch User Repository.

Create an initial ramdisk environment

Tip: Most users can skip this step and use the defaults provided in mkinitcpio.conf. The initramfs image (from the /boot folder) has already been generated based on this file when the linux package (the Linux kernel) was installed earlier with pacstrap.

Here you need to set the right hooks if the root is on a USB drive, if you use RAID, LVM, or if /usr is on a separate partition.

Edit /etc/mkinitcpio.conf as needed and re-generate the initramfs image with:

# mkinitcpio -p linux

Set the root password and add a regular user

Set the root password with:

# passwd
Warning: Linux is a multi-user operating system. You should not perform everyday tasks using the root account. It is considered a very poor practice and could be extremely dangerous. The root account should only be used for administrative tasks.

Then add a normal user account. For a more interactive way, you can use adduser. However, below is the non-interactive way. The user archie is just an example.

# useradd -m -g users -s /bin/bash archie
# passwd archie

If you wish to start over, use userdel. The -r option will remove the user's home directory and its content, along with the user's settings (the so-called "dot" files).

# userdel -r archie

For more information, read Users and Groups.

Install and configure a bootloader

For BIOS motherboards

For BIOS systems, there are three bootloaders - Syslinux, GRUB, and LILO. Choose the bootloader as per your convenience. Below only Syslinux and GRUB are explained.

  • Syslinux is (currently) limited to loading only files from the partition where it was installed. Its configuration file is considered to be easier to understand. An example configuration can be found here.
  • GRUB is more feature-rich and supports more complex scenarios. Its configuration file(s) is more similar to a scripting language, which may be difficult for beginners to manually write. It is recommended that they automatically generate one.
Syslinux

Install the syslinux package and then use the syslinux-install_update script to automatically install the files (-i), mark the partition active by setting the boot flag (-a), and install the MBR boot code (-m):

Note: If you have partitioned the drive as GPT, install gptfdisk package, as well (pacman -S gptfdisk), because it contains sgdisk, which will be used to set the GPT-specific boot flag.
# pacman -S syslinux
# syslinux-install_update -iam

Configure syslinux.cfg to point to the right root partition. This step is vital. If it points to the wrong partition, Arch Linux will not boot. Change /dev/sda3 to reflect your root partition (if you partitioned your drive as we did in the example, your root partition is sda1). Do the same for the fallback entry.

# nano /boot/syslinux/syslinux.cfg
...
LABEL arch
        ...
        APPEND root=/dev/sda3 ro
        ...

For more information on configuring and using Syslinux, see Syslinux.

GRUB
Note: For GPT-partitioned drives on BIOS motherboards, GRUB needs a 2 MiB "BIOS Boot Partition".
Note: Please do not use /dev/sdaX in the below command. You may use /dev/sdb if you installed Arch there, as long as you set that drive to boot first from the BIOS settings.
# pacman -S grub-bios
# grub-install --target=i386-pc --recheck /dev/sda
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

While using a manually created grub.cfg is absolutely fine, it's recommended that beginners automatically generate one:

Tip: To automatically search for other operating systems on your computer, install os-prober (pacman -S os-prober) before running the next command.
# grub-mkconfig -o /boot/grub/grub.cfg

For more information on configuring and using GRUB, see GRUB.

For UEFI motherboards

For UEFI boot, the drive needs to be GPT-partitioned, and a UEFI System Partition (512 MiB or higher, FAT32, type EF00) must be present and mounted on /boot/efi. If you have followed this guide from the beginning, you've already done all of these.

While there are other UEFI bootloaders available, using EFISTUB is recommended. Below are instructions for setting up EFISTUB and GRUB.

Note: Syslinux does not yet support UEFI.
EFISTUB

The Linux kernel can act as its own bootloader using EFISTUB. This is the UEFI boot method recommended by developers and simpler compared to grub-efi-x86_64. The below steps set up rEFInd (a fork of rEFIt) to provide a menu for EFISTUB kernels, as well as for booting other UEFI bootloaders. You can also use gummiboot (not tested) instead of rEFInd. Both rEFInd and gummiboot can detect Windows UEFI bootloader in case of dual-boot.

1. Boot in UEFI mode and load efivars kernel module before chrooting:

# modprobe efivars      # before chrooting

2. Mount the UEFISYS partition at /mnt/boot/efi, chroot and copy the kernel and initramfs files to /boot/efi.

3. Every time the kernel and initramfs files are updated in /boot, they need to be updated in /boot/efi/EFI/arch. This can be automated either using systemd or using incron (for non-systemd setups).

4. Install the following packages:

# pacman -S refind-efi-x86_64 efibootmgr

5. Install rEFInd to the UEFISYS partition (summarized from UEFI Bootloaders#Using rEFInd):

# mkdir -p /boot/efi/EFI/arch/refind
# cp /usr/lib/refind/refindx64.efi /boot/efi/EFI/arch/refind/refindx64.efi
# cp /usr/lib/refind/config/refind.conf /boot/efi/EFI/arch/refind/refind.conf
# cp -r /usr/share/refind/icons /boot/efi/EFI/arch/refind/icons

6. Create a refind_linux.conf file with the kernel parameters to be used by rEFInd:

# nano /boot/efi/EFI/arch/refind_linux.conf
"Boot to X"          "root=/dev/sdaX ro rootfstype=ext4 systemd.unit=graphical.target"
"Boot to console"    "root=/dev/sdaX ro rootfstype=ext4 systemd.unit=multi-user.target"

7. Add rEFInd to UEFI boot menu using efibootmgr.

Warning: Using efibootmgr on Apple Macs may brick the firmware and may need reflash of the motherboard ROM. For Macs, use mactel-bootAUR, or "bless" from within Mac OS X.
# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Arch Linux (rEFInd)" -l '\\EFI\\arch\\refind\\refindx64.efi'
Note: In the above command, X and Y denote the drive and partition of the UEFISYS partition. For example, in /dev/sdc5, X is "c" and Y is "5".

8. (Optional) As a fallback, in case efibootmgr created boot entry does not work, copy refindx64.efi to /boot/efi/EFI/boot/bootx64.efi as follows:

# cp -r /boot/efi/EFI/arch/refind/* /boot/efi/EFI/boot/
# mv /boot/efi/EFI/boot/refindx64.efi /boot/efi/EFI/boot/bootx64.efi
GRUB
Note: In case you have a system with 32-bit EFI, like pre-2008 Macs, install grub-efi-i386 instead, and use --target=i386-efi.
# pacman -S grub-efi-x86_64 efibootmgr
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Run the next command to create a menu entry for GRUB in the UEFI boot menu. See efibootmgr for more info.

# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Arch Linux (GRUB)" -l '\\EFI\\arch_grub\\grubx64.efi'

While using a manually created grub.cfg is absolutely fine, it's recommended that beginners automatically generate one:

Tip: To automatically search for other operating systems on your computer, install os-prober (pacman -S os-prober) before running the next command.
# grub-mkconfig -o /boot/grub/grub.cfg

For more information on configuring and using GRUB, see GRUB.

Update the system

Warning: System updates should be performed with care. It is very important to read and understand this before proceeding.

Often, the developers will provide important information about required configurations and modifications for known issues. The Arch Linux user is expected to consult these places before performing an upgrade:

  • Arch news. If you did not read this before an upgrade and you encounter an error, check the news before you post a question on the forum!
  • Announce mailing list.

Sync, refresh the package database, and upgrade your entire system with:

# pacman -Syu

Or, same thing:

# pacman --sync --refresh --sysupgrade

If you are prompted to upgrade pacman itself at this point, respond by pressing Template:Keypress, and then reissue the pacman -Syu command when finished.

Note: Occasionally, configuration changes may take place requiring user action during an update; read pacman's output for any pertinent information. See Pacnew and Pacsave Files for more details.

Keep in mind that Arch is a rolling release distribution. This means the user doesn't have to reinstall or perform elaborate system rebuilds to upgrade to the newest version. Issuing pacman -Syu periodically (and noting the above warning) keeps the entire system up-to-date and on the bleeding edge. At the end of this upgrade, the system will be completely current.

See Pacman and FAQ#Package Management for answers regarding updating and managing packages.

Unmount the partitions and reboot

Exit from the chroot environment:

# exit

Since the partitions are mounted under /mnt, we use the following command to unmount them:

# umount /mnt/{boot,home,}

Reboot the computer:

# reboot
Tip: Be sure to remove the installation media, otherwise you will boot back into it.

Template:Beginners' Guide navigation (Português)