User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gentoo:installation [2024/02/06 14:52] willygentoo:installation [2025/03/13 14:49] (current) – [The fast&quick Gentoo Installation checklist] willy
Line 1: Line 1:
-====== Quick & Dirty Gentoo Installation ======+====== A) Gentoo Linux Installation ======
  
-Why [[https://www.gwntoo.org|Gentoo Linux]]? Because its lightweight, gives you full control on your server and can be much more secure than others bloated Linux distributions.+Why [[https://www.gwntoo.org|Gentoo Linux]]? In short, because its lightweight, gives you full control on your server and can be much more secure than others bloated Linux distributions. More in detail.
  
-When installing Gentoo Linux you have the total freedom to choose any single piece of the systemincluding whether to install or not a Cron Daemon and even a logger daemonNo other distro gives you so much freedom. Moreover, while you can use SystemD and NetworkManager with Gentoo, you are **not** forced to use them, and in fact specially for small servers, they might both be uneeded.+These instructions are aimed at supporting you during the installation of your home server, the one on which most, or all, your self-hosted home services will runThis same page can be referred to when installing your //external// server(s)provided they don't already come pre-installed with some other flavour of Linux.
  
-For referencealways follow the [[https://wiki.gentoo.org/wiki/Handbook:AMD64|Gentoo Handbook]] which is the Gentoo Bible.+This is not meant to be an exustive guide, as there are plenty of good resources on the topicspecially the amazing [[https://wiki.gentoo.org/wiki/Handbook:AMD64|Gentoo Handbook]] which is the Gentoo Bible for installation. 
 + 
 +When installing Gentoo Linux you have the total freedom to choose any single piece of the system, including whether to install or not a Cron Daemon and even a logger daemon. No other distro gives you so much freedom. Moreover, while you can use SystemD and NetworkManager with Gentoo, you are **not** forced to use them, and in fact specially for small servers, they might both be unneeded.
  
 Installing Gentoo Linux is less difficult than you might think. The great [[https://wiki.gentoo.org/wiki/Handbook:AMD64|Gentoo Handbook]] is very well written and also fairly easy to follow if you don't rush it. I assume you are capable of following it up until you can boot a text-only system. Installing Gentoo Linux is less difficult than you might think. The great [[https://wiki.gentoo.org/wiki/Handbook:AMD64|Gentoo Handbook]] is very well written and also fairly easy to follow if you don't rush it. I assume you are capable of following it up until you can boot a text-only system.
 +
  
 ===== The fast&quick Gentoo Installation checklist ===== ===== The fast&quick Gentoo Installation checklist =====
Line 15: Line 18:
 **Prerequisite**: you already know //where// (on which disk/partition) you are going to install Gentoo and which IP address you want to use for your home (internal) network. **Prerequisite**: you already know //where// (on which disk/partition) you are going to install Gentoo and which IP address you want to use for your home (internal) network.
  
-==== Get Ready for First Boot ====+I will assume your home server has one drive dedicated to the Gentoo installation. Data, media, and other files will be stored on a separate RAID array of some kind. 
 + 
 +Please do not configure that RAID array now, but read the [[gentoo:storage|Storage Setup]] page. 
 + 
 +=== Get Ready for First Boot === 
 + 
 +Burn Gentoo [[https://www.gentoo.org/downloads/|installation ISO]] to a CD or a  [[https://wiki.gentoo.org/wiki/LiveUSB|USB key]], and boot it all the way to the Gentoo command-line prompt.
  
-Burn Gentoo [[https://www.gentoo.org/downloads/|installation ISO]] to a CD or a  [[https://wiki.gentoo.org/wiki/LiveUSB|USB key]].+Setup internet access from your booted installation ISO.
  
-Format your **root** partition on your PC harddrive +Format your **root** partition on your PC harddrive as EXT4: i recomend EXT4 for the root partition (that's not where you will be storing any data or services!) because it's always supported out of the box and can avoid issues in the future. Let's assume it's /dev/sda2.
-Once inside, you will need to be root for all the subsequent steps.+
  
-Create a folder /mnt/gentoo:+Mount your root folder:
 <code bash> <code bash>
- > mkdir /mnt/gentoo+mount /dev/sda2 /mnt/gentoo
 </code> </code>
  
-Download Gentoo Stage 3 tarball from same link as installation ISOthen decompress it: +Download the [[https://www.gentoo.org/downloads/|Gentoo Stage 3]] tarball for your architecture (arm64amd64, etc). From the Gentoo boot ISO, you can use **links**, which is a neat text-only web browser
-  * From Gentoo boot ISO, you can use <b>links</b> from text mode+ 
-  * You will need to setup networkif not available. See the handbook above.+Decompress the Stage 3be careful to specify the following options (the 'p' one is critical!):
 <code bash> <code bash>
- > cd /mnt/gentoo +cd /mnt/gentoo 
- +tar xvfp stage3.blah-blah.tar.zy 
- > tar xvfp stage3.blah-blah.tar.zy <-- note that the "p" is VERY important!+
 </code> </code>
  
-Prepare the chroot environment:+Prepare and enter the chroot environment:
 <code bash> <code bash>
- > cp /etc/resolv.conf /mnt/gentoo/etc +cp /etc/resolv.conf /mnt/gentoo/etc 
- modprobe efivarfs +modprobe efivarfs 
- for i in dev dev/pts sys run proc sys/firmware/efi/efivars; do mount /$i /mnt/gentoo/$i -o bind; done +for i in dev dev/pts sys run proc sys/firmware/efi/efivars; do mount /$i /mnt/gentoo/$i -o bind; done 
- chroot /mnt/gentoo /bin/bash +chroot /mnt/gentoo /bin/bash 
- > mkdir /boot  +source /etc/profile 
- mount /dev/sda1 /boot +</code> 
-</code> + 
 +You are now **inside** your brand new Gentoo Linux installation... But there is still a lot of work to be able to boot it. 
 + 
 +You also need, now, to mount the boot/efi partition in side the chroot (let's assume it's **/dev/sda1**), so something like: 
 +<code bash> 
 +mkdir /boot 
 +mount /dev/sda1 /boot 
 +</code> 
 + 
 +You need now to setup //portage//, Gentoo package manager.
  
 Accept licenses, put this into <b>/etc/portage/make.conf</b>: Accept licenses, put this into <b>/etc/portage/make.conf</b>:
Line 51: Line 67:
 </code> </code>
  
 +It's time to populate the portage tree:
 +<code bash>
 +emerge --sync
 +</code>
 +
 +Configure your timezone (choose the correct one):
 +<code bash>
 echo "Europe/Brussels" > /etc/timezone echo "Europe/Brussels" > /etc/timezone
 emerge --config sys-libs/timezone-data emerge --config sys-libs/timezone-data
-/etc/locale.gen+</code> 
 + 
 +Configure your locales by editing the file **/etc/locale.gen** and running: 
 +<code bash>
 locale-gen locale-gen
 +</code>
  
-emerge --sync +And select your preferred profile. I would choose a plain basic profile like **default/linux/amd64/17.1** or a **selinux/hardened** one if you feel adventurous: 
 +<code bash>
 eselect profile list eselect profile list
 +</code>
  
 +Install and properly setup your CPU flags:
 +<code bash>
 +emerge -vp cpuid2cpuflags
 +echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
 +</code>
 +
 +Now reinstall/recompile the basic system according to your selections:
 +<code bash>
 emerge -uv --deep --newuse @world emerge -uv --deep --newuse @world
 +</code>
  
-emerge -vp vim tmux cronie cpuid2cpuflags syslog-ng bash-completion chrony dosfstools  io-scheduler-udev-rules intel-microcode  +And it's time to install some basic stuff (pick your own! there are also many choices): 
- emerge -vp genkernel gentoo-sources pci-utils usbutils mdadm+<code bash> 
 + > emerge -vp genkernel gentoo-sources pciutils usbutils mdadm vim tmux cronie  syslog-ng bash-completion chrony dosfstools  io-scheduler-udev-rules intel-microcode  
 +</code> 
 +Research each one and pick yours.
  
 +Now it's time to build the kernel:
 +<code bash>
 eselect kernel set 1 eselect kernel set 1
- 
 genkernel --mountboot --install all genkernel --mountboot --install all
 +</code>
  
 +Then create a user and set root password: 
 +<code bash>
 passwd passwd
 useradd user useradd user
 passwd user passwd user
 +</code>
  
-edit /etC/conf/net+Setup network and ensure SSH starts by default on boot (i assume your ethernet device is called xxx, you can check in /sys/class/net): 
 +<code bash> 
 +vi /etc/conf/net
 rc-update add sshd default rc-update add sshd default
-ln -s /etC/init.d/net.lo /etc/init.d/net.xxx+ln -s /et/init.d/net.lo /etc/init.d/net.xxx
 rc-update add net.xxx default rc-update add net.xxx default
 +</code>
  
 +Last, setup boot loader (Grub2 here):
 +<code bash>
 +grub-install --target=x86_64-efi --efi-directory=/boot
 +</code>
  
 +and then reboot.
  
  
 +=== Additional settings after first boot ===
  
 +Now, you are of course free to install whatever you want, even a fully fledged **Plasma Workspace**, but i strongly advise against. This is a **server** and less stuff you install, the better.
  
- +A few more notes and suggestion that will be important in the future.
- +
  
 A few notes to follow: A few notes to follow:
Line 96: Line 148:
  
 ===== Specific installation finalization ===== ===== Specific installation finalization =====
 +
 +(not needed for the **external** server)
  
 You will need to create a special group called **media** which will be used to allow the different tools to access the respective data folders without compromising the security of your installation and media collection: You will need to create a special group called **media** which will be used to allow the different tools to access the respective data folders without compromising the security of your installation and media collection:
  
 <code bash> <code bash>
- > groupadd media+groupadd media
 </code> </code>
  
Line 107: Line 161:
 There are also a few specific tools we need to install for what comes ahead, let's do it: There are also a few specific tools we need to install for what comes ahead, let's do it:
 <code bash> <code bash>
- > emerge -v sys-fs/mdadm+emerge -v sys-fs/mdadm
 </code> </code>
  
Line 118: Line 172:
  
  
- 
- 
- 
- 
-====== Docker ====== 
- 
-Refer to: [[https://wiki.gentoo.org/wiki/Docker|Gentoo Docker]] 
- 
-emerge --ask --verbose app-containers/docker app-containers/docker-cli docker-compose 
- 
- 
-rc-update add docker default 
-rc-service docker start 
- 
-user $sudo sysctl net.ipv4.ip_forward=1 
- 
-A more permanent change can be made with: 
-FILE /etc/sysctl.d/local.confEnable ip forwarding persistently 
- 
-net.ipv4.ip_forward=1 
- 
-docker run --rm hello-world 
  

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information