One of the most important method of securing your operating system is to remove unnecessary or often
packages, so unnecessary packages are packages that you do not need or your system or your application
does not require to have it on your system.
And an orphan packages are those that are left behind after you move the packages and our dependency
on them.
So the first rule is to keep your server lean and mean.
So basically no fat on it.
Install only those packages that you really needed if they are unwanted in packages.
What do you need to do?
Just simply slash them to lead them?
Fewer the packages, the less chances of unpatched code, meaning every time there are issues to any
packages that are installed in your system, there has to be a code upgrade to upgrade or update that
package.
So, of course, you if you have less of the packages, the less of the code to fix.
So here are a couple of guidelines that you should follow.
Number one is do not install packages that you do not need during the initial installation period.
The initial period or in the initial installation is when you are actually going through the installation
process, make sure you do not pick any packages that are not needed, pick the basic which is based
install even without gooey.
I would recommend in corporate environment, don't even pick the goodies, simply install the Linux.
That gives you a simple command line.
Then if you have to install any packages later on, pay very close attention to the add on packages.
There are packages that will be added on as a dependency that were that are required for a package to
be successfully installed.
So you could install those packages.
That is fine, but there might be some add on additional that are not needed.
But the program gives you like a promotion kind of thing to install to make.
Please make sure you pay close attention to it and do not install to get a list of all the packages
that your system has right now.
The command that you should run is R.P.M. Dach Kiwa.
Of course, this is a command that is that works on RedHat Centaurs and Fedora type of Linux distributions.
You could get the listing of all the packages that you have in your Linux machine through that command
and same command.
I mean, the same purpose can be served from a different command on a Bunta server, which is about
spaceless list space dash installed.
By the way, both of these both of these commands give you the same results is to get you the list of
all the packages.
What you should do is if you are going through the package validations or auditing or and securing your
system, then what you should do is you should run these commands output.
To a file, when you get a listing of all the packages you have installed, put that output to a file,
and then you should go through each and every package one by one.
Now, I do understand and I completely agree for those who are thinking right now that, oh, my God,
I have thirteen hundred fourteen packages.
Are you kidding me?
I have to go through it.
All those packages one by one.
OK, the answer and the hard answer is yes.
If you wanted to secure your system, you have to go through all of them one by one.
Now, the good news is that when you go through all of them one by one, and you have a standard build
that your systems, that you're going to be building more systems down the road.
And these are the packages that you need to install and the remaining ones you could get rid of, then
it means all that effort will pay off.
You don't have to go through that filtering process again.
You could just compare what you have, what you don't need and then what you don't need.
You could just simply discard it.
So most of the time, as a general practice, most of the corporate environments do have that practice
in place.
If you join a company, they probably have something, a template of a system that tells you, hey,
these are the package that should be installed and these are packages should not be installed.
Perfect.
Your own perfect world, you get in also.
But what if you get into a job and they don't have that type of standard a template, then then it's
a time for you to shine.
Basically, this is your opportunity.
Go to your manager, tell them, hey, listen, we I notice that we are installing every package in
the system and we should not.
So let's remove them.
Also, one of the great thing and every great manager asks you when you go for an interview, how do
you make your system secure?
And if you answer, I will remove all unnecessary packages or offer packages.
You'll score it right there.
You'll understand where you're coming from.
So anyway, go back to the point is, make sure you have a list of all packages, go through them and
remove them.
To remove packages that command, you would have to use his R.P.M. space minus E to erase in package
name.
And then of course is R.P.M. is a command of RedHat or S.O.S.
For a Bunta type of Lennie's distribution, you have to use Atget, which is hype and hype and get space
removed and space package name both performs the same function as long as you get the desired result.
Now about orphan packages.
What are those?
Let's talk about them.
The objective is to remove all orphan packages from CentOS Linux.
By orphan packages, we mean all packages which are no longer serve a purpose of a package dependencies.
For example.
Let me give you a quick example so you will have a better understanding what exactly the above paragraph
means.
Package A any package call a package is dependent on package B does in order to install a package A,
package B must be installed in required understood.
Once package is removed, package B might still be installed.
You see that therefore the package B is now orphan package.
So you have a remove package, but package B was required to have a package.
But now since Package A is gone, you don't need package B, right?
Sadao those packages that classify in Package B are often packages and you should delete them.
Now, how do you identify those packages?
Good question.
Moving on, there is a built in utility which allows you to check for orphan packages in your Linux
machine for S.O.S type of Linux distributions or S.O.S or RedHat.
That utility is called Jume Utilities.
And of course it's an RPN packages as well.
If you have that installed and it means you have that comen that I'm going to show you right now, check
if that exists in your system, meaning check if the dependancy so are often packages that exist in
your system or.
Sorry, let me take one step back.
What I meant is check if that utility lambdas still exist in your system is to run R.P.M. Dash Q8 Group
Young utilities.
If that package is there, then it means you don't have to download or install it.
But what if it does not exist?
Then simply you could do Jum install youm dash utility.
OK, so once you have that installed let's suppose you have it.
Now the next question is get a list of all orphan packages and that is package dash clean up space dash
leaves.
It will give you.
Everything, all the often packages in your system, once you identified them, what do you need to
do?
You need to remove them.
Of course, you could do R.P.M. minus E, or you could simply use this command, which is a lot easier,
youm space to remove space package to clean up the same command that we ran earlier.
But of course, with back techs, back techs are the one that is right below your escape key.
And of course, for a Bunta system type of systems, all you have to do is app, dash, get or remove
and it will do all the job for you.
All right.
So that's about removing unnecessary or often packages.
Now, I want you to actually log into your system, to your editing system and follow the way I'm going
to log into my system and I'm going to go through these few commands.
So I have my Linux machine right here.
And I first of all, I'm going to check the list of all the packages that I have, which we covered
in the last slide, I'm going to do more and see look at so many packages I have now.
If I wanted to count how many here have, I could do simply R.P.M., UAW C minus L, and it's going
to tell me I have fourteen hundred and eleven packages.
No kidding.
Yes.
That, that is a high number.
But anyway, as I said, what you have to do is you have to output to a file like temp system.
RPM's total, it creates a file and outputs and by getting the output of R.P.M. Tachikawa Way then you
go through all those packages, as I said, one by one, and you delete them, know, the next command
is to remove RPM's or remove orphan packages.
And for the utility, you need to have the utility.
And first to find out whether you have that utility run R.P.M. minus Q8 gear up for Jume Dashi you t
Ķiģelis.
Yep, I do have it perfect.
I don't have to install it if I if I didn't, then you would have to install it.
Now, the next one is cleanup to check all the orphan packages.
So package.
Clean up, dash, dash leaves, by the way, it's dash dash leaves, not just one single hyphen, it's
two hyphens.
There you go.
So it's give me all these lists listing off those packages, by the way, how many we have W, C minus
all eight of them.
So I want to get rid of them.
Perfect.
So what how do I do that?
Simply run Jum, remove Batek.
Tactic close and hit enter, and it is going to remove all those packages that are listed above.
Here you go, it's going through that, it's just asking you want to go ahead and remove it?
Yes, I want to go ahead and remove it, erasing, erasing, erasing and so on and so forth.
And it is complete.
Now, if you run that same command, it shouldn't give you any.
If it does, then you could run these commands a few more times to make sure you have a fully complete
system that is free of all orphan packages anyway.
So that's how you do remove unnecessary and orphan packages.
Again, if you have any questions, please send me a message.
And I'm always here to answer any questions you guys have.
Thank you.