Last active
October 6, 2018 09:49
-
-
Save terryoy/4411528 to your computer and use it in GitHub Desktop.
My Gentoo Install Command List(under VirtualBox)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: http://www.gentoo.org/doc/zh_cn/gentoo-x86-quickinstall.xml | |
########################################################################## | |
##### part 1: boot with gentoo minimal ##### | |
# boot | |
gentoo | |
# config network | |
net-setup eth0 | |
ifconfig | |
# start sshd | |
/etc/init.d/sshd start | |
# set root passwd | |
passwd | |
# prepre disks | |
fdisk /dev/sda | |
# partitions: | |
# /dev/sda1 (boot) | |
# /dev/sda2 (swap) | |
# /dev/sda3 (linux) | |
# create file systems | |
mke2fs /dev/sda1 | |
mke2fs -j /dev/sda3 | |
mkswap /dev/sda2 && swapon /dev/sda2 | |
# mount file systems | |
mount /dev/sda3 /mnt/gentoo | |
mkdir /mnt/gentoo/boot | |
mount /dev/sda1 /mnt/gentoo/boot | |
##### part 2: install stage packages ##### | |
# download stage 3 package | |
cd /mnt/gentoo | |
links http://www.gentoo.org/main/en/mirrors.xml | |
# pick a mirror, and go into "releases/x86/current-stage3/", pick the archive file and press "D" to download | |
# extract the archive | |
time tar xjpf stage3* | |
# download portage package | |
cd /mnt/gentoo/usr | |
links http://www.gentoo.org/main/en/mirrors.xml | |
# pick a mirror, go into "snapshot/" and download "portage-latest.tar.bz2" | |
time tar xjpf portage* | |
##### part 3: switch system ##### | |
# chroot | |
cd / | |
mount -t proc proc /mnt/gentoo/proc | |
mount -o bind /dev /mnt/gentoo/dev | |
cp -L /etc/resolv.conf /mnt/gentoo/etc/ | |
chroot /mnt/gentoo /bin/bash | |
env-update && source /etc/profile | |
# set time-zone | |
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
date | |
# set host name | |
cd /etc | |
echo "127.0.0.1 mybox.at.myplace mybox localhost" > hosts | |
sed -i -e 's/HOSTNAME.*/HOSTNAME="mybox"/' conf.d/hostname | |
hostname mybox | |
hostname -f | |
##### part 4: kernel configuration ##### | |
# install kernel sources, compile and install kernel | |
time emerge gentoo-sources | |
cd /usr/src/linux | |
make menuconfig | |
time make -j2 | |
make modules_install | |
cp arch/i386/boot/bzImage /boot/kernel | |
# configuration for booting, network, etc. | |
cd /etc | |
nano -w fstab | |
# /dev/sda1 /boot ext2 noauto,noatime 1 2 | |
# /dev/sda3 / ext3 noatime 0 1 | |
# /dev/sda2 none swap sw 0 0 | |
cd conf.d | |
# (optional) add network configuration | |
echo 'config_eth0=( "192.168.1.10/24" )' >> net | |
echo 'routes_eth0=( "default via 192.168.1.1" )' >> net | |
rc-update add net.eth0 default | |
# if you compiled network driver as a module, you need to add it to "/etc/modules.autoload.d/kernel-2.6") | |
echo r8169 >> /etc/modules.autoload.d/kernel-2.6 | |
# if you want sshd at startup | |
rc-update add sshd default | |
# set root password (again?!) | |
passwd | |
# set timezone | |
nano -w /etc/conf.d/clock | |
# (optional) check some configuration | |
nano -w /etc/rc.conf | |
nano -w /etc/conf.d/rc | |
nano -w /etc/conf.d/keymaps | |
# install syslog and cron | |
time emerge syslog-ng vixie-cron | |
rc-update add syslog-ng default | |
rc-update add vixie-cron default | |
# (optional) other tools | |
emerge xfsprogs (XFS file system) | |
emerge jfsutils (JFS file system) | |
emerge reiserfsprogs (Reizer file system) | |
emerge dhcpcd (DHCP client) | |
emerge ppp (ADSL pppoe client) | |
# install boot loader | |
time emerge grub | |
nano -w /boot/grub/grub.conf | |
# * grub.conf example: | |
# default 0 | |
# timeout 10 | |
# | |
# title Gentoo | |
# root (hd0,0) | |
# kernel /boot/kernel root=/dev/sda3 | |
grub | |
# * setup grub in the grub command line: | |
# grub>root (hd0,0) | |
# grub>setup (hd0) | |
# grub>quit | |
exit | |
umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo | |
reboot | |
# remove CD-ROM and install finish! | |
##### part 5: post installation settings ##### | |
# login with root | |
# (optional) if you use ssh to do the setup above, remove previous ssh key manually and reconnect with ssh | |
nano -w ~/.ssh/known_hosts | |
ssh [email protected] | |
# add a normal user | |
useradd -g users -G lp,wheel,audio,cdrom,portage,cron -m <your_username> | |
passwd <your_username> | |
# config mirror | |
emerge mirrorselect | |
mirrorselect -i -o >> /etc/make.conf | |
mirrorselect -i -r -o >> /etc/make.conf | |
# "-jn" where n is the number of CPUs + 1, it is for running multiple compiler processes on multiple processors | |
echo 'MAKEOPTS="-j2"' >> /etc/make.conf | |
# turn on/off some USE flags | |
emerge -vpe world | |
# example(turn off "ipv6", "fortran" and turn on "unicode"): | |
# echo 'USE="nptl nptlonly -ipv6 -fortran unicode"' >> /etc/make.conf | |
# configure languages | |
cd /etc | |
nano -w locale.gen | |
locale-gen | |
# last but not least, configure your make.conf file for future ebuilds | |
nano -w make.conf | |
# update softwares | |
# install ccache | |
emerge ccache | |
# list update softwares | |
emerge -vpuD --newuse world | |
# update | |
time emerge -vuD --newuse world | |
# reinstall libtool to prevent some potential problems | |
emerge --oneshot libtool | |
# update configuration | |
dispatch-conf | |
# (optional) if perl has been updated, also run perl-cleaner | |
time perl-cleaner all | |
# (optional) if some python packages have been updated, also run python-updater | |
python-updater | |
# What's next? install GNOME or KDE, or sth else? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment