Gentoo
From LinodeWiki
Contents |
[edit] Installation
Gentoo setup - A step-by-step guide from one user's experience with setting up Gentoo from the given Linode Gentoo base image.
Note: I personally found that guide un-necessarily complicated and rather bloated so I wrote mine here. In my opinion if someone is going to use Gentoo they know how to add users and other simple linux tasks. If they don't I wouldn't personally recommend they run Gentoo since it certainly isn't the ideal distro if you're new to Linux and want to host things with it. My guide here wil be much simpler and just gets to the point of getting the system up-to-date and ready to do whatever you're planning to do with it.
[edit] Kernel Upgrade
The first thing any self respecting Gentoo user is going to want to do is tun the latest and greatest kernel because let's face it - gentoo is about being on the edge! :) In order to run the latest Linode offered kernel you must first install a standard gentoo image (amd64 or x86) and boot that. Then SSH to the box and make the following changes:
Open /etc/securetty in your favorite editor (nano being mine) and to the bottom of that file add:
hvc0
Then open /etc/inittab and find the lines:
# From Linode: don't uncomment this line c0:12345:respawn:/sbin/agetty 38400 tty1 linux
Then change to to:
# From Linode: don't uncomment this line c0:12345:respawn:/sbin/agetty 38400 hvc0 linux
Once you've done that you can shut down your VPS, switch to the latest paravirt kernel using the Linode panel (make sure you don't use the x86_64 for a x86 install or a x86 for an x86_64 (or amd64) install.)
[edit] Sync Portage
The Gentoo image is really rather old so there is likely going to be a lot of syncing to do - best to get that out of the way early!
emerge --sync
[edit] Switch profiles
The default profile is from 2008 which at the time of writing is three years out of date, this needs to be addressed so run the following commands to switch to the latest profile:
rm /etc/make.profile ln -s /usr/portage/profiles/default/linux/amd64/10.0/server/ /etc/make.profile env-update && source /etc/profile
Note: You will want to check which is the latest server profile and switch arch if necessary. This was just the latest amd64 server profile at the time of writing.
[edit] Install axel
Since we're going to be doing a lot of downloading it would be extremely wise at this point to switch from wget to axel for our portage downloading needs. This is because axel supports multiple parallel connections for each downloading meaning an overall faster download time and since we're running on a fantastically fast internet connection here we can benefit greatly from this.
emerge axel
[edit] Update /etc/make.conf
Firstly edit your /etc/make.conf and replace all of the contents there with the following (the following example is for amd64 only):
CFLAGS="-march=nocona -O2 -mno-tls-direct-seg-refs"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
MAKEOPTS="-j2"
ACCEPT_KEYWORDS="~amd64"
FEATURES="sandbox ccache parallel-fetch"
CCACHE_SIZE="256M"
# Uncomment following line to allow portage to build packages without disturbing the rest of the system too much (not during install time)
#PORTAGE_NICENESS="15"
FETCHCOMMAND="/usr/bin/axel -a -o \${DISTDIR}/\${FILE} \${URI}"
RESUMECOMMAND="${FETCHCOMMAND}"
USE=""
Note: You can add any USE flags you know that you need now if necessary - this guide just gets you an up-to-date installation for you to play with so I haven't used any.
[edit] Set locales
This step will remove a fair amount of wasted compile time and wasted space so it's a good idea. Basically we are going to remove non-necessary system locales for other languages.
Edit /etc/locale.gen and replace the file contents there with:
en_US ISO-8859-1 en_US.UTF-8 UTF-8 en_GB ISO-8859-1 en_GB.UTF-8 UTF-8
Note: You can remove the en_GB entries if you are US-based, these are great britain locales (since I am based in England.)
[edit] Install and setup ccache
Note: ccache is no longer recommended for Gentoo. See here.
Using ccache allows the configure stage of building packages to happen much faster by caching commonly accessed checks. This really is a very standard feature to use in a gentoo setup and so we'll use it since we're going to be doing a whole lot of compiling.
emerge ccache
[edit] Update system packages
Execute the following to rebuild and update all system packages and clean up your system:
emerge portage && emerge binutils gcc gcc-config 2 source /etc/profile emerge -e world emerge --depclean
[edit] etc-update
Now it is necessary to update your configuration files via:
etc-update
Note: You should be extremely careful not to overwrite certain files with etc-update such as /etc/securetty as this can break your install. If you don't know what you're doing with this I would seek assistance with it from #gentoo on irc.freenode.org - they're a very helpful bunch generally!
[edit] Welcome to Gentoo!
At this point you should be running an up-to-date base gentoo amd64 multilib VPS! From here I recommend you refer to the official gentoo wiki for any further assistance since your base install is up and running. You may also wish to run a custom kernel but that is entirely your choice and for this guide I didn't bother since I have no need for one realistically.
