Let’s Talk Portage
One of the scariest things people run into with Gentoo based systems is Portage. It’s not that scary if you just take 5 minutes and read through the material. So you just did a fresh install and have no idea how to install packages. Sabayon and Gentoo have wonderful package manager. Emerge is the client to Portage. We will use emerge to do what we want.
First thing you want to do as root - to do this, open up konsole and type su than
- emerge –sync ——> this may take some time the first time. This is updating your package list so you can have access to the latest packages.
- layman -S ——–> after the above is done it’s time to update your overlay package list so you can have access to it’s latest packages. “Overlays” are package trees for Portage.
After that is complete you are now ready to install the latest packages. You may issues both commands at same time by simply doing emerge –sync && layman -S. That one command will do the same as running both the commands above. So now lets say we want to install the package called foo.
- emerge foo ——-> pretty tough huh? What if you just want to update foo since it’s already installed
- emerge foo or emerge -u foo ———> either of those will work. The -u option also upgrades all dependencies of that package instead of just the package itself.
- You should get into the habit of using the -av or -pv switches so you can see what is going to happen to your system before hand. emerge -av foo will ask with verbose before it actually installs and emerge -pv foo will just do a pretend with verbose and not actually install anything. You don’t want to spend 45 minutes compiling something to discover you forgot a flag or something.
Super now you are adding packages to your system. Installed something you don’t like?
- emerge -C foo ——> will remove that package, but it doesn’t remove the dependencies it brought with it. You will have to use depclean for that, but you better know what you are doing before depclean as you will more than likely hose your system. Also note, Portage is case sensitive.
Lets say we want to install or uninstall several packages
- emerge foo foo1 foo2 foo3 foo4 foo5 ——–> this will install each package one after another.
- emerge –resume –skipfirst ——–> use this option if package foo2 fails in the above command, but you still want foo3 foo4 and foo5 to install. It will resume the installations, but will skip the package foo2.
- emerge -C foo foo1 foo2 foo3 foo4 foo5 ——–> this will uninstall each package one after anther.
How to find a package in portage
- emerge -s foo ——–> this will find all packages that contain foo. So if you want to install firefox and you are punching in emerge firefox and portage is going there are no ebuilds for firefox you will want to do a emerge -s firefox and you will discover that the package is really called mozilla-firefox.
- I highly recommend you install eix as it is the king for searching portage. You don’t want to be without this great tool. It works for finding packages in overlays even. Don’t even think about it, just get it.
- emerge eix && update-eix Than all you have to do is eix foo instead of emerge -s foo
Gentoo based systems are an install once and just maintain your system via portage. It takes a while to get the hang of doing system and world updates. You need to understand portage and listen to it as you can run into errors with compiling packages for various reason. You will need to search out the solution via gentoo, sabayon forum or bugzilla. It’s something that just comes to you as you use the operating system
- emerge -uaDN –world —–> is the command you will want to get familiar with. After you have done your syncs this command will bring you current with portage. I highly recommend you take a look at a really nice script that will make your life easier for updating. This will do the above command and more, such as help work around blocks and packages that fail.
- It’s not necessary to do this daily, but some do setup a cron job to run a world update. I personally do it like once a week. I guess do it as you feel you need to.
- People frequently ask about an auto update notification. It’s pointless in the gentoo based world as portage changes every day. As I said, some people set up a cron job to run daily for a world update. You can see for yourself daily changes.
- C0mpiling isn’t fast by any means. People are horrified to find out it took 40 minutes to install firefox. I just say back, try openoffice than, you’re talking 6 hours on a fairly decent machine. Luckily there is a binary version of openoffice in portage to ease the pain.
- Sabayon Linux is developing a binary package manager that you can use in replace of portage. As of today, it is still in beta and is called entropy that uses the client equo to manage packages. Instead of emerge foo you will do equo install foo. You can even do world updates with equo, but keep in mind that entropy will not have the latest packages like portage will. It will be close to portage, but portage will always have the latest. So if you don’t want to compile your packages, entropy will be for you. There will be a GUI available with entropy also.
- Speaking of GUI package managers, I don’t really recommend them. They all have their problems and are just not reliable. Many people have a GUI package manager and use it for browsing portage, but use the command line to actually install the package. Don’t be afraid to use the command line, it’s your most powerful tool you will get your hands on. When all else fails you can normally always depend on your command line. Learn it, can’t stress it enough.
- Layman is another handy tool to have. Let’s face it, portage can not contain every single package out there. Overlays help solve this and you can even maintain your own personal overlay if you wish. So if a package is not in portage, check the overlays. You can use eix to search for packages in portage and overlays. Once you find the package, use layman to add your overlay and emerge your package.
- eix foo
- layman -a overlayname
- emerge foo
- Security aka GLSA is very well documented in the handbook.
- glsa-check -t all - to see if effected
- glsa-check -p $(glsa-check -t all) - to see what packages will be installed
- glsa-check -f $(glsa-check -t all) - to apply updates
It’s definitely something you have to learn and see the Sabayon Linux wiki for even more information on Portage. Bookmark the gentoo wiki as it is full of howtos to follow. Follow the links posted in this post to explore more information. Use the package manager as much as you can as this will help maintain your system with ease. Things installed outside of the package manager are totally on their own and can cause problems.