Google IT Cert – Week 15 – Package and Software Management

This is my evaluation of Week 3, Course III in the Google IT Pro Cert program on Coursera.org

.   .   .

Software Distribution

Course Intro

This week we’re going to learn about managing software packages in Windows and Linux. Get ready for a lot of explanations of things working properly, without any mention of conflicting drivers or whatever the hell the .NET framework is. The end of this week will bring me to the half-way point in Course III.

 Windows: Software Packages

Software is usually packaged in such a way that the installation process is largely automated. Software is packaged differently by different compiling tools, but, in the end, the user should have a product that will install on their machine.

Software for Windows computers is usually packaged as an executable file, with the “.exe” file extension. This is a package of instructions that are executed when run.

The concept of the executable file is not unique to Windows, but they are created using Microsoft’s portable executable format, or PE format. Executable files contain instructions for computer, and also additional content like images, text, and something called an MSI file, or Microsoft Install package. This MSI file works to “guide” the Windows Installer program in the installation, maintenance and uninstallation of the program in question.

Executables may also be used as “stand-alone” installers, without an MSI file and without using the Windows Installer program. If packaged like this, then the .exe file will need to contain all the information required to install the program.

Using the MSI file and the Windows Installer is a more automated process to install a program, but if developers need very detailed control over the setup of the software they may opt for a custom .exe installer.

Since Windows 8 there has been a wonderful place called the Windows Store. This is an application repository where you find universally Windows-compatible programs. These will run on any Windows system, and are packaged using the APPX format.

I have already learned how to install a program in the Windows GUI by double-clicking on the .exe file. Here’s how to do it in the CLI:

Either navigate to the directory containing the executable file and enter the filename, or enter the absolute file path to the .exe file, like this:

PS C:\Users\genericUser> c:\users\genericUser\Desktop\GreatSoftware.exe

There are many options for how packages will install when run from the CLI. Use the /? parameter to see possible sub-commands available when installing software. There will be some reading on this very soon. And you can always read documentation.

Reading: Windows: Software Packages

Readings here on portable executables, the Installation Package, the Windows Store, and App Packager (MakeAppx.exe).

 Linux: Software Packages

There are many different Linux distros, and thus there are also many kinds of software packages. The Red Hat distro uses .rpm packages, or Red Hat Package Manager packages. We aren’t going into them detail, but know that they exist.

Ubuntu uses Debian packages, known as .deb packages. We’re going to install a Debian package in the Ubuntu terminal using the dpkg command. This example uses the open-source text editor Atom. The I flag stands for install.

user@generic-user:~$ sudo dpkg -I atom-amd64.deb

This will make some output about the install, but that’s about it.

How about removing a package? Use the -r flag:

user@generic-user:~$ sudo dpkg -r atom

You can list all the Debian packages installed on your machine using the dpkg -l command:

user@generic-user:~$ dpkg -l

There should be tons of Debian packages on a normal Ubuntu system. Find a specific package using the grep command. In this case, let’s search for Atom again:

user@generic-user:~$ dpkg -l | grep atom

We just executed the dpkg -l command and piped the output (“|”) to be the input of the grep command. You will surely recall that grep is a ubiquitous Linux program that searches files and strings for patterns.

Windows: Archives

An archive is a set of files that are compressed into one file. Package archives are the “core” source files of a piece of software that are compressed into one file. Using a source archive to install software is referred to as installing from source.

Popular archive extensions are .tar, .rar, and .zip. Archive files need to be extracted, or uncompressed in order to use the files inside. Installing from source varies with how the software was compiled, but we will go over how to extract archives, as this is a very common activity in IT support.

There is a very popular open-source archiving tool called 7-zip that we are going to look at. 7-zip allows you to archive and de-archive files easily in the GUI, by adding a 7-zip menu to the options available on right-click.

Archiving is great for bundling together multiple files to be emailed as one file, or for storage (archiving).

PowerShell 5.0 or newer also allows easy archiving right from the CLI. Let’s say there is a folder on the desktop called “coolFiles” and we want to make an archive from that folder called “coolArchive”:

PS C:\Users\genericUser> Compress Archive -Path C:\Users\genericUser\Desktop  \coolFiles\ ~\Desktop\coolArchive.zip

Reading: 7-zip and PowerShell Zips

Read about 7-Zip here and about archiving in PowerShell here.

Linux: Archives

7-Zip is also available for Linux, here they are using the package p7zip-full. To extract using 7-Zip, use the 7z command, and the –e flag for extract. Here we extract a .tar file in the home directory:

user@generic-user:~$ 7z -e my_archive.tar

There are many archiving tools available for Linux, and one that is built in is the tar command, which you may read about soon.

Reading: Linux Tar Command

Oh look, there is some reading available all about the tar command. It stands for “tape archive”.

 Windows: Package Dependencies

Software packages usually depend on other pieces of code. A game may rely on a physics engine to make the game look “right” and a rendering library to render appropriate graphics. These extra packages are called dependencies, because one piece of code relies on another.

In the game example, the code in the game is dependent on a physics engine and a rendering library. A library is a package of code that someone else wrote that is used in conjunction with the “main” software, i.e., the game. In Windows, these libraries are called Dynamic Link Libraries, or DLL.

DLL’s can be used by many different programs, so each DLL needs to only be loaded into memory once before being available to multiple programs.

Most Windows installation packages will have all the dependencies, along with an MSI file that tells Windows how to put it all together during installation.

In the old days, programs were not usually able to share DLL’s easily, or would be broken when one program updated a DLL that another program couldn’t use. Modern Windows uses Side-by-Side Assemblies, or SxS to manage DLL’s and other resources. This has mostly done away with “DLL Hell.”

You can view (but don’t mess with) these resources in C:\Windows\WinSxS

If a program needs to use a certain DLL, it will tell Windows in something called the manifest, which tells Windows to load that library from the SxS folder.

You can easily find programs and their dependencies from the command line using the cmdlet Find-Package. (A “commandlet” is a Windows command that uses the “verb-noun” format.) Here we’re going to install the SysInternals package using PowerShell:

PS C:\Users\genericUser> Find-Package sysinternals -IncludeDependencies

This returns an error, because PowerShell packages are stored in the PowerShell Gallery, which does not include SysInternals. We will go into more depth soon, but we can find the SysInternals package in a repository called Chocolatey.

First, tell PowerShell that Chocolatey is a source for packages:

PS C:\Users\genericUser> Register-PackageSource -Name Chocolatey -ProviderName Chocolatey -Location https://chocolatey.org/api/v2

Then you can verify the source:

PS C:\Users\genericUser> Get-PackageSource

And then we can get the SysInternals package:

PS C:\Users\genericUser> Find-Package sysinternals -IncludeDependencies

Then, in a later video, apparently, we’re going to learn how to actually install the package using the Install-Package cmdlet. This is a good example of a video that presents the information in an order that doesn’t make much sense. Instead of showing you that using Find-Package initially returns an error, how about explaining how it is set up first? I feel like the negative setup or whatever that is called is backwards.

Reading: Windows Package Dependencies

Some more exciting readings here:

Dynamic Link Library | DLL-Hell | Side-by-Side Assemblies | PowerShell Gallery

Linux: Package Dependencies

Let’s try to install the Chrome browser from the package on the desktop:

user@generic-user:~$ sudo dpkg -I google-chrome-stable_current_amd64.deb

This results in an error from dpkg, because Chrome needs another package, libappindicator1 to be installed. Libappindicator1 is a dependency.

The dpkg command is easy to use, but it does not install package dependencies. Linux has shared libraries, much like DLL’s in Windows, are packages of code that programs can use. If you have a dependency error, you can install them one by one, but that is lame.

Luckily, there are Package Managers, which include the necessary components needed to make package installation and removal easier, and that includes installing package dependencies.

 Reading: Linux Package Dependencies

Read more about the dpkg command for Debian-based Linux systems.

>>>>quizzzzzz>>>>

Package Managers

Windows: Package Manager

Package managers are tools used to manage software installation, by making the process of installation, removal, and update, as well as dependency management, as automated as possible.

Remember Chocolatey? It is a third-party Windows package manager, that works with Windows components like PowerShell, and allows you to install ay of the software that is in the Chocolatey repository.

Here’s how to install Chocolatey, as we almost did a few videos back:

PS C:\Users\genericUser> Find-Package sysinternals -IncludeDependencies

Now we can actually install the SysInternals package:

PS C:\Users\genericUser> Install-Package -Name SysInternals

Then, after installation, verify that it was installed:

PS C:\Users\genericUser> Get-Package -Name SysInternals

You can also uninstall a package:

PS C:\Users\genericUser> uninstall-Package -Name sysinternals

Great job.

Reading: Windows Package Managers

Read about the NuGet package manager and the Chocolatey package manager.

Linux: Package Manager Apt

Ubuntu uses the Advanced Package Tool, or apt. This makes things easier than using dpkg to install packages. It manages dependencies, makes it easier to find packages, cleans up unused packages, and more.

Here we will install the GIMP graphics editor:

user@generic-user:~$ sudo apt install gimp

This connects to the Ubuntu package repository and installs all dependencies. The repository is a server that hosts software packages.

Let’s check out the list of repository sources on the machine:

user@generic-user:~$ cat /etc/apt/sources.list

Ubuntu includes all the base package repositories in this list, which allow you to access most common software. Linux also has what are called Personal Package Archives, or PPAs, which are repositories for uploading source packages to be built as an APT (advanced packaging tool) by Launchpad, a website owned by Canonical. PPA’s are not vetted the same way that official repositories are, and can contain old, non-funcitonal, or even malicious software.

Make sure to run apt-update before downloading packages.

user@generic-user:~$ sudo apt-update

Run apt-upgrade to update software packages on your machine.

user@generic-user:~$ sudo apt-upgrade

Check out apt –help for more info.

Reading: Linux PPAs

Reading on Personal Package Archives.

Reading: GIMP

And a reading on installing GIMP.

>>>>>>>quiz>>>>

What’s Happening in the Background?

Windows: Underneath the Hood

How does software installation really work?

When you open an .exe file, it will either begin a custom installation or it will initiate the Windows installer system. If it is performing a custom installation, it will be somewhat different than any other software, and the process will be somewhat opaque, because most software is closed-source, meaning you can’t view the source code. You can monitor processes with process monitoring tools, which will show you what the system is doing.

If a package is using the MSI file installation process, it must conform to a set of rules created so that Windows can understand and perform the installation process. MSI files are actually combinations of databases containing instructions in different tables, along with files, objects, resources, etc. needed to run the program. Windows keeps track of all the steps taken during an installation, and uses those steps to create instructions on removing the program.

If you’d like to create an installer package, Microsoft has a tool called orca.exe.

Reading: Windows Installers and Process Managers

Read about Process Monitor | Windows Installer Examples | Orca.exe

 Linux: Under the Hood

Linux software installation is a little less complex.

Let’s say there is a basic package we want to install, they call it “Flappy App”. Once extracted, you’ll see there is a ReadMe file, which is supposed to be read before installation. No one ever does this. There is also a flappy_app_code, which is the actual source code for the program. Then there’s a setup script, which tells the computer to take steps during the installation, such as “create a folder here and name it this” or “copy this part of the source code to a new folder in the /bin directory.”

This is a gross oversimplification, but that’s essentially how software installation is done in Linux.

>>>>>quiz>>>>>

Device Software Management

Windows: Devices and Drivers

Drivers are software that allows the Operating System to work with devices. Windows places all the devices in the system in one place called the Device Manager. Open the Run dialog box and enter devmgmt.msc to see the Device Manager.

Devices are grouped together in categories, so that monitors are all grouped together under Displays, etc. This is all managed by the Windows Plug and Play, or PnP, system. Windows will automatically try to get the device working when it is plugged in, based on a unique identifier in the hardware called a Hardware ID.

Windows uses the ID to try to find a compatible driver in a local list of “well-Known” drivers. If Windows cannot find the device, it will check Windows Update or the driver store.

Many devices will come with a driver disc, and you can instruct Windows to look there. Windows then installs the driver software so that the device can be used.

Right-click on a device in Device Manager to update or uninstall drivers for that device. Select Properties to see some details about a device or its drivers.

Reading: Windows Devices and Drivers

Learn about Plug and Play, hardware ID, also hardware ID, and finding drivers.

Linux: Devices and Drivers

Linux considers everything to be a file. When a device is installed, a new file is made in the /dev directory. There are many types of devices in Linux systems, but we are not going to go over every one.

Character devices are things like keyboards and mice, that transmit data “character by character.”

Block devices are things like USB drives that transmit data in units, called blocks.

Remember that the first bit you see when you run the ls -l command is the file type. A “-“ symbolizes a regular file and a “d” stands for a directory. You may also see a “b” for a block device and a “c” for a character device.

If you see  /dev/sda it means the device is an sd device, such as a hard drive. The “a” means that it was “seen first.”

Updating device drivers in Linux may be slightly more confusing than in Windows. Many common devices have support built into the kernel, so that when you plug in the device it will work without further setup.

Devices that do not have built-in support have something called a kernel module. This “extends” the kernel functionality without anyone having to modify the kernel. Not all kernel modules are drivers, but they are installed the same way other software is installed in Linux.

Reading: Linux Devices and Drivers

Readings on Device Files and Udev.

 Windows: OS Updates

As everyone knows the Windows operating system has one of the most elegant, efficient, and easy to manage update processes ever. That’s why the Fall Creators update actually destroyed things all winter, and the April Update finally came out in May.

Operating systems update the same way that software updates. Updating the OS is important, especially for maintaining security patches. New features and crap from Windows are not usually that important, but security patching really is.

Windows uses the Update Client service to download and install updates by checking the update servers periodically. Here the presenter says that Windows will then ask you if it is okay to install the updates at that time. This is not entirely true. I know Microsoft says they ask, but they don’t always. Even when you have “working hours” set to disallow updates at certain times, Windows may still force the update through.

You can check your update settings by searching Windows for “updates” and selecting Check for Updates from System Settings, and clicking into Advances Options. Here you can manage when updates are installed. Windows 10 uses a monthly “cumulative” update system, which, supposedly, allows fewer updates to be needed when a machine has been off or unable to update for a long time.

 Reading: Windows Update

More on Windows Updates from Wikipedia, some blog, and some stuff on Windows 7 and 8 service changes.

 Linux: OS Updates

Using the apt-upgrade system may install security updates to programs, but it does not change the core OS, the kernel.

You can see what version of the kernel you have by using the uname -r command:

user@specific-user:~$ uname -r
4.10.0-28-generic
user@specific-user:~$

First, update your application sources with apt-update:

user@specific-user:~$ sudo apt-update

Then, run the full-upgrade command to update the kernel:

user@specific-user:~$ sudo apt full-upgrade

And that’s that.

Reading: Linux OS Update

Learn about the Linux kernel, Linux updates, and updating Ubuntu using the command line.

>>>Discussion>>>

This week’s discussion (which I am still not receiving credit for…) asked what you would do if you went to an internet cafe or a library and the computer you used needed the OS updated. This struck me as a really funny question. Personally, I would do nothing. Nobody wants the customers “helping” with Windows updates.

>>>>>quiz>>>>>

>>>>>>>Assessments>>>>>>>

This week the graded labs went a little better. There was a problem with the Windows lab at first, but it seemed to solve itself in a kind of weird way. The instructions said to open Chrome and download the installer for the Atom text editor. Simple enough. But my Windows VM didn’t have Chrome. Tried opening Internet Explorer which wouldn’t let me download from a site outside the “Trusted Sites” list. Add the atom page to the list, still not working. Then tried downloading Chrome. No luck. After trying all steps two or three times over suddenly there is a Chrome icon on the desktop. What the fuck. I guess it took five or so minutes to load the icon. I don’t know. Bullshit.

As usual, the Linux lab was easy and fun.

You’ve endured this much, check out next week.


Anker SoundBuds Slim Wireless Headphones Bluetooth 4.1 Lightweight Stereo IPX5 Earbuds

Anker Soundcore Portable Bluetooth Speaker with Loud Stereo Sound, Rich Bass, 24-Hour Playtime

WD 4TB Elements Portable External Hard Drive - USB 3.0

World Without Mind: The Existential Threat of Big Tech by Franklin Foer

Live Work Work Work Die: A Journey into the Savage Heart of Silicon Valley by Corey Pein

 

 

 

 

Advertisements

One thought on “Google IT Cert – Week 15 – Package and Software Management”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s