UPDATE 06-10-2010: Now it includes a way to automatize installation once you boot onto the new system.
NOTE: If you don't have a pacman cache, or your packages are not up-to-date you are probably wasting your time here. Sync pacman and check your cache first. You are advised.
NOTE: This HOWTO is also useful if you have an updated Arch system on a computer and you want to install Archlinux on another computer (same architecture, of course).
One of the most interesting Archlinux features is it's rolling-release system. You don't have to re-install your system from time to time, there are no "versions" like in Ubuntu/Debian/etc. You just need an up-to-date mirror for pacman. If pacman says that your system is updated, then you have the last "version" of Arch. So, you can live for years without formatting your drives. Yes, so simple. That's why Arch is sooo wonderful : )
But, what if you want to install Archlinux from scratch because you messed up your current installation? This is the fastest way when things go that wrong. However, there are some feelings on my mind when starting this kind of process:
- The core iso being too old (so after re-installing, pacman will probably update almost the whole core system)
- The netinstall iso being unuseful (no internet) or the internet service being very slow.
- A juicy pacman cache that I wonder I could use to trick the netinstall iso to make it download zero (or almost zero) bytes.
That's impossible.
No, I'm joking. I won't be writing a howto then ¬_¬ OK, let's make it work.
1. Get your Archlinux ISO as normal. I used the netinstall image, don't know it this will work on the core image. There are BitTorrent downloads, by the way. Note there is a dual architecture image that works on both i686 and x86_64 systems (it's bigger, of course).
2. Burn it to a CD (or make a LiveUSB). If you don't know how to do these things, take a look at the wiki.
3. At this point, make a backup of your pacman cache. It's located at /var/cache/pacman/pkg. You can backup it to another partition (i put it on my home), to a CD/DVD, to another USB stick/hard-drive...or whatever the archlinux live medium can see. In case you are not using CD/DVD I suggest ext2/ext3 or FAT partitions, they are less conflictive. You may also clean the pacman cache to wipe older versions (be careful, keep in mind you may need to downgrade packages in the future). How? Edit your /etc/pacman.conf and uncomment the line "CleanMethod". To keep only last versions, it may look like this:
CleanMethod=KeepCurrent
Now you can do pacman -Sc.
If you want to automatize the installation later, do this also (as suggested here):
NOTE: You need to have at least the (updated) core packages on your pacman cache. Otherwise, you are wasting your time here. If you have other up-to-date packages on the cache (Xorg, KDE/Gnome, ...) backup them also because you can restore the cache once the system is working again and use them. Full KDE is about 800 MB, I'm just telling you.
If you want to automatize the installation later, do this also (as suggested here):
pacman -Q | cut -d' ' -f1 > pkgs.txtThis will put a list of your currently installed packages (including AUR/ABS ones) on pkgs.txt. Save this pkgs.txt file with your cache backup, we'll use it later to tell pacman to reinstall the whole system. You should delete AUR/ABS packages from the list (if you plan to use yaourt/powerpill/..., AUR packages will be managed correctly).
NOTE: You need to have at least the (updated) core packages on your pacman cache. Otherwise, you are wasting your time here. If you have other up-to-date packages on the cache (Xorg, KDE/Gnome, ...) backup them also because you can restore the cache once the system is working again and use them. Full KDE is about 800 MB, I'm just telling you.
4. Boot from your CD/USB. You'll get something like this, choose the correct option:
Archlinux LiveCD/USB Boot Screen |
Refer to the wiki for instructions on how to do the install process, if you need.
5. Proceed as normal until you get to the AIF menu.
The AIF menu |
Now proceed as if you were to do a normal netinstall. On the "Select Source" submenu, choose "net" and let the installer setup your network card. Choose a mirror, set your clock and prepare your hard drives as normal. Again, refer to the wiki if you are a new archlinux user. Go through "Select Packages" and stop. But DO NOT install them.
You have to go through this to let pacman refresh it's database. Otherwise, pacman won't know if there are new versions of your packages and you may end having unexpected errors, a messed-up system or something worst.
6. OK, let's do the magic. Insert the USB/CD/DVD/whatever with the pacman cache (if you have put it on an internal HD, do nothing). Go to another tty (p.e: Alt+Ctrl+F2)
Welcome to /dev/tty2 : ) |
Login as root again, and mount your cache media or your internal drive partition to somewhere like /media/fl (or make a temp mountpoint on another folder).
mount /dev/whatever /path/of/destination
Check that the files are there. If so, tell your computer the magic words:
mount --bind /media/fl /src/core/pkg
If the folder /src/core/pkg does not exist, just create it with mkdir, and then tell the magic words again. You may also be able to copy the base packages (since it's the only thing that's going to be installed) to this folder, but mounting it that way is faster.
Now, go back to the AIF menu (it's in tty1) and select the first option again. This time, on the "Select Source" submenu, choose "cd" and you'll see the light in the form of a text message.
The light |
7. Done! If there are no more error messages, you can now continue the process selecting "Install packages". The installer will use the packages from /src/core/pkg if they are the updated versions. If some package has been updated since your last sync, the installer will download it from your chosen mirror (I had to download the kernel26 package, about 23 mb). Nice, isn't it? : D
From here, you can finish the process as normal. If your backup has other packages than the base ones, mount it again once you are logged into your new system. Sync pacman and copy the packages back to /var/cache/pacman/pkg. Now you can reinstall the rest of the system from your backup : )
It's also the moment to use the pkgs.txt file we made.
It's also the moment to use the pkgs.txt file we made.
pacman -S `cat pkgs.txt`Just using this command (again, as suggested here) will tell pacman to install every single package you had on your system before wiping it. If there's some error messages about a non-existant package, just remove it from the list. And, if it's related to an AUR package, you may rely on yaourt/powerpill or any other pacman wrapper able to install AUR packages.
Enjoy!
Wu Ying Ren 死
Related links
- http://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide
- http://wiki.archlinux.org/index.php/Beginners'_Guide
- http://wiki.archlinux.org/index.php/Pacman_Tips
- https://bbs.archlinux.org/viewtopic.php?id=28660
Cap comentari:
Publica un comentari a l'entrada