Linux Foundation LFCS – Domain No. 2 – Operation of running system Part 3
So in server administration is very important to understand how the running processes work in detail from high load to slow response time processes. When your server becomes so slow or fails to respond, you should understand the process management. Or Linux process management in specific to an action when it is the time to kill a process or Renite it and high how to monitor the currently running processes and how these processes affect the system load. Let’s see. How Linux Process Management will help us tune the system. So we’re going to talk about process types first. Before we start talking about Linux Process Management, we should talk and review about the types.
There are four common types. Of processes. Or five, I should say. The first one is Parent process. Second one is Child process. Third one is orphan process, then the demon process and then the zombie process. So the parent process is a process which runs the Fork system call all processes except Process Zero have one parent process. Child Process is created by a parent Process Orphan Process. It continues running while its parent process has terminated or finished. Demon Process is always created. From a child process and then exit. The zombie process exists in the process table, although it is terminated. So in server administration, memory management is one of your responsibilities that you should care about as a system administrator. One of the most used commands in Linux process management is the free command. So let’s use that free M.
And the part we are concerned about right now is the buffer slash cache and the output of the free command. Here means there are 387 megabytes is used while 3. 5 gig, almost a gigabyte is available. The second line is the swap. Swapping occurs when memory becomes to be crowded. The first value is the total swap size which in this case is 1023 megabytes, and the second one is use Swap, which currently is showing as zero, and the third value is the available software usage, which is 1023 as well. So from the above results, you can say that memory status is good since no swap is used. So while we are talking about the swaps, let’s discover what Proc Directory provides us about the swap. So I just did a cat on Proc swap S and it tells us the partition size and the drive, which is SD 82 in our case and shows us the swap size and also shows how much is used.
Another very useful command is cat or not a command, but that’s something. That file that you can look into is PR o C proc System VM. It shows ten. That means this command shows the value from zero to 10. And this value that we are getting, ten. This means the system will use the swap if the memory becomes 90% used is echo suppose I want to set the value to 50 greater than proc you can do sysctl also so you’ll type sysctl WVM? Swappiness equals 50. But this is temporary. If you really want to hard code it how it’s done. By the way, I mistyped in. Sysctl is already a file, existing file. And you just change the value here. If you want to change it, you can just come down here and type.
We’re going to talk about Nice and renoisse processes. So the processes Nice value is an American indication that belongs to the process and how it’s fighting for the CPU. A high Nice value indicates a low priority for your process. So how nice you are going to be to other users and from here the name came so Nice range change is from -20 to plus 19 and the Nice command sets the Nice value for our process at creation time while re Nice command adjusts the value later. And if you want to change the price value you start with nice n suppose priority if I want to increase the priority by five and then although I don’t have a script called my script, but just to show you what the command looked like. This will be the command. It’s going to error out because I don’t have a script by that name. And if I were to re Nice it, which means the command decreases the Nice value, then I will type in renoisse and without the dash n and then minus five in my script. And this is going to suppose I want to renaisse the process, then the way it’s done is re Nice minus five and then the process ID of the process. So suppose it’s in my case, suppose if it’s 2213.
So this command is going to decrease the Nice value means increased priority and the number 2213 is the process ID. You can increase this Nice value lower priority but cannot lower it high priority, while root user can do both. Now we’re going to talk about the kill process. So Kill minus one and then process ID is called a safe kill. However, depending on your situation, maybe you need to force a service or application to hang up like this. So sometimes the safe killing and reloading fail to do anything. You can send Kill signal sick Kill by using Nine option which is called actually instead of ID it was ID. So you will run Kill minus nine and then process a type ID. Last time it’s supposed to be ID process ID. There is no cleanup operation or safe exit with this command and it’s definitely not preferred. However, you can do something more proper by using the Pkill command. So P kill minus nine and then the service name and that’s a safer way to kill. Also, there’s another way to kill processes is PGRP then service name. And as you use the Pgrap command to ensure that all associated processes are also killed.
Hello. In this lecture we’re going to talk about package managers. We’re going to show you two different ways of packages on Centaus or Red Hat machine. So Rpm is the first one stands for Red Hat package manager. Now it’s an open source and it’s a low level package manager which runs on Red Hat Linux as well as other Linux such as Centaus, Fedora and some Unix systems. You can compare it to Dpkg Package Manager, the default packaging system for Debian and is derivative such as Ubuntu and Kali Linux. And the second one is called Yum package Manager. It’s an interactive front end Rpm based package manager. You can use the Yum command to list all the installed packages on your system. And one advantage with this method is it includes repository from a package when it was installed. First we’re going to use an example of an Rpm. So Rpm QA is going to print a list of all the packages that are installed in our system, where the queue means query and a means enabled listing of all installed packages. Okay? And as you can see, there are quite a few packages that has been installed, like Python is one of them and Perl is one of them. OpenSSH Network Manager System D.
These are all different packages that are installed. And now we’re going to use the same thing, but instead of Rpm we’re going to use Yum list installed. So this shows also similar information as we saw at the Rpm. And so these are the two ways you can list the packages. So there’s a utility called Yum Utils yum Hyphen Utils and it has an assortment of tools and programs for managing Yum repositories, installing, Debug packages, source packages, extended information from repositories, and administration. So first to install it we’ll go Yum update emperson Yum install Yumutils. Once the utility is installed, we’re going to type in repo query to list all the install packages in our system, a to enable and then install. And there’s a listing of all the packages installed. Okay?
So next we’re going to look at Appkget. Appt is a command line front end for the Dpkg packaging system and is the preferred way of managing software from the command line for many distributions. It’s the main package management system in Debian and devianbased Linux distributions like Ubuntu. So right now I’m logged into an Ubuntu machine. While a tool called Dpkg forms the underlying packaging layer, app Get and App Cache provide user friendly interfaces and implement dependency handling. This allows users to efficiently manage large amounts of software easily. So in order to update the software, you type in Aptget Update.
Okay? Once you have the update, then you want to upgrade. And in order to upgrade we’ll will type App Get upgrade and it’s asking if you want to continue and we’ll say yes, and it’s going to start upgrading. Suppose I want to install a single package instead of upgrading the whole system. I will type in Aptget Install, and let’s say I want to install Firefox. Okay? So Firefox is installed. Suppose I want to remove it now so I can go Aptget remove, and then the package name, which in our case is Firefox, and it’s going to start removing it. So this last command, this command removes the packages but keeps the configuration files in case you install the package again later.
This way your settings will remain intact even though the program is not installed. So if this is not something that you want, and you want to completely clean your system off that software, then there’s another command called Purge. So we’ll type in Aptget Purge and Firefox, and this is going to remove the configuration files as well. So in Centaus, we had the Rpm QA, if you remember, which was to get more information or query a particular software. In divianbased systems. You have aptcache cache search. And suppose I want to search Hop, which is a better top command, and it gives you this information that’s an interactive process viewer and something regarding old perl module for old onetime password. So this is more has to do with programming, but it gives you a little bit more information about the software.
Popular posts
Recent Posts