Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Starting sshd
- /etc/init.d/sshd start
- # Getting eth0 up
- ifconfig eth0 up
- # Getting eth1 up
- ifconfig eth1 up
- # Enabling dhcp
- dhcpcd
- # Preparing partitions
- dd if=/dev/zero of=/dev/sda bs=1024 count=1024
- echo -e "n\np\n1\n\n+51M\np\nn\np\n2\n\n+1G\nt\n2\n82\nn\np\n3\n\n\np\nw\n" > /tmp/fdisk.partitions
- fdisk /dev/sda < /tmp/fdisk.partitions
- # Preparing boot
- mke2fs /dev/sda1
- # Preparing /
- mke2fs -j /dev/sda3
- # Preparing swap
- mkswap /dev/sda2
- # Turning on swap
- swapon /dev/sda2
- # Mounting
- mount /dev/sda3 /mnt/gentoo
- mkdir /mnt/gentoo/boot
- mount /dev/sda1 /mnt/gentoo/boot
- # OpenRC Fixes: http://xrl.us/openrc
- mkdir /mnt/gentoo/dev
- cd /mnt/gentoo/dev
- rm -rf null
- mknod --mode=600 console c 5 1
- mknod --mode=666 null c 1 3
- mknod --mode=666 zero c 1 5
- cd /mnt/gentoo
- # Setting date: Format is MMDDhhmmYYYY
- read dateinput
- date $dateinput
- # Downloading stage3
- wget http://gentoo.mirrors.tds.net/gentoo/releases/amd64/autobuilds/current-stage3/stage3-amd64-20110609.tar.bz2
- # Downloading Portage
- wget http://gentoo.mirrors.tds.net/gentoo/snapshots/portage-latest.tar.bz2
- # Extracting stage3
- tar xvjpf stage3-*.tar.bz2
- # Extracting Portage
- tar xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr
- # Edit make.conf
- # Safe cflags http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel
- # Used this at first...
- #sed -i 's/CFLAGS="-O2 -pipe"/CFLAGS="-march=core2 -mtune=generic -O2 -pipe"/g' /mnt/gentoo/etc/make.conf
- # But warning on page above suggested using -march=native
- sed -i 's/CFLAGS="-O2 -pipe"/CFLAGS="-march=native -mtune=generic -O2 -pipe"/g' /mnt/gentoo/etc/make.conf
- echo MAKEOPTS=\"-j2\" >> /mnt/gentoo/etc/make.conf
- # Installing Gentoo base System: Chrooting - Selecting Mirrors
- mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
- mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
- # Copy DNS Info
- cp -L /etc/resolv.conf /mnt/gentoo/etc/
- # Mounting the /proc and /dev Filesystems
- mount -t proc none /mnt/gentoo/proc
- mount --rbind /dev /mnt/gentoo/dev
- # Entering the new Environment
- chroot /mnt/gentoo /bin/bash
- # Entering the new Environment
- env-update
- source /etc/profile
- export PS1="(chroot) $PS1"
- # OpenRC Fixes: http://xrl.us/openrc
- rc-update add udev sysinit
- # Configuring Portage: Updating the Portage tree
- emerge --sync
- # Choosing the Right Profile
- eselect profile list
- # Which profile are we going to use?
- # Usually 7 default/linux/amd64/10.0/server
- read profileselection
- eselect profile set $profileselection
- # Configuring the USE variable
- #nano -w /etc/make.conf
- sed -i 's/USE="mmx sse sse2"/USE="mmx sse sse2 -gtk -gnome -qt4 -kde -dvd -alsa -cdr"/g' /etc/make.conf
- ## Optional glibc Locales
- #nano -w /etc/locale.gen
- #set -i 's/#en_US/en_US/g' /etc/locale.gen
- # no sure why that replace doesn't work...?
- # Configuring the Kernel: Timezone
- cp /usr/share/zoneinfo/America/New_York /etc/localtime
- # Installing the Sources: Choosing a Kernel
- emerge gentoo-sources
- # Alternative: Using genkernel
- emerge genkernel
- zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config
- genkernel --menuconfig all
- # Enabled devtmpgfs: Drivers > General > devtmpfs
- # This always fails the first time - running it again works...?
- # Kernel Modules: Configuring the Modules
- #find /lib/modules/2.6.*gentoo-*/ -type f -iname '*.o' -or -iname '*.ko' | less
- # Configuring fstab
- echo -e "/dev/sda1 /boot ext2 defaults,noatime 1 2\n"\
- "/dev/sda2 none swap sw 0 0\n"\
- "/dev/sda3 / ext3 noatime 0 1\n\n"\
- "#/dev/cdrom /mnt/cdrom auto noauto,user 0 0\n\n"\
- "proc /proc proc defaults 0 0\n"\
- "shm /dev/shm tmpfs nodev,nosuid,noexec 0 0\n" > /etc/fstab
- # Networking Information: Host name, Domainname, etc
- echo -e "# Set to the hostname of this machine\nHOSTNAME=\"myhostname\"" > /etc/conf.d/hostname
- echo -e "dns_domain_lo=\"mydoma.in\"\n"\
- "config_eth0=( \"dhcp\" )\n"\
- "config_eth1=( \"dhcp\" )" >> /etc/conf.d/net
- # Automatically Start Networking at Boot
- cd /etc/init.d
- ln -s net.lo net.eth0
- ln -s net.lo net.eth1
- rc-update add net.eth0 default
- rc-update add net.eth1 default
- # Writing Down Network Information
- # real tab = ctrl-v + ctrl-i
- sed -i 's/127.0.0.1 localhost/127.0.0.1 myhostname.mydoma.in myhostname localhost/g' /etc/hosts
- sed -i 's/::1 localhost/::1 myhostname.mydoma.in myhostname localhost/g' /etc/hosts
- # System Information: root Password
- passwd
- # System Information: System Information
- # This file doesn't exist, but it should...right?
- #nano -w /etc/conf.d/clock
- # Installing Necessary System Tools
- for apps in syslog-ng vixie-cron mlocate dhcpcd wgetpaste gpm
- do
- echo Installing $apps
- emerge -v $apps
- case $apps in
- syslog-ng|vixie-cron)
- echo Adding $apps to rc-update default
- rc-update add $apps default
- ;;
- esac
- done
- # Configuring the Bootloader: GRUB
- emerge -v grub
- echo -e "default 0\n"\
- "timeout 30\n"\
- "splashimage=(hd0,0)/boot/grub/splash.xpm.gz\n\n"\
- "title Gentoo Linux 2.6.38-gentoo-r6 for x86_64\n"\
- "root (hd0,0)\n"\
- "kernel /boot/kernel-genkernel-x86_64-2.6.38-gentoo-r6 real_root=/dev/sda3\n"\
- "#kernel /boot/kernel-genkernel-x86_64-2.6.38-gentoo-r6 real_root=/dev/sda3 video=uvesafb:mtrr:3,ywrap,1024x768-32@85\n"\
- "initrd /boot/initramfs-genkernel-x86_64-2.6.38-gentoo-r6\n" > /boot/grub/grub.conf
- # Setting up GRUB using grub-install
- grep -v rootfs /proc/mounts > /etc/mtab
- grub-install --no-floppy /dev/sda
- # Exiting Chrooted environment
- exit
- # Rebooting the System
- cd
- umount -l /mnt/gentoo/dev{/shm,/pts,}
- # I always get an error that shm isn't mounted - that normal?
- umount -l /mnt/gentoo{/boot,/proc,}
- reboot
Advertisement
Add Comment
Please, Sign In to add comment