I think you should distinguish between:
compile , v: use the compiler to process the source code and create executable code [1] .
and
install , v: connect, configure, or prepare something for use [2] .
Compilation creates binary executables from source code. The installation simply puts these binary executables in the right place to run later. Thus, installation and use do not require compilation if binary files are available. Think of “compiling” and “installing,” for example, “cook” and “serve,” respectively.
Now your questions:
- The kernel is written in C, however, how was the kernel compiled without a compiler?
A kernel cannot be compiled without a compiler, but it can be installed from a compiled binary.
Usually, when you install the operating system, you install the pre-compiled kernel (binary executable). It was composed by someone else. And only if you want to compile the kernel yourself, you will need a source and a compiler, as well as all other tools.
Even in the “source” distributions, such as gentoo, you run the compiled binary.
So, you can live your whole life without compiling the kernels, because you compiled them by someone else.
- If the C compiler is installed on my computer before the kernel is compiled, how can the compiler itself be compiled without a compiler installed?
The compiler cannot be started if there is no kernel (OS). Thus, you need to install the compiled kernel to run the compiler, but it does not need to compile the kernel itself.
Again, the most common practice is to install compiled compiler binaries and use them to compile anything else (including the compiler and the kernel).
Now the problem is with the chicken and the egg. The first binary is compiled by someone else ... See dmckee's excellent answer.