CompTIA Linux+ XK0-005 – Unit 05 – Application Management Part 3

  1. Extracting

All right, so extracting the file, you download it. As I said, it’s probably going to be a tarball. Tar stood for Tape Archive, and it was a way of taking multiple files and saving it as a single file. So now that’s not a compression, it’s just having kind of a package. Then you would then take that tarball apart, untar it, and then have the separate files. Now, it could also be compressed and you’d see compression done with an extension of like, GZ or TGZ. So you also want to make sure you decompress the program as well. Now, the command tar will be able to help you with almost all of this. So an example might be Tar, and you would then say with the Z, decompress x to extract everything out. If you want a verbose report about what’s being done, you add the V. And if you want to specify a specific file name that you are trying to deter or untar, then F with the file name and then tell me the name of the file. And it’s going to go in there, it’s going to decompress it, extract the files, tell you about what’s going on, and then you have it ready to go. Make sure you do this in a folder or directory that you want to work in so that you have everything in one spot.

  1. Compiling and Linking

Now most of the time there will be a file called Configure. It is a shell script that was designed to help with the compilation process. Now, it might not be called Configure, but that’s a standard that we’re used to seeing. But whatever that file is, you’ll have it, hopefully you know which one it is. If it’s not the standard configure that the programmer told you what that file is, but you run it with the dot slash and then put in the name of that shell script, in this case, Configure. And what it’s going to do is it’s going to go through and look for all the dependencies. It’s going to make sure that you have what you need to run this thing to basically compile it. And it’s going to create what’s called a make file. Now, if you’re successful with the compilation and the linking, you’ll have basically the binary ready to go to the make file anyway, ready to go so that you can create a binary that is executable if during the compilation there are errors. The downside is it might tell you that a missing subroutine or function wasn’t available.

Unfortunately, that doesn’t tell you the library that was missing.It tells you which function in the library was missing. And that’s where some confusion comes in. Remember, a library is a list of functions, a list of code that you can reuse.And so one of the things you have to do is kind of read what the name of that missing function is and try to kind of figure out is that a library that deals with output to a monitor? Is that a library. You have to figure out what those libraries are that it might be to make sure you include them in this compilation process. If it’s successful. And I say that like, chances are it’s not, chances are it will be successful. It’s a rarity today to have some problems with this process. It will create a binary for you, though. How about, let’s say it this way, when it’s successful, it creates a binary for you. And the only thing you might have to do with, as I said before, is manually resolve some of the dependency issues. So our goal is to create that make file so we can move from there and make the actual application that we’re going to run.

  1. Installing and Cleaning Up

All right. So with that, by the way, the make file that is made is the program that you’re going to use, and it’s called making a file. So when you create that or do that compilation, the result must be a file that works with us in the make file. What we do then is we use the command make to install that file to basically, basically create what I want. Now, this is something that has to be done as the root. So if you’re not logged down as the route, you can use the sudo to use the make program, but you’re going to basically turn that into the binary. And then you can use the same make command to clean up all the temporary files that might have been in that process with the make clean option. So the installation part of it, again, we’re assuming the worst part is the compiling and dealing with those dependency errors and then getting to that make file. So we can use the make install command and then clean it up. And then we’re ready to go to launch the program that we just created from the source code.

So I realize that sounds like a lot of steps, whereas if I had a nice clean package and I can put the install in, then that’s great. Nothing wrong with the package. What I like about the source code is downloading files is clean, it’s quick, it’s easy, it’s a text file. I now have the source code. If I was a programmer, I can change how that program runs. I can make it better. I can make it worse. With me, odds are I’ll make it worse because I’m not the world’s best programmer. But that’s the cool thing about having the source code, is that it’s open for you to modify. If you would download a game and you aren’t doing so well, go to the source code, cheat, okay? Don’t do that. Don’t say I didn’t cheat. Anyway, you get the picture. That’s one of the big benefits about this. You can improve it. You can make it better. You can add new module, whatever you want to do. You can do all that processing. You just have to recompile, reinstall, clean up the mess, and you’ve got the new change.

  1. Demo – Installing the GNU C Compiler

All right, we’re going to install the Ganux C compiler, which is officially to us known as the GCC. So I’m going to go to the System and Administration, the Synaptic package manager. You know, the more I try to say that, the harder that gets it. I don’t know why I’m going to search for GCC to see if I can find it in a nice, easy way. And as I went to go and open this up, it gave me all sorts of matching components for GCC. And here, look at all of those options that I have. In fact, it looks like some of the base GCC stuff has already been installed.  And I don’t know that I would have some benefitsby adding some of these, but let’s add them anyway just to make sure we kind of feel comfortable with the process, including even just this GCC. One click apply. Click apply like we’ve done before, and we let it do its job of installing. Remember, I can expand the details if you want to see what’s actually happening in the behind the scenes process and changes are applied, I can click close. And just like that, I’ve installed a couple of packages. And again, the goal there was to give us the compiler, because one of the next steps we’re going to go through is to actually compile our own source code.

  1. Demo – Downloading and Installing a Source Code Application

Alright, we are going to do the one thing that most Windows people just don’t like doing and that is actually downloading some sort of source code and compiling it on their own. So I’m going to open up Ice Weasel and we are going to go to this Source Forge location for these L games. We’re going to go to Eltris and we are going to download Eltris which I’m going to say save it. And I already had it from another time, but anyway, I’ve downloaded it. Now that I had it, I think I deleted it. So that’s why you didn’t see a conflict there. And now that we’ve got that part done, I’m going to close down my web page and there’s Altruist and I’m actually going to put that into my home directory and deal with it while I’m there. Okay, now I’m going to go through the applications, accessories. We’re going to open up a terminal PWD to see where I’m at. I’m in my home folder.

We’re going to do an LS dash or just LS. And there’s Eltris and you can see that it is a compressed tape archiver, as we would say a compressed Tarball. So what I have to do now is kind of go through the extraction process and then take a look at the source code and go from there. So we’re going to use the command Tar. And let me just show you the help with tar and scroll back up a little bit to all these little commands. See, I probably should have done that. Piped it right into a more command just so that we see these. Okay, so we need a Z because we do want to unzip the thing and let’s see if I can just show you all of these options. It’s almost way too many options in fact, just because it is, let’s do that same help, let’s pipe it into the more option. Okay, so we’re going to use the X as well to extract. We’re going to use the V to do verbose amount of that work and we want it to be all the files in the archive. So here we see the X for extract is one of those options that we have.

And as I’m going through here again, the, let’s see if we can see any of these other ones as I talk about them that we’re going to put in here. The F again is to use the archive file. So I want the F as one of my options as well. I have to use the Z and the X to be able to also do the unzipping and the decompression. So there we go, there’s the Z and there’s capital X. So eventually you’re going to find as we go through here, you’re going to find all of the commands. And I probably already passed through the X anyway, there’s a lot to this program and so that’s what I wanted to show you is that the more you’re going to start doing this, the more you’re going to want to know what these options are in setting up your extractions. Now, the name of the file. Well, I’m going to put in Ltris and then I’m going to hit the spacebar, or not the space bar, I’m sorry, the tab key, because the tab key is going to allow me to auto finish it.

But if there were more than one, I could also have done this Ltris Asterisk, which as a wild card is also going to match on that file. So let’s try that out. It put all of those in there and when it did, let’s do the LS command. It actually put it into its own little folder here called Ltris and it’s got the version that we’re using. So I’m going to move to that Ltris folder. So CD command, I’m going to do an LS with the LF and A for the hidden files. And you can see that as I look at some of these options. Well, actually, I don’t have any hidden files, but what I am going to do is I’m going to run the configure. And the configure is something that’s executable and that’s going to help build for me the package eventually that I’m going to install. Now, one of the things that you have to be careful of is when you do this standard, remember, of the configure is something that we expect is there, but it doesn’t have to be by that name. That’s just what we’re expecting because most coders will do that anyway.

As we go through this, if something doesn’t work, we’re going to get some sort of cryptic message here towards the end and it’s actually going to fail. We’d have to start all over again. So we’re going to cross our fingers and hope that nothing fails. But if it does, we’ll try to look and see what that is and go through the fix. It says that the SDL config script installed could not be found. Make sure the prefix bin is in your path or the SDL config environment is set up to the full path of the SDL. Basically, it’s saying that the Lib SDL is needed. All right, so that’s a package that we’re going to have to come out and put in here. So let’s go to our Synaptic package manager here and it always opens up in the back and let’s do a search and let’s look for the SIB. Let’s try that again. The Lib SDL package, and I think it wanted the development package, which is a development file, it says here, was designed to allow programs low level access to video frame buffers, audio output, mouse and keyboard.

So that seems like a crucial piece of the environment that we need for this program to be able to utilize the standard in and standard out options that we have. What fun is the game if the keyboard, mouse and video and sound doesn’t work. All right, so we’re going to let that package go through. And that was the only error that we saw. We’re going to hope that once this package has been installed, that we can rerun the dot configure again and hope that it’s going to tell us that the make file will actually be done on the second go round. So we’re going to give this a couple of seconds to install the rest of the software. And then when it’s done, we’ll return, like I said, back to the command line. All right, so we’re going to close that up. We’ll close down the package manager and we’ll up Arrow and hit enter and hope that this time we’re successful in building this file. So remember, that last line that we’re really hoping for is that the make file will have been created for us and we’re getting through.

We’re getting through. Actually, it seems as though we’re getting a little further than we did before. A couple of warnings in there. And right here I see creating the make file. So now we’re going to type in the command make and it says, in this particular case, giving me a little error that says make is not being found. All right, so make didn’t show up as a program. And one of the issues that I just quickly took care of is I closed and opened a new shell window, moved back to that same home directory, making sure I’m the route. And the reason I did that is that this shell was open before I installed all the GCC stuff. And so it just kind of became one of those little things that I needed to refresh by closing and opening the shell. So there’s my make command. And so it looks like it made all of the directories, made everything that I needed to have. So now I’m going to try a make install as it goes through. And the make install should give me the files copied to my system directories.

No password was asked for because I’m already the root. And then, as we said from there, we should clean up all the extra garbage. So to Make Clean gets rid of that. And let’s see what happens if I type altruist. And look at that. I have a game. So a couple of little things you’ll see there. No matter how often you use Linux, sometimes you’ll get a bit confounded when you first have an installation and you’re still adding in the different packages. Remember that your shells know what the world was like when you came in. And sometimes you have to close them and open them again for those changes to take effect, which is what happened with my missing make command. All right, so the only thing I’m not going to do is actually play the game for you. I’ll let you go and install it on your own and your reward will be able to see what the game does.

  1. Unit 05 Review

All right, so in this unit, we dealt with application management. We talked about installing, managing, and removing software. That was easy enough, looked a lot like Windows packages and all that kind of cool stuff. We then took on the source code stuff, the part that a lot of people find scary. We took the idea of starting with a text file source code, compiling it, installing it, and then running it like like any other software. Now, the nice thing about source code was that you had the option to make changes. If you’re a programmer, you have some flexibility. It’s easy to distribute, it’s easy to download. There’s a lot of great flexibility. It is scary, though, if you’re not a programmer or you don’t quite get the concept of what’s going on. But I hope that you saw that it really wasn’t that bad. As long as the person who’s applying the source code knows what they’re doing, this process is pretty straightforward.