Difference between pages "UEFI Install Guide" and "Web-server-stack"

(Difference between pages)
(Configuring GRUB)
 
m (Benchmarking: MOAR)
 
Line 1: Line 1:
This tutorial will show you how to install Funtoo on a UEFI system. UEFI, also known as the [[Wikipedia:Unified Extensible Firmware Interface|Unified Extensible Firmware Interface]], is a new firmware interface that is used on some newer computers as a replacement for the traditional PC BIOS. It has an integrated boot loader, so setting up booting is different.
 
  
This tutorial is meant to be an "overlay" over the Regular Funtoo Installation. Follow the normal installation and only follow steps in this tutorial when dealing with partitioning and configuring the boot loader (GRUB). All steps are otherwise identical to the regular installation process.
+
== Pre-install considerations ==
 +
=== ssl ===
 +
Ssl [http://en.wikipedia.org/wiki/Wildcard_certificate wild card certificates] can use the same certificate to cover several subdomain names.  As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate.  https://funtoo.org would not be covered under the wildcard, so [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests using http://domain.tld as a http navigation splash page directory.  All that is required to setup a ca signed ssl certificate is an email on the server. https://www.startssl.com offers free ssl ca certificates, though there are several other certificate [http://en.wikipedia.org/wiki/Certificate_authority#Providers providers].  Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https://
  
== What Are We Doing? ==
+
=== sockets vs tcp stack ===
 +
Sockets have less overhead but can not be shared across jails, or to other machines.  Tcp stack has more overhead but is far more flexible.
  
This guide will show you how to set up your UEFI system to load the GRUB boot loader, which will then load your Funtoo Linux kernel and initramfs. This is the "UEFI + GRUB" method as described on the [[Boot Methods]] page.
+
=== Email Servers ===
 +
* {{Package|mail-mta/postfix}}  <-- suggested
 +
* {{Package|mail-mta/ssmtp}}
 +
* {{Package|mail-mta/exim}}
 +
* {{Package|mail-mta/sendmail}}
 +
* {{Package|mail-mta/nullmailer}}
  
== First Steps ==
+
=== FTP Servers ===
 +
It is common practice to use FTP servers to host files for downloading.
  
To install Funtoo Linux on a UEFI system, first you need to boot SysRescueCD in UEFI mode. To do this, enable UEFI in your BIOS, and if necessary disable legacy booting. After some fiddling, you should be able to boot SysRescueCD and get a black and white text menu instead of the traditional aqua/cyan-colored menu. The black and white menu indicates that you booted SysRescueCD in UEFI mode. Once you've accomplished this, you're ready to continue with your Funtoo Linux installation and partition your drive. See below for details.
+
* {{Package|net-ftp/vsftpd}} <-- suggested
 +
* {{Package|net-ftp/proftpd}}
 +
* {{Package|net-ftp/pure-ftpd}}
 +
* {{Package|net-ftp/qshare}}
  
'''If the <tt>/sys/firmware/efi</tt> directory exists, then you have successfully booted in EFI mode and will be able to configure your Funtoo system to boot in EFI mode. If the directory doesn't exist, fix this first. It is a requirement for setting up EFI booting.'''
+
== Webserver ==
 +
Web servers come in several varieties. The most common stack is known as LAMP which stands for linux apache mysql php.  [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.
  
== Partitioning ==
+
=== Databases ===
 +
* {{Package|dev-db/mysql}}
  
To set up your partitions for UEFI booting, you will create a ~500MB FAT32 partition on <tt>/dev/sda1</tt>, and set it to type <tt>EF00</tt> using <tt>gdisk</tt>.
+
mariadb is a drop in replacement for mysql
 +
* {{Package|dev-db/mariadb}} <-- suggested
  
<console>
+
percona is a drop in replacement for mysql
Command: ##i##n ↵
+
* {{Package|dev-db/percona-server}}
Partition Number: ##i##1 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+500M ↵
+
Hex Code: ##i##EF00
+
</console>
+
  
This partition will serve as your Funtoo <tt>/boot</tt> filesystem as well as the partition that the UEFI firmware can read to load GRUB. Then you will set up swap on <tt>/dev/sda2</tt> and your root filesystem on <tt>/dev/sda3</tt>. To create the FAT32 filesystem, type:
+
* {{Package|dev-db/postgresql-server}}
 +
* {{Package|dev-db/sqlite}}
  
<console>
+
=== Languages ===
# ##i##mkfs.vfat -F 32 /dev/sda1
+
* {{Package|dev-lang/php}} <-- suggested
</console>
+
* {{Package|dev-lang/perl}}
 +
* {{Package|dev-lang/python}}
  
Your <tt>/etc/fstab</tt> entry for this filesystem will also differ, and will look like this:
+
=== Web Servers ===
 +
* {{Package|www-servers/apache}}
 +
* {{Package|www-servers/cherokee}}
 +
* {{Package|www-servers/nginx}} <-- suggested
 +
* {{Package|www-servers/tengine}}
 +
* {{Package|www-servers/lighttpd}}
  
<pre>
 
/dev/sda1 /boot vfat noatime 1 2
 
</pre>
 
  
== Kernel ==
+
=== SSL Termination, Reverse Proxies, & load balancing ===
 +
Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server.  Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.
  
=== VFAT ===
+
* {{Package|www-servers/nginx}}
 +
* {{package|net-misc/stunnel}}
 +
* {{package|www-servers/pound}} <-- suggested for ssl termination & load balancing
 +
* {{Package|www-servers/varnish}} <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
 +
* {{Package|net-proxy/squid}}
  
Make sure you add VFAT support to your kernel if you are building it manually.
+
== Post install ==
 +
There are several considerations to take into account with a web server install, such as setting up an email server, setting up a firewall, firewalling web applications, and dynamically firewalling attackers.
  
=== EFI Framebuffer ===
+
=== Firewalls ===
 +
* {{Package|net-firewall/nftables}}
 +
* {{Package|net-firewall/iptables}} <-- suggested
 +
* {{Package|net-firewall/firewalld}}
 +
* {{Package|net-firewall/ufw}}
  
If you have the following option enabled in your kernel, then uvesafb and efifb will not be able to detect the framebuffer:
+
=== Dynamic Firewalling ===
 +
* {{Package|app-admin/sshguard}} <-- suggested
 +
* {{Package|net-analyzer/fail2ban}}
  
{{kernelop|title=Bus options (PCI etc.)|desc=
+
=== Webapp Firewalls ===
    [*] Mark VGA/VBE/EFI FB as generic system framebuffer (NEW)
+
}}
+
  
If you have that option enabled, ''you must also enable'':
+
Apache has an option for webapplication firewalling.  as far as [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) can tell this passes login errors & excessive site fuzzing to logs for fail2ban/sshguard to deal with.
 +
https://github.com/nbs-system/naxsi is a web app firewall for nginx.
  
{{kernelop|title=Device Drivers,Graphics support,Frame buffer Devices,Support for frame buffer devices|desc=
+
=== Benchmarking ===
    [*]  Simple framebuffer support
+
It's a good idea to benchmark your system, server, & websites.  There are several tools to assist you in doing this.
}}
+
  
This is the preferred method of using the EFI framebuffer, the efifb and uvesafb drivers will be used as a fallback if the above is not compatible.
+
* http://toolbar.netcraft.com/site_report?url=undefined#last_reboot
 
+
* http://gtmetrix.com/
== Boot Loader ==
+
* http://www.showslow.com/
 
+
* http://yslow.org/
=== Emerging GRUB ===
+
* http://getfirebug.com/
 
+
* {{Package|app-admin/apache-tools}}
You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this,
+
* {{Package|app-benchmarks/sysbench}}
add the following line to <tt>/etc/portage/make.conf</tt>:
+
* {{Package|app-benchmarks/phoronix-test-suite}}
 
+
* {{Package|app-benchmarks/iozone}}
<pre>
+
* {{Package|app-benchmarks/piozone}}
GRUB_PLATFORMS="efi-64"
+
* {{Package|app-benchmarks/siege}}
</pre>
+
* {{Package|app-benchmarks/ramspeed}}
 
+
* {{Package|app-benchmarks/jmeter}}
Then, <tt>emerge grub</tt>. You will notice <tt>efibootmgr</tt> getting pulled in as a dependency. This is expected and good.
+
 
+
=== Installing GRUB ===
+
 
+
Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to <tt>/boot</tt>. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command:
+
 
+
<console>
+
# ##i##grub-install --target=x86_64-efi --efi-directory=/boot /dev/sda
+
</console>
+
This command will simply install all the stuff to <tt>/boot/EFI</tt> and <tt>/boot/grub</tt> that your system needs to boot. In particular, the <tt>/boot/EFI/grub/grubx64.efi</tt> file will be created. This is the GRUB boot image that UEFI will load and start.
+
=== Configuring GRUB ===
+
 
+
OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will not use boot-update directly and will create a <tt>/boot/grub/grub.cfg</tt> file manually that looks like this:
+
 
+
{{file|name=/boot/grub/grub.cfg|desc= |body=
+
set timeout=3
+
set gfxmode=auto
+
insmod efi_gop
+
insmod efi_uga
+
 
+
menuentry "Funtoo Linux genkernel - kernel-debian-sources-x86_64-3.2.35-2" { 
+
    insmod part_gpt
+
    insmod fat 
+
    set root=(hostdisk//dev/sda,gpt1) 
+
    search --no-floppy --fs-uuid --set __REPLACE_UUID_OF_SDA1__
+
    linux /kernel-debian-sources-x86_64-3.2.35-2 real_root=/dev/sda3
+
    initrd /initramfs-debian-sources-x86_64-3.2.35-2 
+
    set gfxpayload=keep
+
}
+
set default=0
+
}}
+
 
+
Note the <tt>search</tt> line where it says '''<tt>__REPLACE_UUID_OF_SDA1__</tt>''' above. You will need to run '''<tt>blkid /dev/sda1</tt>''' and use the UUID value that is displayed. For example, on my system, I need to use '''<tt>C34B-19CF</tt>'''. You can also change the <tt>menuentry</tt> line text in quotes to say whatever you want, and the <tt>linux</tt> and <tt>initrd</tt> lines should reference your kernel versions in <tt>/boot</tt>. As above, use the path <tt>/</tt> instead of <tt>/boot</tt> as the path should be relative to the root of the VFAT filesystem.
+
 
+
== Known Issues ==
+
With pure UEFI boot mode, with legacy mode disabled, following error expected:
+
* video driver not supported, boot hangs, hard reboot required.
+
Choose UEFI first, next legacy driver. It depends on motherboard vendor and efi bios version.
+
In UEFI bios choose grub option, if your succeeded with above guide, additional menu should appear in Boot Menu, otherwise it boots into EFI shell:
+
* grub:NAME of you hard drive
+
 
+
=== Done! ===
+
 
+
Remember to follow all other steps in the regular Funtoo Install Guide. Assuming you did everything correctly, your system should now boot via UEFI! We will be adding UEFI support to boot-update soon to make this process easier.
+
 
+
[[Category:HOWTO]]
+

Revision as of 13:55, January 18, 2015

Pre-install considerations

ssl

Ssl wild card certificates can use the same certificate to cover several subdomain names. As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate. https://funtoo.org would not be covered under the wildcard, so Threesixes (talk) suggests using http://domain.tld as a http navigation splash page directory. All that is required to setup a ca signed ssl certificate is an email on the server. https://www.startssl.com offers free ssl ca certificates, though there are several other certificate providers. Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https://

sockets vs tcp stack

Sockets have less overhead but can not be shared across jails, or to other machines. Tcp stack has more overhead but is far more flexible.

Email Servers

  • Package:Postfix <-- suggested
  • No results
  • No results
  • No results
  • No results

FTP Servers

It is common practice to use FTP servers to host files for downloading.

Webserver

Web servers come in several varieties. The most common stack is known as LAMP which stands for linux apache mysql php. Threesixes (talk) suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.

Databases

mariadb is a drop in replacement for mysql

percona is a drop in replacement for mysql

  • No results

Languages

Web Servers


SSL Termination, Reverse Proxies, & load balancing

Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server. Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.

  • Package:Nginx
  • No results
  • No results <-- suggested for ssl termination & load balancing
  • Package:Varnish <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
  • Package:Squid

Post install

There are several considerations to take into account with a web server install, such as setting up an email server, setting up a firewall, firewalling web applications, and dynamically firewalling attackers.

Firewalls

Dynamic Firewalling

Webapp Firewalls

Apache has an option for webapplication firewalling. as far as Threesixes (talk) can tell this passes login errors & excessive site fuzzing to logs for fail2ban/sshguard to deal with. https://github.com/nbs-system/naxsi is a web app firewall for nginx.

Benchmarking

It's a good idea to benchmark your system, server, & websites. There are several tools to assist you in doing this.