OPS245 Lab 2

From Littlesvr Wiki
Jump to navigation Jump to search

!!! THIS LAB IS NOT READY YET !!!

Most of the software you'll ever install on a Linux server is open source (free to distribute and modify). In just about every Linux distribution you can use a package manager application to download the software from the internet and install it with a single command. Debian's package management system is caled Apt. Linux Mint uses the same system, since the distribution is built on top of Debian.

One reason a package manager makes it easy to install software is its dependency tracking and resolution ability. Most software requires some other software to run, and the other software probably requires some other software itself, etc. When you ask a package manager to install a piece of software - it will also install all the required dependencies.

Graphical Installer

Linux Mint comes with a graphical application called Software Manager, and another called Synaptic. Synaptic is also available on graphicall installations of Debian. We'll use Synaptic.

  • Look through the Menu (in the bottom left corner) on your workstation. Notice that the only browser you have installed is Firefox.
  • Start Synaptic from the Menu.
  • Put in your regular user's password. You need to be root to install software on the system, but your regular user has sudo privileges, and Synaptic will use that to install the package.
  • Click Reload. This will download the latest list of available software.
  • Look for Chromium and mark it for installation.
InstallChromium.png

Notice that it will tell you that an extra package needs to be installed. Chromium actually has many more dependencies, but the rest of them were already installed (you'll see the list during the next step). libgl1-mesa-glx is the only dependency missing.

  • Click Apply, and Apply in the window that pops up.

Synaptic will use the Apt system to figure out the names of the files to be downloaded and their locations on the servers, will download them, and install them.

InstallChromium2.png
  • After it's installed: right-click on the same chromium package in Synaptic, pick Properties, and Installed Files. Look through the list.
ChromiumInstalledFiles.png

Notice that this is quite different from Windows. In Windows typically all the files that are part of the application go into a folder in C:\Program Files\Whatever. In Linux the location of each file depends primarily not on the application it's part of but on the type of file it is.

System Directories

The system directory structure on Linux has a very long history on Linux, and it's based on Unix, which itself has a long history. Which means that it's a bit of a mess. We'll look at the most common directories.

Executables

An application is almost always made of many files, but often only one or a handful of them are executables (the equivalent of an .exe file on Windows).

  • Run ls -l in your / directory in a terminal. Note that /bin is a symbolic link pointing to /usr/bin; and /sbin points to /usr/sbin. Historically the bin directory contained binaries that anyone could execute; and sbin was only for the administrator. These days with the common use of sudo: all users have both directories in their path.
  • Run echo $PATH to see which directories are checked when you run a command.
  • Use ls -l to see what files are in the /usr/bin and the /usr/sbin directories. Combine that with the wc -l command to count how many files are in there.
  • Try to combine the ls and grep commands to find where the binary for the Chromium browser is. Note that almost all the binaries are all lowercase letters, and remember that filenames are case-sensitive on Linux.

Configuration files

Depending on the type of software you're talking about: there may be user-specific configuration files, system-wide configuration files, or both.

  • Use ls -a to see the hidden files in your home directory, and the .config subdirectory. These are configuration files for your user, for various software.
ListHomeConfigFiles.png
  • Now look at the /etc directory. These are system-wide configuration files.
ListEtc.png

Notice that some files are in both places, for example /etc/profile and ~/.profle. For some software the user's config file adds settings to the global config file; for other software the user's config file is the only one that's used if it exists.

Temporary files

/tmp is a system directory that's unusual in that any user can write to it. Software sometimes needs to write a file to disk while it's running, but it doesn't need that file to be saved. People also sometimes need to create a file (perhaps for testing something) which they don't need to stick around after they're done using it. The /tmp directory is the typical place to create such files.

Service data files

This is by no means universally true, but most often when a system service needs to save or read data: it uses the /var directory. Such data would normally go into a home directory, but services rarely have a directory under /home.

One place you'll often look when you're running into a problem is the /var/log directory, and on Linux Mint specifically: the /var/log/syslog file.

Later in the course we'll look at some othe files in /var.

Other directories

When it comes to directories there is some vague consistency between various applications/services but often you'll find that the directory or file you're looking for is not where you'd expect it to be. So you have to be ready to figure out and remember where the software you're working with keeps its files.