Instalation of packages (programs) and recompiling the kernel. Particularities for the Ubuntu distribution. ---------------------------------------------------------------------------------------------------------- This file is an adition to the linux11-kernel-ro.txt. It doesn't yet translate that. The information cannot be found there. So, by now we need to use both of them. There are 3 manners of installing new programs on your VM. These are: 1) install an already compiled package (using apt) 2) download an .deb package and then install it (using apt) 3) download the sources and build them (unpack, then compile them) variant 1) Installing from an apt repository sudo apt install name_of_the_package If we dond know the name of the package, we can search it like this: sudo apt search partial_name_of_the_package or sudo apt search keyword | more or sudo apt search keyword | grep some_other_keyword variant 2) Download an .deb package and then install it (using apt) First we search the desired package on specialized sites for finding such things. I don't know a good one by now so we will use Goole to search for .deb packages to download. The downloading is done using wget. Then we will install them as described below: sudo apt install path_to_deb_file or sudo dpkg -i path_to_deb_file Refference: https://itsfoss.com/install-deb-files-ubuntu/ variant 3) Install a program from sources. Example: https://thesecmaster.com/step-by-step-procedure-to-install-apache-from-source-code-on-ubuntu/ ------------------------------------------------------------------------------- The kernel. ----------- There are 2 vasriants for installing the kernel: 1) install an already compiled version with apt 2) install from sources variant 1) To search for the kernel package that we can install we can use apt search kernel to do so. However that is not a good idea because there are a few hundreds of packages that either have "kernel" in their name or in their description. We will need a better keyword than "kernel". That is, according to some forum, linux-image. Of course that string, if searched will now restrict the number of results returned by the search. Still they are too many. So we will couple 2 commands to have them displayed one screen at a time. apt search linux-image | more - to search if there is a newer, already compiled kernel that we can installing After looking at a few results, I foud that the version 5.14 is almoast the newest. Since the newest might be a version still in tests (not final/stable), I used 5.14 instead. First narrow the search further apt search linux-image-5.14 Out of all the versions found, the following one seemed to be almoast the last one. I've installed it: sudo apt install linux-image-5.14.0-1033-oem After that, everithing is in place for the new version and we will have most likely in the boot menu a line with which we could use the new kernel (boot with it). The part with the options in the start menu will be assured by installing the apt package. Bringing the kernel sources: ----------------------------- https://www.kernel.org - (this is not a command!) a website on which we can find and download the newest kernel version After visiting this website found out the link to the latest kernel (5.17.4). Copy the link and use wget to download it. Probably when you read this the version number is already outdated. So on the website look for the big yellow button. Or for "stable" versions of the kernel. wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.17.4.tar.xz Unpack the archive. The -v option will produce a list of all the files extracted and thus we cannt think the command got stucked. There is also a option for tar that produces something like a progress bar. If you find it please remind me also which one is it. man tar can show you how to use the tar command. A good thing for us, if an unpacking program is installed, tar also knows how to call it to unpack the archive. In our case a program to unpack .xz archives is needed, but we have it installed, so we can use tar to directly unpack and then "untar" the file. tar -xvf linux-5.17.4.tar.xz A) Configure the kernel make menuconfig The command produces an error message telling us which packages we also need to install. From the first error message we find that either we will need pkg-config and then either libncurses-dev or ncurses-develop After trying them, it comes that the one we will need are pkg-config and libncurses-dev. We will install them using apt. Repeat step A) Maybe after that we will need to install other packages. We do so until the command from A) produces a text menu from which we will configure the kernel (we will decide which packages we need in it and which external and which we don't need them at all). I proceeded and found out (by reading the error message) that flex is the next package we need to install. I installed it and then repeated step A) Solving the problem with yum ---------------------------- The current VM with CentOS are with a version that reached EOL. This means they want to discontinue the support for it. So maybe the repositories are not working any more. In the past, I applied the solution from below and everithing was fine for a while. Now, it seems that this one will not work, but there's another trick that we can do: enable another repository, EPEL which still works and the packages might work from there. For epel-release repository on Centos follow the steps from here: https://webhostinggeeks.com/howto/epel-yum-repository-on-linux/ Basically you will download an .rpm package, then install it using yum itself. This will enable an extra repository that might have your missing packages. The old solution is described in the following 2 places: https://www.codesiri.com/2020/12/centos-6-yum-error-cannot-find-valid.html https://www.getpagespeed.com/server-setup/how-to-fix-yum-after-centos-6-went-eol If you read the solution from the second you can see that they also are fixing the repositories that are not working using some alternate adresses from epel. Easiest solution is to download an .rpm package that installed will enable epel repositories wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install epel-release-latest-7.noarch.rpm Verify it was installed yum repolist To see all the packages available on the epel repository yum --disablerepo="*" --enablerepo="epel" list available | less Install exactly the package htop from epel yum --enablerepo=epel install htop Reference: https://www.cyberciti.biz/faq/installing-rhel-epel-repo-on-centos-redhat-7-x/ ------------------------------------------------ Steps needed at compilation time -------------------------------- After configuring the kernel, the next step would be to build it. This is dome by the make command make This works because there is a Makefile in the folder in which we unpacked the kernel. That Makefile comtains many so called "targets", which are labels inside it where the build process will jump thus skipping parts of the Makefile. In our case since we used none of these targets, then all of the Makefile is used and all the targets are build. Most likely, after that there will be no need of extra steps, although in the other documentation says that maybe we need also to do "make modules" or "make bzImage" or other similar. So "make" is the last step after which everithing will be in place. Anyway the build process function in the following manner: - everithing is done from the recipe (the Makefile) - we can even interrupt the process, with CTRL-C, if we launch "make" again, it will progress from where it stopped - if after termination we run extra steps as "make modules" which were already executed, then nothing happens (see the previous step, this is a consequence of that step) - so by doing the extra steps required in the other documentation, we cannot do wrong, since if that was executed, then it will not be repeated. If it wasn't, then it will be executed now. The build process will stop several times because of some errors. These are also because we are missing some packages, but you need to deduce that from the error message. For example, on Ubuntu, for the 5.17.4 kernel, after investigating the error messages, we found out that the following packages allso need to be installed, the ones below: sudo apt install libssl-dev libelf-dev Later, during compilation there are some .pem keys missing. They can be disabled by the following commands scripts/config --disable SYSTEM_TRUSTED_KEYS and scripts/config --disable SYSTEM_REVOCATION_KEYS References for the pem packages problem can be found here: https://askubuntu.com/questions/1329538/compiling-the-kernel-5-11-11 Later another error message, that appeared after a few hours warned me that I should try to disable CONFIG_DEBUG_INFO_BTF and so I did by the command scripts/config --disable CONFIG_DEBUG_INFO_BTF apt - utility for installing, searching and uninstalling programs (packages)