Build a Killer Customized Arch Linux Installation (and Learn All About Linux in the Process)
11:33
Popular Linux distributions like Ubuntu are great, but they don't always provide the power and customizability you're looking for after you've gotten comfortable with Linux. That's where Arch Linux comes in, helping you create a personal, killer Linux distro.
Here's why you may want to use Arch Linux, followed by how to set it up.Who's Arch Linux Good For?
Linux is popular for a number of reasons, but high on that list is the fact that, with Linux, you have a lot more power to tweak your OS to your liking. You also have the opportunity to learn more about the way computers and operating systems work. While Ubuntu certainly fits this bill (when compared with Windows or Mac OS), intermediate Linux users may be itching to try something new. Arch Linux is a great distribution for intermediate users looking to dig into Linux a bit more and essentially roll your own fast, stable, super-personalized distro.The key part of this explanation is "intermediate users". Arch Linux is not for Linux beginners; there's a lot of manual configuration and command line work involved that Linux rookies probably aren't comfortable with. If you are a rookie, that's awesome—welcome to the wonderful world of Linux—but you won't want to start here. Take a look at something like Ubuntu, and when you've used that for awhile and become comfortable, come on back here for some serious Linux action. If you've been using something like Ubuntu for awhile and are comfortable with the basic ideas of command line work and configuration files, read on, because Arch Linux is a great next step.
This guide has two parts. The first describes the philosophy behind Arch Linux and its benefits as a distro, while the second part is a (very simplified) guide on setting up your first Arch install. I won't go through some of the more basic explanations since, as Linux users, you probably know how to burn an ISO image to CD, what the difference between 32- and 64-bit operating systems is, and so on.
Bear in mind that while this guide should get you started, this is by no means a one-stop-shop for all Arch Linux knowledge. I highly, highly recommend you also browse the Arch Linux Wiki, especially the Beginner's Guide, before you actually begin. The forums are also a great source of info, so check them out as well. If you just follow the steps in this guide and go "ta-dah!", you'll miss the point of what Arch Linux has to offer. The Beginner's Guide can be a bit overwhelming, since it incorporates so many different possibilities that many first-timers won't deal with, so I've created this guide to inspire you and help show you that it isn't as nerve-racking as it may seem—but you'll still want to use multiple resources when you go to install your system.
Why Arch Linux?
As Arch is definitely not for Linux beginners, you may be wondering what its advantages are. While it's pretty popular among developers and the like, it's also pretty popular among general tweakers and geeks that like to really get at the nuts and bolts of a system. If you've been a Linux user for a little while and you'd love to get a bit deeper and learn about how it works so you can more properly and openly configure it to work for you, Arch is the perfect next step in your journey.The Arch Way
The general philosophy of Arch Linux is based on simplicity. Specifically, Arch aims to be an efficient, user-centric, open, eleganty coded distribution that doesn't sacrifice anything for convenience. That is, when faced with choice between more efficient code and a simpler experience for the average computer user, Arch will always choose the former.
However, while this may seem like a burden to some, it's actually one of Arch's biggest advantages. Instead of configuring the distribution to be idiot-proof, Arch forces you (politely) to learn what each configuration file and important terminal command does early on. Thus, when something breaks or when you want to configure something beyond what KDE or GNOME has options for, you pretty much already know where to go and what to do.Note that I'm not trying to say that idiot-proofing is a bad thing. In fact, being simple to use is one of the best characteristics a modern OS can have—for the average PC user. Once again, this guide is not for those people. This is for the people that strive to tinker with their operating system's insides.
Why, as an Ubuntu User, You May Want to Switch
You'll Know What's Really Going on Behind the Scenes
For the record, I love Ubuntu. It works great out of the box on my netbook, and I don't see myself migrating that PC to a new OS anytime soon. I've also used it to repurpose some old PCs for my mother around the house, up north, etc. and it works beautifully. If you use Linux solely because it's free, open, and easy to use, you don't need to complicate your life for no reason. However, if you've used Linux for a little while and would like to take the next step, Arch is where you want to go.While Ubuntu works out of the box with a lot of comptuers, and provides a lot of user-friendly configuration for certain things, it's a nightmare to configure for others. It provides no way of teaching you where the correct config files are for your eighty button mouse or your three monitor setup, and I hate to say it, but in my experience the Ubuntu forums have been less than helpful. Again, not to hate, but that's just what I've experienced.
Arch's installation doesn't really have a graphical interface. It's mostly done through the command line, and consists of you using a guide like this and the fabulous Arch Wiki to partition your drive, install a minimal base system, and go through each base configuration file and learn what it does. So one day, when you want to automatically mount another hard drive when Arch boots, you will know, at the very least, it requires adding something to the
options
column of /etc/fstab
, and you won't be the least bit intimidated by that fact. And, when you don't know what to do, Arch has one of the best documentations and communities I've ever seen.You'll Always Have the Newest Software
Unlike other popular operating systems, Arch doesn't have a big update every two years, one year, or even six months—Arch updates whatever it wants, whenever it wants, which means you're constantly on the bleeding edge of both the OS and the software you use.Note that in this instance, "bleeding edge" does not mean "ridiculously unstable". Lots of testing goes into these packages before they get added to the repositories, and you aren't going to find your PC crashing every day because you're always getting the newest updates. What it really means is that you'll get software updates as soon as they're ready to use, not as soon as Ubuntu gets around to updating their repositories. If Thunderbird releases an update, you'll get that update the next day—not the next month.
You Build a Killer Operating System that Fits Your Needs and Wants
Since you start off with a minimal install and build up from there, you won't have any unecessary packages bloating up your system. You have complete control over everything that goes into your setup, and you can make it as small and minimalistic or as big and powerful as you want—you essentially build your own, fast, stable, super-customized Linux distro from the ground up. And who wouldn't love that?
Installing Arch Linux
If all this sounds like your dream come true, then it's time to move on to the next step: actually installing Arch. While the Arch Wiki has a great Beginner's Guide (have I mentioned that you should read it?), I found I still ran into a few hiccups along the way, and the wiki is so full of (great) information that it can be a bit overwhelming for an Arch first-timer. For example, the beginner's guide goes through lots of different possible situations—i.e., if you're using a static IP, if you require wireless internet from the getgo, etc. Instead of trying to sift through all that and ignore the more advanced stuff that may not apply to you, I've created this guide that should get you up and running without your brain exploding.
This guide contains the methods I found work best and were easiest for me, and they should work with most PC builds without a problem. If you do run into any problems, or have any specific needs that aren't fulfilled by this guide (like if you are using a statip IP), you can probably find more detail in the corresponding section of Arch's Beginner's Guide, so head over there when necessary.Click on any of the following images to get a closer look.
Install The Arch Linux Base
The first step is installing the Arch Linux base system on your drive. This consists of the easy stuff like setting the clock, getting your partitions in order, and selecting any packages that are necessary out of the gate, and the educational part where you learn what each base config file does and how to edit it.Get Yourself an Arch Linux Install CD
You can install Arch many different ways, but we're going to use your basic CD installation. If you don't have an optical drive, you can always install it from a USB flash drive, too.
There are two main types of installations for Arch: Core and Netinstall. The Core ISO contains all the packages you need to install Arch, while the Netinstall ISO grabs them all from the net. The Core takes longer to download at the beginning, while the Netinstall will take longer when you download all the packages—though the Netinstall will grab all the most up-to-date packages, while you'll have to update the Core install afterwards. We'll use the Netinstall version, since it's faster in the end and we'll assume you have an internet connection on the computer in question. However, you can still follow this guide with the Core CD no problem.Head over to the Arch download page and download the ISO you want, making sure to distinguish between the 32-bit (i686 CPU) and 64-bit (x86-64 CPU) installations. If you tend to be wary of 64-bit OSes, I wouldn't worry—Arch is really good about keeping everything compatible.
Set Up Your Partitions
While you could always partition your drive from the Arch Linux installation CD, you might as well do it now, especially if your computer already has a working OS on it (and since you'll need something to do while that ISO downloads and burns). Assuming you already know how to partition drives, go ahead and make one for your OS and a nice 1GB swap partition for good measure. Format them however you want; you'll just reformat them once you install Arch. This setup merely takes the fear out of partitioning, which can be a litte nerve-racking when done from the command line.If you do this from Linux (like a Live Ubuntu or GParted CD), you'll make your life a lot easier. Once you split up your partitions, note the names of the two you'll be using (i.e.
/dev/sda1
as the OS partition and /dev/sda2
as your swap partition), as that's how you'll have to refer to the partitions during the install process.Boot from the CD and Start the Installation
Boot up from your newly-burned CD and choose "Start Arch Linux" at the prompt. When it finishes booting, you'll get a command-line login prompt. Login as
root
(no password necessary). If you don't know the names of your drives, type in fdisk -l
and note the name of the drive you've formatted for Arch (e.g. /dev/sda1
). When you're ready to install, run the following command and fasten your seat belt:/arch/setup
Installing the Base System
The first part of the installation is pretty simple to navigate, you actually have some semblance of a GUI here to work with. The setup takes you through eight steps, bringing you back to the main menu when you finish each one, ready to move on to the next.
Step 1 is to select your installation source. If you're using the Core installer, choose "cd", if you're using the Netinstall, choose "net". If you choose Netinstall, it will guide you through the process to set up your network and find a mirror for the packages. Setting up the network should be straightforward and problem-free as long as you're using wired internet. If you're using wireless, I highly suggest you plug your computer in for the installation and set up wireless later, though you can also set up wireless now if you prefer. When prompted to pick a mirror, just pick something on your continent, if possible—it doesn't make a huge difference at this juncture. So, if you're in the US, avoid mirrors with
Step 2 is setting the clock. This step is pretty easy; just follow the instructions. When it asks you to set the time, choose UTC if you only have UNIX-like operating systems on your computer (this includes Mac OS X), and choose "localtime" if you'll be dual-booting Windows..de
or .it
domains, for example. When you're done, return to the main menu.Next, prepare your hard drives. If you've already partitioned your drives as you want them, skip to step 3 of this part, "Manually Configure Block Device, Filesystems and Mountpoints".
Pick "dev" at the next prompt, select the partition on which you want the OS, and hit Enter. Select your desired filesystem—I personally use ext4, though ext3 is also a popular choice—and hit Enter again. Select root (
/
) for the mountpoint, and enter a name for the partition if you so desire. Leave the options boxes that pop up blank, unless you have reason to believe you need specific options (again, if you're an advanced user). Go through the same process for your swap partition (formatting it as Swap).When you're done and you see both partitions scroll down to "DONE". It will give you an error message, likely stating that you don't have a separate /boot filesystem—this is fine; just hit ignore and continue on.
Step 4 consists of selecting packages to pre-install on your system. Honestly, I didn't need much here, but it's good to go through the step anyway. Just hit OK on the first window, as you don't need the
base-devel
packages. When it gives you a long list of packages, I'd recommend scrolling all the way down to the bottom and selecting wireless_tools
, if you have a wireless network you want to connect to. Hit space to select a highlighted package, and hit Enter to continue to the next step.Step 5 will install all the necessary packages. Grab a cup of tea and let it do it's thing; it'll take awhile.
Step 6 is where you want to pay attention, even if you don't have to do a ton of modifications. This step will take you through the base config files, which will give you an introduction to some of the action going on behind the scenes of your OS. Pick "nano" as your editor (as it's the easiest), and go through each config file as described below. This is one of those situations where you should definitely browse the Beginner Guide's corresponding section for more detail, but the following should provide very basic outlines and the steps you'll actually need to go through.
/etc/rc.conf: This file is your general system configuration file. It contains a lot of different things, from your location and timezone to what hardware modules you load on startup. Right off that bat, you'll need to scroll down to the NETWORKING section and set your HOSTNAME to whatever you want, and add wlan0
to your INTERFACES if you plan on using wireless networking (so the line would read INTERFACES=(eth0 wlan0)
). Again, if you're using a statip IP, you may need to enter more here. Take a look at the DAEMONS section, because you'll see it a lot in the installation process—it basically lists all the scripts we want to start up with our computer. We'll be adding a few in the near future./etc/fstab: Fstab stands for File Systems Table. This file lists your available drives and partitions and decides how you'll use each one. The columns, in order from left to right, list the file system's name, mount point, format, and boot options. You probably won't have to do anything here at the moment, but if you have a lot of partitions on your drive, you'll probably find yourself back here soon. Check out the Fstab wiki entry for more information.
/etc/mkinitcpio.conf: This file configures the initial ram filesystem (also known as initramfs), which is essentially the image that performs the actions necessary for your hard drive to control the Linux kernel (like loading the SATA module required to recognize the drive). You probably don't need to do anything here at the moment./etc/resolv.conf: You will only need to even think about this file if you use a static IP, which as I've mentioned, we won't go throug here.
/etc/hosts: This file associates hostnames with their IP addresses. Make sure your computer's hostname matches the one you picked in
/etc/rc.conf
(which it should have done automatically), and move along./etc/hosts.deny and /etc/hosts.allow: These files deny and allow incoming connections from specific IPs. You'll only need this if you plan on using ssh. The allow file will allow only connections from the ips you select, and reject all others, while the deny file will only deny the ones you list.
/etc/locale.gen: You'lll need to select your location here. By default, everything should be commented out except the two marked
en_US
, which if you're an English speaker from the US are the two you want. Make sure that's correct (or, if you're from elsewhere, comment them out and uncomment the ones for your location) and move on./etc/pacman.conf: Pacman is the incredibly awesome package manager for Arch Linux, and these are the files that configure it, including which repositories it searches. You're probably fine with the default three repositories: [core], [extra], and [community]. However, if you're on a 64-bit system, you'll probably want to head into
/etc/pacman.conf
and uncomment the [multilib] line and the line below it, near the bottom of the file. This adds the [multilib] repository to your setup, which contains 32-bit applications for those situations in which you need them./etc/pacman.d/mirrorlist: This file contains a list of mirrors that Pacman uses to download files. Again, go ahead and uncomment one or a few mirrors near you. They'll work for now.
When you're done viewing all the config files, hit "Root-Password" to set the password for the
root
account, then scroll down to "Done" and press Enter. It will run through a few processes to configure your system and return you to the main menu.Step 5 is installing the bootloader, which for the purposes of this guide will be the ever-familiar GRUB. It will throw you into the config file, which you might like to poke around in, but doesn't really need editing at the moment.
Depending on if and how you're dual-booting, you'll want to install this in a different place, but the default of
/dev/sda
(where sda
is the drive upon which Arch is installed) should be fine. Note that's /dev/sda
, not /dev/sda1
—you want to install this on the drive, not the partition, if you're using it as your main bootloader. Now, if you're using a different boot menu or bootloader already (such as Chameleon for Hackintoshes, rEFIt for Macs, etc.), you'll want to install it on Arch's partition instead.When you're done, go ahead and exit the install, and type
reboot
when you return to the command prompt. Arch is now installed on your system. However, you aren't out of the woods yet—the next step is making sure your network, sound, video, and other things are in line and installing a desktop environment from which you can work.Configure the Necessities
If you can get your base system to reboot to a simple login prompt, congratulations! You have a working base system. Now, we're going to get some of the details ironed out, like sound, graphics, users, and other back-end necessities.Update the System with Pacman
Log back in as root. If you used the Netinstall, you're most likely up to date, but for piece of mind and teaching purposes we'll update the system now anyways.Pacman is the package manager used in Arch, and it's essentially the Arch equivalent of Apt in Ubuntu. Pacman is simple, lightweight, and fast, and surprisingly easy to use. I don't miss Synaptic's graphical interface at all; installing things from the command line is such a cinch that it seems unecessary.
As of right now, you're using whatever mirrors you uncommented during the installation. That's fine, but if you want to optimize your package downloading, I'd highly recommend building a mirrorlist using the rankmirrors script as descirbed here. It will find the mirrors closest to you, which is nice.
To update your system, run the following command:pacman -Syu
Note at this point you may get some errors, failing to retrieve files from mirrors—I definitely had this problem more than once—and often it's because a specific mirror is down. If you edit your mirrorlist with the following command:
nano /etc/pacman.d/mirrorlist
Add a User and Install Sudo
Since we don't want to use the system as root all the time (as that can be dangerous), the next thing we'll do is add you as a user. To do so, just run the following command:useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash whitson
Of course, replace
Next, add a password for your new user by running:whitson
with your desired username. The long string of comma-separated terms contains the groups to which your user belongs. The ones listed should be fine, though they aren't the only ones—if you have a floppy drive or scanner, you'll want to add floppy
and/or scanner
to the list. For a full list, check out the Groups wiki entry.passwd whitson
You'll also probably want to install Sudo at this point, since you'll no doubt need it for many a task (as you've already learned if you're a regular Linux user). To do so, just use Pacman:
pacman -S sudo
pacman -Ss sudo
and it would search the repositories for "sudo", returning to you a list of packages containing that name. Of course, you could also search the database on Arch Linux's web site.
Once you've installed Sudo, you'll want to add your user as a valid sudoer. You'll need to use the special command visudo
to do this, which uses the editor vi to edit /etc/sudoers
. Unfortunately, vi is not very friendly if you don't know how to use it, so for now we'll change visudo
's default editor to our friend nano by running it with the EDITOR variable, like this:EDITOR=nano visudo
/etc/sudoers
:%wheel ALL=(ALL) ALL
Installing ALSA
Before installing ALSA, you'll want to edit your/etc/modprobe.d/modprobe.conf
file by typing nano /etc/modprobe.d/modprobe.conf
at the command prompt. Add the following line to the file:options snd-pcsp index=2
snd-pcsp
modeule load last, ensuring that your sound will work correctly. Then, install alsa-utils
with Pacman. You should know how to do this by now, but for good measure, the command is pacman -S alsa-utils
. However, you'll also probably want alsa-oss
. You can actually install them both in one fell swoop with:pacman -S alsa-utils alsa-oss
su - yourusername
and then enter:alsamixer
Exit alsamixer with Esc and check if your sound is working correctly by typing in the following command:
aplay /usr/share/sounds/alsa/Front_Center.wav
Switch back to the root user by running
su
and type in alsactl store
to store these values. To make your computer call on these settings at boot, throw your /etc/rc.conf
into nano and add alsa
to the DAEMONS section, like so:DAAEMONS=(syslog-ng network netfs crond alsa)
Installing X
We're nearing the end, hang in there! The last thing before installing the desktop environment itself is to set up X, the window manager. Start by installing Xorg:pacman -S xorg
mesa
if you forsee yourself using 3D graphics.Now comes what, in my experience, is always the most troublesome part of a Linux installation: video drivers and configuring X. You can check out a full list of open source video drivers here, and you can see exactly what chipset you have by running the command
Before testing X, you'll also want to grab lspci
. If you have an Nvidia or ATI graphics card and forsee wanting 3D graphics acceleration, you'll probably want the proprietary drivers, which you can read about on the Nvidia and ATI wiki pages. You'll want to read both that page and the video driver section of the Beginner's Guide for more information; there's just too much to cover right here. You'll use Pacman to install the drivers, though, so at least that's something you should be comfortable with by now.xf86-input-keyboard
and xf86-input-mouse
with Pacman:pacman -S xf86-input-keyboard xf86-input-mouse
xf86-input-synaptics
as well.A note about xorg.conf: There is still one configuration file we haven't mentioned yet, and it's the one that gives me the most grief in life.
For now, let's try starting X as-is:etc/X11/xorg.conf
(or, since xorg.conf is mostly depreciated, the files in /etc/X11/xorg.conf.d/
is what configures X, and while you may not need to configure it right this second, you will undoubtedly be coming back to it as you tweak your system later on, whether it's to extend your desktop to a second monitor or to get your eighty-button mouse working. Once again, there's way, way, way too much information about xorg.conf to go into here, so if you have trouble at this step, the corresponding Beginner's Guide section and the dedicated wiki entry are your friend.startx
exit
into xterm and hitting Enter.It is here where I learned I used the wrong video drivers, so I had to uninstall the old ones and reinstall a different package. For the record, to remove a package in Pacman, just type:
pacman -Rns package_name
n
flag removes all the configuration files related to a package, while the s
flag removes any dependencies that are now unecessary. I generally always use n
and s
when removing a package, because I like to keep my system relatively clean.If you're having trouble with your video drivers and testing X, there's more information on troubleshooting it in the Beginner's Guide.
Get the Desktop Up and Running
You're in the home stretch now (well, the home stretch to getting a running desktop environment, after which you still have a lot of setup to do—but the fun kind). This part is easy; just install a few fonts:pacman -S ttf-dejavu ttf-ms-fonts
pacman -S gnome gnome-extra gnome-system-tools
pacman -S kde
/etc/rc.d/hal start
dbus
, hal
, and your graphical login (either gdm
or kdm
) to the DAEMONS section of /etc/rc.conf
. Make sure dbus
and hal
come before network
or networkmanager
, like this:DAEMONS=(syslog-ng dbus hal network netfs crond alsa kdm)
startx
(as a normal user) or, alternatively, restart your computer and enjoy your new desktop environment.Where to Go From Here
Obviously, this isn't the end of the story. It's not up to you to configure your desktop as you see fit. You're on your own now, but here are a few things you might want to read up on:- Browser Plugins: You'll probably want (however begrudgingly) to install Adobe Flash, and this wiki page will help you do so.
- Arch User Repository: One of the really neat things about Arch is that, for packages not in the usual repositories, there's the AUR, a great, communidy-driven repository that contains packages. You'll definitely want to read up on it and, if you don't find a specific packages in the Arch repositories, check the AUR to see if someone has built it. To make your life even easier, install something like Packer to make installing AUR packages as easy as using Pacman (e.g.
packer -S chromium-dev
). - Use the Forums: They'll be your greatest source of help. Of course, make sure you Google and search the forums before you go and start asking questions.
- Compiz: Because who doesn't like cool desktop effects? Alternatively, KDE users can also use the built-in Kwin just by going to System Settings.
- Xorg: I know I already mentioned this, but again—whether you're setting up your dual monitors or getting all those extra mouse buttons working, you're probably going to have to mess with Xorg. Also read up on your individual video cards, and search the wiki and forums for article specific to your hardware and peripherals—you'd be surprised which things are already heavily documented.
0 comentarios