Practice Exams:

LPI 010-160 – Processes and Process Data

  1. Package Management Principles.

In this section of the course, we’re going to describe the ways that you can manage the tasks of installing, uninstalling and upgrading software packages as we move further along. We’re also going to cover managing programs after they’re already running. And this is called processes. Anytime you have a running program, that is called a process. Now, finally, we’re going to discuss log files which are going to record the details of what running programs are actually doing, especially those processes that are automatically being run in the background. Now, package management is an area of Linux that varies between distributions, but there are certain principles that are in common across all the distributions. We’re going to discuss these principles and further look into understanding the package management systems that we’re going to be using.

Now, Linux packages have the following characteristics. Each package is a single file. Linux packages, unlike Windows installers, are not programs themselves. Packages are going to rely on other programs to do the work of actually installing the software. Think about a package almost like a compressed folder that contains all the other stuff that you need. That’s really what a package does here. Now, each package is going to contain dependency information. This is going to indicate to the packaging software exactly what other packages and individual files have to be installed for that package to work properly. Also, we have packages that contain version information so the packaging software can tell which of the two packages you have may be the most recent, because you want to install the most recent software, not one that’s three or four versions old.

Also, packages are going to contain architecture information to identify the CPU or processor type for which they’re going to be intended. After all, Linux and its associated software is compiled for the specific processor version you’re using. So if you’re using intel or AMD, or if you’re using something like a risk processor, that is going to be different. And so you have to have the right package for the right architecture. Also, we have binary packages and these binary packages are going to contain executable programs that are CPU specific and built from the source package for that architecture. Now, it is possible to build a new binary package if you have the source code, but this is a little bit difficult to do, especially for beginners.

And so you’re not going to do this unless you’re in some kind of an unusual circumstance or you get into higher levels of being a Linux administrator. Now, the package software is going to maintain a database of information about every package you’ve installed. This information includes the names and the version numbers of all of the installed software packages you have, as well as the locations of all the files installed from each package. Think about this like the Add Remove Programs menu within your Windows system. This information is going to enable the package software to uninstall software quickly. If you need to establish whether a new package’s dependencies have been met and determine if the package of the user is using has already been installed before and if it was, whether this new version is newer and needs to update the old version, or if it’s a brand new program. Now, we’re going to talk all about this as we go through and cover software packages in this section.

  1. Package Management Systems

Let’s continue our discussion of packages by looking at some package management systems. Now we’ve previously talked about two package systems rpm and debian. Now these systems are going to differ in various technical details in the commands used to manage the packages and the format of the package files themselves. A debian package cannot be installed on an Rumbaed system and if you’re using an Rpm based system, you can install a debian package. Instead. Installing a package is intended for one district to another is a little bit risky and it can cause problems. So you really should avoid doing it. Always find the native package for the system you’re using.

This is because a nonnative package may have dependencies that are going to conflict with the needs of that native package on your system. Originally, package systems worked locally. To install a package, a user would first download a package file from a website from that creator of the package and then they would take that from that Internet source and they’d be able to install it. Only then could a local command be used to actually install that package. Now this is the way it was done for many, many years and it’s pretty tedious, especially if you have a package that has lots of different dependencies. Because if I needed to have ten different dependencies, I need to download ten different files and install them before I can install the package I was trying to install.

Now, this means you could attempt the installation, but if you tried to install it without getting the dependencies first, it would find that there were unmet dependencies. And then you’d have to go hunt those down, download a lot more packages, find the one that you need, install it, and then try again. And hopefully you get all the dependencies done. And then you’d be able to install the software. So by the time you had all these dependent upon packages installed and tracked down, you might have had 510, 15 or more. Now, modern distros are going to make this a lot easier because they provide network enabled tools to help automate this process for us. These tools rely on what’s known as a software repository and this is an area where tools can be downloaded automatically from as packages and then installed in practice. Managing software in Linux requires either using a text mode or a graphical user tool to interface with a certain software repository for that distro. Now, a typical software installation task is going to look something like this.

First, you’re going to have a command issued to install the program. Second, the software is going to locate all the dependencies for your program you’re trying to install and notify the user that this additional software needs to be installed. It’ll say, Would you like to install it? Yes or no. If you click yes, that means we’re at. Third, the user is going to issue that final approval and the software is going to decide to download all the pieces it needs and get it ready. Fourth, the software is going to download all those necessary dependency packages. And fifth, the software that you wanted to install in the first place is finally installed. Now, I know that sounds like a lot of work, but in reality it really is just a few clicks of your mouse, as you’ll see in our demos.

Now, upgrading software works in a similar way, although upgrades are less likely to require downloading additional dependency packages because you already should have those installed from the first version you installed. Now, many distributions are automatically going to check with the repositories from time to time, and they’ll check if a new update is there. If there is, they’ll notify you as the system user that an update is available. By doing this, the system is able to be kept up to date, and you can do this with just clicking a few buttons to update the packages when you’re prompted to do so. Usually this will be feature updates or security updates. Now, package management necessarily involves root access to your system, so you need to have admin rights. We’ll talk more about root access in a different video. Now, if automatic prompts to update the system come up, the user can keep the system up to date pretty easily by saying, yes, I accept the update, and entering in their root password or the administrative password or even your regular user password on some distributions. Again, this is distribution dependent. Now, if the updated software needs root access or admin access, you’ll need the root or admin password. But if it’s a user level program, just your user password will do.

  1. Using RPM and DEB

In this lesson we’re going to look at two package managers, rpm and deb. Now when I look at the Rpm package manager versus the deb package manager, we’re going to do this on two different systems. The Ubuntu system that you have that you’ve been using this whole course is a debianbased distro. So it’s going to use the deb package manager which is called Apt. We’ll get to that in a moment. But first let me demonstrate what an Rpm, a PM package manager looks like. This is going to be used in things like Scent, OS, Fedora and other members of the Red Hat family. They all use the Rpm files and therefore are going to use an Rpm based package manager in Sentos.

This is Yum inside of Fedora, which is what I’m going to be using. We’re going to use DNF which is a modernized fork which retains a lot of Yum’s interface and it is just an improvement over Yum. So to do all of this we’re going to do it from within the command line. So if I go in here in Fedora, I’m going to go to activities. I’m going to type in Terminal and from here I’m going to click on Terminal. You’ll notice that we still have that activities tab like we do in Ubuntu. Why is that? Well, it’s because this is a gnome based interface and that unity interface that’s inside of Ubuntu also uses a lot of nomelike characteristics. So let me go ahead and increase the file size just a bit here. And so what we have here is Jason Dion at Localhost and I’m inside my home directory.

So the first thing we want to do is use DNF. Now DNF is a program that works as a package manager for Rpm based distros. It is the newest version and it is a fork off of the older Yum interface. Yum is still used by Sentos, whereas we’re going to use DNF here in Fedora. Now the first thing we want to do is update our package list. So we want to go and use a command known as DNF Check Update. And all this does is say, hey DNF, go out to the repository and get the latest version of the list of all of the programs that I can install and that will tell me what the latest versions are and what’s available.

So when I do that it’s going to go off to the server, it’s going to collect that information and bring it back to me. Now the next thing I want to do is I want to check if there’s any programs on the system that need to be updated. Maybe I have installed the system three days ago and since then there’s been some security patches that came out. This is something you want to do on like a weekly or a monthly basis. That way you can make sure your system always remains up to date with the latest patches and features. And so to do this, we’re going to use the command sudo, which is going to say super user, do as the root user run anything else. I’m going to type on this command line. And so as the root user, I want to run DNF and then I want to do upgrade. Now, why do I have to run this as a super user?

Well, the reason I have to run this as a super user or the root user is a lot of programs are installed by root like things at the core of the operating system and the kernel. And so if I want to be able to upgrade those, I have to do it as the root user. And this command will let me do that. So I’ll do pseudo DNF upgrade, hit enter, it’ll ask for my password. I’ll go ahead and type that in. And then what’s going to end up happening is it’s going to go out, it’s going to find anything that need to be updated and it’s going to ask me if I want to update those programs. And so here it came back and it said, hey, there are 27 packages that we need to install and there are 723 packages that need to be upgraded. This is 1. 2gb in size. Now, because I want to do this quickly with you, I’m going to say no to this upgrade. But if this was a system that I really use on a daily basis, I would want to take the time to upgrade it. In our case, for the sake of time, I’m going to say no, because 1. 2gb will take us about an hour or two to download. Next, we want to find a program to install. So we’ve been using VirtualBox in this course. And the nice thing about VirtualBox is it also runs on Linux. So maybe we want to install it here inside our Fedora distro. Well, we can do that by using DNF. And then we do search. And the word we’re searching for, in this case, we’re looking for VirtualBox.

Go ahead and hit enter. And it’s going to go out and check the package list and it’s going to find anything that has the name VirtualBox in it. So here you can see VirtualBox guest editions was one that could be used. We have another one for VirtualBox guest editions again, and we have another one for this VirtualBox driver and an open source VirtualBox client. And then another thing for server daemons and drivers required to run on VirtualBox guests. So let’s say I wanted to install the VirtualBox guest editions x 86 underscore 64. So that first VirtualBox guest edition sounds kind of interesting to me. Let’s go ahead and take a look at that and see what information there is to do that. We’ll use DNF and then the word info and then the package name. In this case, VirtualBox guest editions dot x 86 underscore 64. If you hit Enter, it should display the information from that package to the screen. You’ll see here that this is an available package.

The latest version of it is 6. 0 point twelve. You’ll see what architecture it runs on. You’ll see how large it is. You’ll see what the source file is and notice it is a Rpm file. It’ll have updates through the repository, and it gives me a little bit of information about this program. Now I am using Fedora inside VirtualBox. So using VirtualBox Guest Editions will give me some additional features, and it might be nice to have. So let’s go ahead and install it. So to do this installation, we’re going to do pseudo DNF install and then the name VirtualBox Guest Editions. And why we’re running this as a super user is, again, that this thing is going to have dependencies and additional software that may need to be run as part of the installation. And it’s going to need root access to do that.

So we’ll go ahead and do that and hit Enter. And what it’s going to do is it’s going to go off, it’s going to grab those packages, it’s going to find all the dependencies it needs to, and then it will install them. Now, in this case, VirtualBox Guest Editions was already installed on the machine. So there’s no dependencies to resolve, and there’s nothing really for it to do. So it just cleanly closed itself out and said, I’m done. So we need to find something that isn’t installed on this machine already. So let me go ahead and take a look at the activities section here.

And let’s see if we have Libre Office on here. Library office is on there. How about Google Chrome? Looks like Google Chrome is not on there. So what we’re going to do is see if we can find Google Chrome. So we’re going to do DNF search Google. Let’s see what comes up. Okay, lots of different things came up here for the word Google. And if we scroll up here just a tad, we’ll see if we can find something like Google Chrome. Here we go. We have remote desktop support for Google Chrome and Chromium. That’ll be one we can use.

So we’ll go ahead and use this because I’m pretty sure that is not installed yet. Okay, so what we’re going to do is we are going to use Pseudo DNF install, and then I’m going to put in the name of that program that I just found, that Chrome remote desktop. Now I’m doing this as the root user, because again, when you’re installing things, you want to do that as root. So it has access to all the files it needs to install those programs. Let’s go ahead and hit Enter. And here we go. We’re going to check and we found it. Okay, cool. So here in this case, you’ll see that this piece of software that we want to install has a bunch of different packages in it. The software itself is only 14 megabytes. That’s the top line here. But it has a lot of dependencies. For me to be able to install this remote desktop software, I also need to install all these other pieces of software.

Now, if you didn’t have a package manager, you’d have to go out and find all of those yourself. But because we have a package manager, we can very easily just say yes and it’s going to go and download all those pieces of software and install all 15 pieces for us. So I’m going to go ahead and say yes and hit Enter. And here it goes. Downloads all of those different packages for me, all 15 of them and it’s going to go ahead and install them for me. There you go. And so you can see here that it takes only about 15 to 30 seconds for me to be able to download all those pieces of software and get them installed. And now I’ll have a working piece of software that I can then use. Now, if we wanted to get rid of a piece of software, how do we do that? Well, DNF has that ability too. It has a feature called Erase. So if I wanted to erase that software that I just installed, I’ll use Pseudo DNF Erase and then the package name. And then if I hit Enter, you’ll see it’ll say, hey, there’s 15 packages that are installed as part of that software. Do you want me to get rid of all of them? And I’ll say yes.

I do. And off it goes, removing all 15 of those pieces. That’s the great thing about using a package manager. It’s going to keep track of everything it installed and everything that it needs to take away when you’re done with that program and keep all of that in one place, that makes it easy for you to use. Now let’s go ahead and look at Ubuntu and see how this differs. Now Ubuntu is a Debian based operating system and so it’s going to use a Deb file as its package format. This is the same type of format that’s used by Debian, ubuntu, Linux, Mint, and Caspian. There’s also a lot of other ones out there that use Debian based systems. Now, because we’re using a Debian based system, we’re going to use the Advanced Packaging Tool, or Apt. To do this. We’re going to open up our command prompt by right clicking our desktop and going Open Terminal. I’ll go ahead and maximize that and then I’ll also go ahead and make it a little bit bigger.

Now once we are there, we want to go ahead and use the same type of things that we did with DNF. The first thing is we want to update our package list from the repository. And to do that we are going to do Pseudo apt update just like we did DNF update before this is going to go out and it’s going to get the information from the software repository on the latest status of everything that’s out there this tells me all the programs that are available and what the latest versions are then I want to go through and see if there’s any software on my system that needs to be updated now my Ubuntu system is pretty recent so we may only find a couple but we’ll go ahead and check it so it says Pseudo Apt upgrade and hit enter and off it goes it’s going to find any of those programs in my case there was nothing that was needed to be upgraded there was zero to be upgraded, zero newly installed, zero to remove and zero that are not upgraded there are a couple of programs it says that are kind of legacy programs that are sitting out there that nobody is using it doesn’t think they’re needed anymore and so if we wanted to get rid of them we could do a pseudo Apt Auto remove and get rid of those programs that we’re no longer using so we can go ahead and do that we’ll do Pseudo Apt Auto remove and hit Enter, off it goes it’s going to find those 20 programs to remove I’ll say yes and they will get uninstalled for us this is a good way to help secure your system when there’s things you don’t need and you’re not using you should have them uninstalled now the next thing we want to do is find a program to install and you’ll notice I just uninstalled VirtualBox inside my Ubuntu system so we can use that as one that we want to install and so we’ll just use Apt search and we’ll look for VirtualBox here we go we got lots of different things here for VirtualBox and if I go ahead and scroll up just a little bit here we can find virtual boxes sitting right here so if I want to go ahead and install VirtualBox I can do that using Apt but first let’s take a look at the VirtualBox information so if I type in Apt show VirtualBox that package name I can get information about VirtualBox here if I scroll up a little bit you’ll get the information about it its name is VirtualBox the version is 5. 2.

32 it has optional priority you can get information about the section, the origin, who’s maintaining it, who the developers are, the installed size, all the dependencies, all the recommendations all of that kind of stuff that you would need and it even tells you a little bit about it the fact is VirtualBox is going to provide you the binaries for VirtualBox this will allow you to be able to run virtual machines inside of Linux and be able to run things like Windows, Dos, BSD or Linux inside of your yabuntu. Linux system. So if we want to be able to do that, we can go ahead and install that. And to do that, we’re going to use pseudo Apt, install VirtualBox, hit Enter. It’s going to go out and say, there’s this program called VirtualBox and you want to install it. If you want to install it, you have to install these other packages too, like Libg Soap, Libqt Five Openg.

You see them there in the middle of the screen. It also has some suggested packages. Now, if you want to do that and you install VirtualBox, you’re also going to install these other nine pieces of software. It’s going to take up this much disk space. Do you want to do that? I’m going to say yes and hit Enter. Off it goes. It downloads that piece of software for me. It’s going to get them unpacked it’s then going to build it, it’s going to compile it, it’s going to install it, and I’m going to have a working piece of software once this is done running. That’s the great thing about these package managers. It does all the hard work for you. Instead of me having to go out and find all nine of those programs, download them, UN, archive them, build them, create it all from source, get an executable file, put all the right files across my operating system, it does it all for me with just one command that just said pseudo app install and the package name.

Now, if I don’t want VirtualBox anymore and I want to remove it, well, instead of using a rayflick I did with DNF, I’m going to use the word remove. And here we’re just going to do VirtualBox. Hit Enter. It’s going to say, there are all these programs, do you want me to remove them? Say yes and off it goes. And it uninstalls them again and cleans up the mess you made again. These package managers will keep track of everything you’re installing and everything you’re uninstalling so it knows where everything is and does all that hard work for you. Now, what I’d recommend to you is go into Ubuntu, search around using the Apt tool and see what programs you might want to install, try upgrading and things like that. This is the command line equivalent to using that Ubuntu store that we used earlier. You’re on in the course, but if you’re on a server, you’re most likely not going to have a graphical environment or the Ubuntu store and you’re going to be using things like the Apt manager that we used here.

  1. Process Hierarchy

Now that we’ve discussed package management inside of Linux, let’s move on to understanding the process hierarchy. Now, in our previous lessons we discussed the Linux kernel being the core of your Linux installation. The kernel is going to manage your memory, provides software’s with a way to access hard disks, doles out CPU time and resources and performs all other sorts of critical low-level tasks. The kernel is loaded early up up in the boot process and it’s the kernel that’s responsible for managing every other piece of software on a running Linux computer. Now, one of the many ways that the kernel imposes order on the potential chaotic set of software running on the computer is to create a hierarchy. Now, when it boots up, the kernel is going to run just one program. This is known as Binit, or the Init process. Now the Init process is then responsible for starting up all of the other basic programs that Linux needs to run.

So this would be programs that manage the logins and the servers and all the other things like that. Now these programs, if launched directly by Init, are then called its children. The children of init can in turn launch their own children. And this happens when a user logs into Linux.

For example, the process that launched a given process is called the parent. So in it is the ultimate parent with a lot of different children underneath it. But each child itself can also be a parent. Now, the result of this is a treelike hierarchy of processes which are illustrated often in an upside down manner. This figure shows a small subset of the many processes that run on a typical Linux installation. You’ll see, just a few processes are associated with a text mode login, including the login tool that manages the logins, a couple of bash shells and a few user programs.

A working Linux system will likely have dozens or hundreds of running processes at any given time. Now each process has its own unique process ID, or PID that’s associated with it. These numbers begin with a one. So a NIFT process ID is normally going to be one. Each process also has a parent process ID or a PPID. And this is going to point back to its parent. So if init was to launch something else, that thing would have a parent process ID of one because init is what launched that child. Now, many of the tools for managing processes are going to rely on these numbers, particularly the PID or Process ID number.