Installing Gentoo: Difference between revisions
Strugglers (talk | contribs) m (warning about this not being finished) |
(Formatted it to look nice, took the comments from the talk page, and appended stuff I've learned since the initial install) |
||
| Line 46: | Line 46: | ||
like PCI, power management etc.</p></li> | like PCI, power management etc.</p></li> | ||
<li>In /etc/rc.conf, set rc_sys="xenU"</li> | <li>In /etc/rc.conf, set rc_sys="xenU"</li> | ||
</ol> | </ol> | ||
==Pre install work== | ==Pre install work== | ||
| Line 72: | Line 64: | ||
<li>Disks are located at /dev/xvda and /dev/xvdb (swap disk) (run fdisk -l to be sure)</li> | <li>Disks are located at /dev/xvda and /dev/xvdb (swap disk) (run fdisk -l to be sure)</li> | ||
<li>fdisk /dev/xvda, and partition accordingly. | <li>fdisk /dev/xvda, and partition accordingly. | ||
<p> | <p>As this is a VPS, we don't really need a /boot partition, so just create 1 partition for /</p> | ||
<p>For completness, I toggled the boot flag on the /boot partition.</p></li> | <p>For completness, I toggled the boot flag on the /boot partition.</p></li> | ||
<li>Because I like things to be correct, I fdisk'd the swap disk to change the type to 82, | <li>Because I like things to be correct, I fdisk'd the swap disk to change the type to 82, | ||
| Line 78: | Line 70: | ||
<li>Filesystem types - I'm going with ext4. Change to suit. | <li>Filesystem types - I'm going with ext4. Change to suit. | ||
<syntaxhighlight> | <syntaxhighlight> | ||
mkfs.ext4 -L root /dev/xvdb1 | |||
mkfs.ext4 -L root /dev/ | |||
</syntaxhighlight></li> | </syntaxhighlight></li> | ||
<li> | <li> | ||
| Line 86: | Line 77: | ||
LABEL=swap, UUID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | LABEL=swap, UUID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
</syntaxhighlight></li> | </syntaxhighlight></li> | ||
</ol> | </ol> | ||
==Install== | |||
A summary of commands to run, with comments on decisions I made. Best advice is to use the gentoo handbook, so that you can make informed decisions yourself, and also have up to date information! Current on 2013-11-07. This is provided just to give some insight. | |||
<ol> | |||
<li>Make dirs and mount</li> | |||
<syntaxhighlight> | <syntaxhighlight> | ||
mkdir /mnt/gentoo | mkdir /mnt/gentoo | ||
| Line 94: | Line 90: | ||
mkdir /mnt/gentoo/boot | mkdir /mnt/gentoo/boot | ||
mount /dev/xvda1 /mnt/gentoo/boot | mount /dev/xvda1 /mnt/gentoo/boot | ||
</syntaxhighlight> | |||
<li>Grab the source code and extract. Change the URL to match current version and arch</li> | |||
<syntaxhighlight> | |||
wget http://www.mirrorservice.org/sites/distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20131031.tar.bz2 | wget http://www.mirrorservice.org/sites/distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20131031.tar.bz2 | ||
tar xvjpf stage3-*.tar.bz2 | tar xvjpf stage3-*.tar.bz2 | ||
</syntaxhighlight> | |||
<li> | |||
Make the appropriate edits to CFLAGS in /etc/portage/make.conf | |||
Read the guide at http://wiki.gentoo.org/wiki/CFLAGS for | |||
Make your own decision, but I've got: | |||
<syntaxhighlight> | |||
CFLAGS="-march=corei7 -O2 -pipe -fomit-frame-pointer", but make your own decision. | |||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Make the appropriate edits to MAKEOPTS in /etc/portage/make.conf. | |||
Make your own decision based on what virtual hardware you have, but I've got 1 core, so have got: | |||
<syntaxhighlight> | |||
"MAKEOPTS="-j2" | |||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Mirror select isn't available in the rescue environment, so here are a couple of good example for the SYNC and GENTOO_MIRRRORS to paste into /etc/portage/make.conf: | |||
<syntaxhighlight> | |||
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage" | |||
GENTOO_MIRRORS="http://gentoo.virginmedia.com http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo http://mirror.bytemark.co.uk/gentoo http://mirror.qubenet.net/gentoo" | |||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Setup the virtual environment, and chroot in | |||
<syntaxhighlight> | |||
cp -L /etc/resolv.conf /mnt/gentoo/etc/ | cp -L /etc/resolv.conf /mnt/gentoo/etc/ | ||
mount -t proc none /mnt/gentoo/proc | mount -t proc none /mnt/gentoo/proc | ||
| Line 113: | Line 133: | ||
source /etc/profile | source /etc/profile | ||
export PS1="(chroot) $PS1" | export PS1="(chroot) $PS1" | ||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Update Gentoo | |||
<syntaxhighlight> | |||
emerge-webrsync | emerge-webrsync | ||
emerge --sync | emerge --sync | ||
</syntaxhighlight> | |||
Read the news. This stuff is useful, and should be read. | |||
<syntaxhighlight> | |||
eselect news read | eselect news read | ||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Basic setup | |||
Look at the profile list. I'm sticking with a "server" install, the default. | |||
<syntaxhighlight> | |||
eselect profile list | eselect profile list | ||
</syntaxhighlight> | |||
Make any changes to the USE variable. I chose to leave it as is for now. | |||
<syntaxhighlight> | |||
nano -w /etc/portage/make.conf | nano -w /etc/portage/make.conf | ||
</syntaxhighlight> | |||
I'm in the UK. Change accordingly. | |||
<syntaxhighlight> | |||
cp /usr/share/zoneinfo/Europe/London /etc/localtime | cp /usr/share/zoneinfo/Europe/London /etc/localtime | ||
echo "Europe/London" > /etc/timezone | echo "Europe/London" > /etc/timezone | ||
</syntaxhighlight> | |||
I like gentoo-sources. You can go with vanilla-sources if you wish, there are others too. | |||
<syntaxhighlight> | |||
emerge gentoo-sources | emerge gentoo-sources | ||
</syntaxhighlight> | |||
Configure your kernel. See my stuff at the top for essential enables, then the rest is up to you. | |||
Probably should look at http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml if you're new to Gentoo. | |||
<syntaxhighlight> | |||
cd /usr/src/linux | cd /usr/src/linux | ||
make menuconfig | make menuconfig | ||
make && make modules_install | make && make modules_install | ||
cp arch/x86_64/boot/bzImage /boot/vmlinuz | cp arch/x86_64/boot/bzImage /boot/vmlinuz | ||
</syntaxhighlight> | |||
Edit your /etc/fstab. Mine is below: | |||
<syntaxhighlight> | |||
/dev/xvda1 / ext4 noatime 1 1 | |||
/dev/xvdb1 none swap sw 0 0 | |||
</syntaxhighlight> | |||
Edit your hostname. | |||
<syntaxhighlight> | |||
nano -w /etc/conf.d/hostname | nano -w /etc/conf.d/hostname | ||
</syntaxhighlight> | |||
Edit your network settings in /etc/conf.d/net. Mine is below (change your numbers! run ifconfig -a to get them): | |||
<syntaxhighlight> | |||
config_eth0="XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX brd XXX.XXX.XXX" | |||
routes_eth0="default via XXX.XXX.XXX.XXX" | |||
</syntaxhighlight> | |||
Change the root password | |||
<syntaxhighlight> | |||
passwd | passwd | ||
</syntaxhighlight> | |||
Modify /etc/rc,conf - set: | |||
<syntaxhighlight> | |||
rc_sys="xenU" | |||
</syntaxhighlight> | |||
If you only want a certain language, you can configure it in /etc/locale.gen: | |||
<syntaxhighlight> | |||
en_GB ISO-8859-1 | |||
en_GB.UTF-8 UTF-8 | |||
</syntaxhighlight> | |||
If you do change locales, you need to run: | |||
<syntaxhighlight> | |||
locale-gen | locale-gen | ||
</syntaxhighlight> | |||
Setup your env language in /etc/env.d/02locale | |||
<syntaxhighlight> | |||
LANG="en_GB.UTF-8" | |||
LC_COLLATE="C" | |||
</syntaxhighlight> | |||
And update the environment: | |||
<syntaxhighlight> | |||
env-update && source /etc/profile | env-update && source /etc/profile | ||
</syntaxhighlight> | |||
</li> | |||
</li> | |||
Optional choices | |||
I went with the gentoo choices of syslog-ng for syslog, vixie-cron for cron and installing mlocate. | |||
You decide. | |||
<syntaxhighlight> | |||
emerge syslog-ng | emerge syslog-ng | ||
rc-update add syslog-ng default | rc-update add syslog-ng default | ||
| Line 168: | Line 227: | ||
rc-update add vixie-cron default | rc-update add vixie-cron default | ||
emerge mlocate | emerge mlocate | ||
</syntaxhighlight> | |||
Guess we want ssh on startup..... | |||
<syntaxhighlight> | |||
rc-update add sshd default | rc-update add sshd default | ||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
Bootlader. | |||
Grub isn't needed. you only need a grub.conf | |||
<syntaxhighlight> | |||
mkdir -p /boot/grub | |||
</syntaxhighlight> | |||
Here's by grub.conf: | |||
<syntaxhighlight> | |||
default 0 | |||
timeout 0 | |||
title Gentoo Linux | |||
root (hd0,0) | |||
kernel /boot/vmlinuz root=/dev/xvda2 | |||
</syntaxhighlight> | |||
</li> | |||
<li> | |||
All done! | |||
Unmount and reboot, and cross fingers! Give it a minute to boot, and then you should be able to ssh in! | |||
<syntaxhighlight> | |||
exit | exit | ||
cd | cd | ||
| Line 201: | Line 260: | ||
umount -l /mnt/gentoo{/boot,/proc,} | umount -l /mnt/gentoo{/boot,/proc,} | ||
reboot | reboot | ||
</syntaxhighlight> | |||
</li> | |||
</ol> | |||
==Finally== | |||
Don't panic if it doesn't work. You can start the rescue environment again, | |||
mount the disks, and work out what went wrong. | |||
GOOD LUCK! | |||
Revision as of 10:27, 29 November 2013
Very lightly-edited copy-paste from an emailed guide that a customer supplied:
| This guide is currently a work in progress. You should not expect it to work or be correct. Please see the discussion page for some areas where it might be improved. |
OK, my guide to running gentoo on bitfolk.
It presumes you know a fair bit about linux in general. including using bash, fdisk, making a kernel, etc.
I've got a single core machine, 20GB disk, with 500MB RAM VMS. This will work fine on the smallest package of a 10GB disk too. I've done most of my install now, and sitting < 3GB.
I'm also going for a 64 bit OS, feel free to change the various bits to make a 32 bit OS.
A lot of this is a summary of http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml, so if you've done Gentoo installs before, you need to know 4 things:
- Your disks are /dev/xvda (main disk) and /dev/xvdb (swap disk)
- You need to enable the following kernel modules (in addition to your normal stuff):
CONFIG_XEN=y CONFIG_XEN_MAX_DOMAIN_MEMORY=500 CONFIG_XEN_SAVE_RESTORE=y CONFIG_XEN_BLKDEV_FRONTEND=y CONFIG_XEN_NETDEV_FRONTEND=y CONFIG_HVC_XEN=y CONFIG_HVC_XEN_FRONTEND=y CONFIG_XEN_FBDEV_FRONTEND=y CONFIG_XEN_BALLOON=y CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y CONFIG_XEN_SCRUB_PAGES=y CONFIG_XEN_DEV_EVTCHN=y CONFIG_XENFS=y CONFIG_XEN_COMPAT_XENFS=y CONFIG_XEN_SYS_HYPERVISOR=y CONFIG_XEN_XENBUS_FRONTEND=y CONFIG_XEN_GNTDEV=m CONFIG_XEN_GRANT_DEV_ALLOC=m CONFIG_XEN_PRIVCMD=y CONFIG_XEN_HAVE_PVMMU=y
It's possible you can trim this little lot down, but that's working
You can also trim away a lot of stuff from a standard kernel, like PCI, power management etc.
- In /etc/rc.conf, set rc_sys="xenU"
Pre install work
- Copy the PASSWORDS file somewhere, so that you have it.
- Change the root password (we'll be binning the install soon, but in the interests of security whilst we work)
- Change your domain DNS to point to the right IP.
- Log into the console, look in your PASSWORDS file
- Run the rescue environment.
- You'll need the password for the user "user", which is displayed on screen.
- You can either work off the terminal you are in, or you can now ssh in.
Layout
YOU ARE ABOUT THE DELETE EVERYTHING ON YOUR BITFOLK DISKS. STOP UNLESS YOU WANT TO LOSE EVERYTHING!
- Disks are located at /dev/xvda and /dev/xvdb (swap disk) (run fdisk -l to be sure)
- fdisk /dev/xvda, and partition accordingly.
As this is a VPS, we don't really need a /boot partition, so just create 1 partition for /
For completness, I toggled the boot flag on the /boot partition.
- Because I like things to be correct, I fdisk'd the swap disk to change the type to 82,
"Linux swap / Solaris"
- Filesystem types - I'm going with ext4. Change to suit.
mkfs.ext4 -L root /dev/xvdb1
-
mkswap -L swap /dev/xvdb1 LABEL=swap, UUID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Install
A summary of commands to run, with comments on decisions I made. Best advice is to use the gentoo handbook, so that you can make informed decisions yourself, and also have up to date information! Current on 2013-11-07. This is provided just to give some insight.
- Make dirs and mount
- Grab the source code and extract. Change the URL to match current version and arch
-
Make the appropriate edits to CFLAGS in /etc/portage/make.conf
Read the guide at http://wiki.gentoo.org/wiki/CFLAGS for
Make your own decision, but I've got:
CFLAGS="-march=corei7 -O2 -pipe -fomit-frame-pointer", but make your own decision.
-
Make the appropriate edits to MAKEOPTS in /etc/portage/make.conf.
Make your own decision based on what virtual hardware you have, but I've got 1 core, so have got:
"MAKEOPTS="-j2"
-
Mirror select isn't available in the rescue environment, so here are a couple of good example for the SYNC and GENTOO_MIRRRORS to paste into /etc/portage/make.conf:
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage" GENTOO_MIRRORS="http://gentoo.virginmedia.com http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo http://mirror.bytemark.co.uk/gentoo http://mirror.qubenet.net/gentoo"
-
Setup the virtual environment, and chroot in
cp -L /etc/resolv.conf /mnt/gentoo/etc/ mount -t proc none /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev chroot /mnt/gentoo /bin/bash source /etc/profile export PS1="(chroot) $PS1"
-
Update Gentoo
emerge-webrsync emerge --sync
Read the news. This stuff is useful, and should be read.
eselect news read
-
Basic setup
Look at the profile list. I'm sticking with a "server" install, the default.
eselect profile list
Make any changes to the USE variable. I chose to leave it as is for now.
nano -w /etc/portage/make.conf
I'm in the UK. Change accordingly.
cp /usr/share/zoneinfo/Europe/London /etc/localtime echo "Europe/London" > /etc/timezone
I like gentoo-sources. You can go with vanilla-sources if you wish, there are others too.
emerge gentoo-sources
Configure your kernel. See my stuff at the top for essential enables, then the rest is up to you. Probably should look at http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml if you're new to Gentoo.
cd /usr/src/linux make menuconfig make && make modules_install cp arch/x86_64/boot/bzImage /boot/vmlinuz
Edit your /etc/fstab. Mine is below:
/dev/xvda1 / ext4 noatime 1 1 /dev/xvdb1 none swap sw 0 0
Edit your hostname.
nano -w /etc/conf.d/hostname
Edit your network settings in /etc/conf.d/net. Mine is below (change your numbers! run ifconfig -a to get them):
config_eth0="XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX brd XXX.XXX.XXX" routes_eth0="default via XXX.XXX.XXX.XXX"
Change the root password
passwd
Modify /etc/rc,conf - set:
rc_sys="xenU"
If you only want a certain language, you can configure it in /etc/locale.gen:
en_GB ISO-8859-1 en_GB.UTF-8 UTF-8
If you do change locales, you need to run:
locale-gen
Setup your env language in /etc/env.d/02locale
LANG="en_GB.UTF-8" LC_COLLATE="C"
And update the environment:
env-update && source /etc/profile
Optional choices
I went with the gentoo choices of syslog-ng for syslog, vixie-cron for cron and installing mlocate.
You decide.
-
Bootlader.
Grub isn't needed. you only need a grub.conf
mkdir -p /boot/grub
Here's by grub.conf:
default 0 timeout 0 title Gentoo Linux root (hd0,0) kernel /boot/vmlinuz root=/dev/xvda2
-
All done!
Unmount and reboot, and cross fingers! Give it a minute to boot, and then you should be able to ssh in!
exit cd umount -l /mnt/gentoo/dev{/shm,/pts,} umount -l /mnt/gentoo{/boot,/proc,} reboot
mkdir /mnt/gentoo
mount /dev/xvda2 /mnt/gentoo/
mkdir /mnt/gentoo/boot
mount /dev/xvda1 /mnt/gentoo/bootwget http://www.mirrorservice.org/sites/distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20131031.tar.bz2
tar xvjpf stage3-*.tar.bz2emerge syslog-ng
rc-update add syslog-ng default
emerge vixie-cron
rc-update add vixie-cron default
emerge mlocateGuess we want ssh on startup.....
rc-update add sshd defaultFinally
Don't panic if it doesn't work. You can start the rescue environment again, mount the disks, and work out what went wrong. GOOD LUCK!