Skip to content

Instantly share code, notes, and snippets.

@pakdev
Last active August 12, 2018 04:24
Show Gist options
  • Save pakdev/a8c86a3f0fd3b777ae20ee08ea36a913 to your computer and use it in GitHub Desktop.
Save pakdev/a8c86a3f0fd3b777ae20ee08ea36a913 to your computer and use it in GitHub Desktop.

Revisions

  1. pakdev revised this gist Aug 12, 2018. 1 changed file with 90 additions and 1 deletion.
    91 changes: 90 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -169,4 +169,93 @@ Make its contents be:
    `/dev/sdd1 /boot vfat defaults 0 2`

    5. Install the genkernel
    `# genkernel all`
    `# genkernel all`

    6. [Optional] Install 3rd party firmware
    `# emerge --ask sys-kernel/linux-firmware`

    7. Finish the fstab
    `# nano -w /etc/fstab`

    Make its contents now:
    ```
    /dev/sdd1 /boot vfat defaults 0 2
    /dev/sdd2 none swap sw 0 0
    /dev/sdd3 / ext4 noatime,discard 0 1
    ```

    # Configure the system
    1. Set hostname
    `# nano -w /etc/conf.d/hostname`

    2. Specify dhcp
    `# nano -w /etc/conf.d/net`

    3. Set networking to automatically start at boot
    ```
    # cd /etc/init.d
    # ln -s net.lo net.enp4s0
    # rc-update add net.enp4s0 default
    ```

    4. Update hosts file
    `# nano -w /etc/hosts`

    5. Set the root password
    `# passwd`

    6. Make OpenRC log
    `# nano -w /etc/rc.conf`

    Change `rc_logger="NO"` to `rc_logger="YES"`

    ## Install tools
    1. System logger
    ```
    # emerge -av app-admin/metalog
    # rc-update add metalog default
    ```

    2. Cron daemon
    ```
    # emerge -av sys-process/fcron
    # rc-update add fcron default
    # crontab /etc/crontab
    ```

    3. File indexing
    `# emerge -av sys-apps/mlocate`

    4. Enable remote access
    `# rc-update add sshd default`

    5. Filesystem tools
    ```
    # emerge -av sys-fs/e2fsprogs
    # emerge -av sys-fs/dosfstools
    ```

    6. DHCP client
    `# emerge -av net-misc/dhcpcd`

    ## Install Bootloader
    1. Install grub
    `# emerge -av sys-boot/grub:2`

    2. Install EFI
    ```
    # grub-install --target=x86_64-efi --efi-directory=/boot
    # grub-install --target=x86_64-efi --efi-directory=/boot --removable
    ```

    3. Create configuration
    `# grub-mkconfig -o /boot/grub/grub.cfg`

    Reboot!
    ```
    # exit
    # cd
    # umount -l /mnt/gentoo/dev{/shm,/pts,}
    # umount -R /mnt/gentoo
    # reboot
    ```
  2. pakdev revised this gist Aug 11, 2018. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -162,10 +162,11 @@ en_US.UTF-8 UTF-8
    3. Get genkernel
    `# emerge -av sys-kernel/genkernel`

    4. Modify fstab
    4. Modify fstab so that the boot partition is mounted
    `# nano -w /etc/fstab`

    Make its contents be:
    ```
    `/dev/sdd1 /boot vfat defaults 0 2`

    ```
    5. Install the genkernel
    `# genkernel all`
  3. pakdev revised this gist Aug 11, 2018. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -150,4 +150,22 @@ en_US.UTF-8 UTF-8
    3. Reload the environment
    ```
    # env-update && source /etc/profile && export PS1="(chroot) $PS1"
    ```

    # Install the kernel
    1. Grab the sources
    `# emerge -av sys-kernel/gentoo-sources`

    2. [Optional] Install hardware detection tool
    `# emerge -av sys-apps/pciutils`

    3. Get genkernel
    `# emerge -av sys-kernel/genkernel`

    4. Modify fstab
    `# nano -w /etc/fstab`

    Make its contents be:
    ```
    ```
  4. pakdev revised this gist Aug 11, 2018. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -129,4 +129,25 @@ or, if mirrorselect isn't available, add this to the bottom of /etc/portage/make

    # Configure the base system
    1. Set the timezone
    `# `
    ```
    # echo "America/Chicago" > /etc/timezone"
    # emerge --config sys-libs/timezone-data
    ```

    2. Configure locales
    `# nano -w /etc/locale.gen`

    Enable:
    en_US ISO-8859-1
    en_US.UTF-8 UTF-8

    ```
    # locale-gen
    # eselect locale list
    # eselect locale set 5
    ```

    3. Reload the environment
    ```
    # env-update && source /etc/profile && export PS1="(chroot) $PS1"
    ```
  5. pakdev revised this gist Aug 11, 2018. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -13,17 +13,17 @@
    unit mib
    mkpart primary 1 129
    name 1 boot
    mkpart 129 4225
    mkpart primary 129 4225
    name 2 swap
    mkpart 4225 -1
    mkpart primary 4225 -1
    name 3 rootfs
    set 1 boot on
    print
    ```

    5. Create filesystems
    ```
    # mkfs.ext2 /dev/sda1
    # mkfs.fat -F 32 /dev/sda1
    # mkfs.ext4 /dev/sda3
    # mkswap /dev/sda2
    # swapon /dev/sda2
    @@ -33,22 +33,23 @@ print
    ```
    # mkdir -p /mnt/gentoo
    # mount /dev/sda3 /mnt/gentoo
    # cd /mnt/gentoo
    ```

    # Installing Stage 3
    1. Check that date is correct. See [here](https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage) if it's wrong.
    `# date`

    2. Download tarball
    a. Find download link from: https://www.gentoo.org/downloads/#other-arches
    a. Find download link from: https://www.gentoo.org/downloads
    b. `# wget <url>`

    3. Validate tarball
    ```
    # wget <url>.DIGESTS
    # openssl dgst -r -sha512 stage3-.tar.xz
    ```
    Compare the numbers above ^
    Ensure a pair of the numbers above match

    4. Unpack
    `# tar xpf stage3-.tar.xz --xattrs-include='*.*' --numeric-owner`
    @@ -72,6 +73,8 @@ USE="X bluetooth dbus pulseaudio savedconfig xinerama zsh-completion"
    PYTHON_TARGETS="python2_7 python3_6"
    PYTHON_SINGLE_TARGET="python3_6"
    GRUB_PLATFORMS="efi-64"
    ```

    # Installing the Gentoo base system
  6. pakdev revised this gist Aug 10, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ print
    6. Mount root partition
    ```
    # mkdir -p /mnt/gentoo
    # mount /dev/sda2 /mnt/gentoo
    # mount /dev/sda3 /mnt/gentoo
    ```

    # Installing Stage 3
  7. pakdev created this gist Aug 10, 2018.
    129 changes: 129 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,129 @@
    # Disk Preparation
    1. Determine disk name
    `# lsblk`

    2. Launch parted
    `# parted -a optimal /dev/sda`

    3. Erase everything
    `mklabel gpt`

    4. Make partitions
    ```
    unit mib
    mkpart primary 1 129
    name 1 boot
    mkpart 129 4225
    name 2 swap
    mkpart 4225 -1
    name 3 rootfs
    set 1 boot on
    print
    ```

    5. Create filesystems
    ```
    # mkfs.ext2 /dev/sda1
    # mkfs.ext4 /dev/sda3
    # mkswap /dev/sda2
    # swapon /dev/sda2
    ```

    6. Mount root partition
    ```
    # mkdir -p /mnt/gentoo
    # mount /dev/sda2 /mnt/gentoo
    ```

    # Installing Stage 3
    1. Check that date is correct. See [here](https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage) if it's wrong.
    `# date`

    2. Download tarball
    a. Find download link from: https://www.gentoo.org/downloads/#other-arches
    b. `# wget <url>`

    3. Validate tarball
    ```
    # wget <url>.DIGESTS
    # openssl dgst -r -sha512 stage3-.tar.xz
    ```
    Compare the numbers above ^

    4. Unpack
    `# tar xpf stage3-.tar.xz --xattrs-include='*.*' --numeric-owner`

    5. Configure options
    `# nano -w /mnt/gentoo/etc/portage/make.conf`

    For XPS 8500, add the following:
    ```
    CHOST="x86_64-pc-linux-gnu"
    CFLAGS="-march=native"
    CFLAGS="${CFLAGS} -O2 -pipe"
    CXXFLAGS="${CFLAGS}"
    MAKEOPTS="-j8"
    INPUT_DEVICES="evdev"
    VIDEO_CARDS="nvidia"
    USE="X bluetooth dbus pulseaudio savedconfig xinerama zsh-completion"
    PYTHON_TARGETS="python2_7 python3_6"
    PYTHON_SINGLE_TARGET="python3_6"
    ```

    # Installing the Gentoo base system
    1. Add mirrors
    `# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf`

    or, if mirrorselect isn't available, add this to the bottom of /etc/portage/make.conf:
    `GENTOO_MIRRORS="http://lug.mtu.edu/gentoo/ http://mirrors.evowise.com/gentoo/"`

    2. Repo config
    ```
    # mkdir -p /mnt/gentoo/etc/portage/repos.conf
    # cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
    ```

    3. Copy DNS info
    `# cp --dereference /etc/resolv.conf /mnt/gentoo/etc/`

    4 Mount filesystems
    ```
    # mount --types proc /proc /mnt/gentoo/proc/
    # mount --rbind /sys /mnt/gentoo/sys/
    # mount --rbind /dev /mnt/gentoo/dev/
    # test -L /dev/shm/ && rm /dev/shm/ && mkdir /dev/shm/
    # mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm
    # chmod 1777 /dev/shm/
    ```

    5. Enter the new environment
    ```
    # chroot /mnt/gentoo /bin/bash
    # source /etc/profile
    # export PS1="(chroot) ${PS1}"
    ```

    6. Mount boot
    `# mount /dev/sda1 /boot/`

    7. Update the ebuild repo
    `# emerge --sync`

    8. Select the right profile
    [16] default/linux/amd64/17.0/desktop (stable)
    ```
    # eselect profile list
    # eselect profile set 16
    ```

    9. Update the @world set
    `# emerge -auvDN @world`

    # Configure the base system
    1. Set the timezone
    `# `