In part 1 of our series on the basics of Linux, we learned how to download Linux, whether you should use the CLI or the GUI, how to get a SSH client, how to login to Linux, and how to get help.
In part 2 of our series, we learned how to know what type of Linux you are using and how to navigate the Linux file system.
In this final post in the series, you’ll learn about Linux files, Linux permissions, Linux package management, and how to install applications in Linux.
Files and permissions
Let’s say that a user named “david” was denied access to the file /var/log/syslog. The reason for that is likely the user “david” doesn’t have permission to access to the file.
You can see this if you execute ls -l /var/log/syslog:
david@debian:~$ ls -l /var/log/syslog
-rw-r----- 1 root adm 9074 May 15 10:17 /var/log/syslog
The file is owned by the user “root” and the group “adm”. The file permissions are “rw” (shorthand for read/write) for the owner and “r” (shorthand for “read”) for the group with no permissions for anyone else. The graphic below shows how file permissions work in Linux.
In the file permissions graphic, above, a “d” on the left tells you whether you are looking at a directory (or folder). Then the three sets of permissions “rwx, r-x, r-x” say whether you can read, write and execute (or start the application) at the user level, the group level and the “everyone else” level (others). The type indicator identifies the selected object as a directory, hence the “d” as the type. The two most important types of objects in the Linux file system are directories (“d”) and files (“-”). There are other possible types as well, but to keep this post relatively short, we’ll stick with directories and files, for now.
Linux package management
A Linux package management system is a tool that helps Linux administrators install and manage applications and extensions for the Linux operating system. Each Linux distribution carries its own package management capabilities. A Linux package includes all the bits necessary for a new application or service to operate. The package management system can also help an administrator address any dependencies that a package may have. A dependency is a software package necessary for another package to operate. By layering these dependencies, newly developed packages can then leverage the work of others without having to constantly reinvent the wheel. However, maintaining dependencies can be difficult, particularly as you continue to add packages. A good package management system will ensure that all dependencies are handled at the same time that you install new packages.
How do I install applications?
Before you start installing new applications or services, you should typically ensure that you have the list of the most recent versions of available packages from the update repository. This command doesn’t actually update any software, but it does make sure you’re looking at a list of currently available package versions.
You can update the list of packages that are available to you with apt update, like this:
david@debian:/opt$ sudo apt update(output truncated)
Ign http://ftp.us.debian.org jessie InRelease
Get:1 http://ftp.us.debian.org jessie-updates InRelease [145 kB]
Get:2 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:3 http://ftp.us.debian.org jessie Release.gpg [2,373 B]
Then, install a package with apt install, like this:
david@debian:~$ sudo apt install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2-doc apache2-suexec-pristine apache2-suexec-custom
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/208 kB of archives.
After this operation, 361 kB of additional disk space will be used.
Selecting previously unselected package apache2.
(Reading database ... 137657 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.10-10+deb8u8_i386.deb ...
Unpacking apache2 (2.4.10-10+deb8u8) ...
Processing triggers for man-db (220.127.116.11-5) ...
Processing triggers for systemd (215-17+deb8u7) ...
Setting up apache2 (2.4.10-10+deb8u8) …
In the above example, we used apt install to install the Apache web server. To verify that a package is installed correctly (and that you installed what you think you installed), you can use apt show:
david@debian:~$ apt show apache2
Installed-Size: 361 kB
Maintainer: Debian Apache Maintainers <firstname.lastname@example.org>
Replaces: apache2.2-common, libapache2-mod-macro (<< 1:2.4.6-1~)
Provides: httpd, httpd-cgi
Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.10-10+deb8u8), apache2-utils (>= 2.4), apache2-data (= 2.4.10-10+deb8u8)
Pre-Depends: dpkg (>= 1.17.14)
Suggests: www-browser, apache2-doc, apache2-suexec-pristine | apache2-suexec-custom
Conflicts: apache2.2-common (<< 2.3~)
Breaks: libapache2-mod-macro (<< 1:2.4.6-1~)
Tag: role::metapackage, suite::apache
Download-Size: 208 kB
APT-Sources: http://ftp.us.debian.org/debian/ jessie/main i386 Packages
Description: Apache HTTP Server
The Apache HTTP Server Project's goal is to build a secure, efficient and
extensible HTTP server as standards-compliant open-source software. The
result has long been the number one web server on the Internet.
Installing this package results in a full installation, including the
configuration files, init scripts and support scripts.
You can see that the Apache 2.4.10 web server was installed, and it says that this package results in a full installation; however, it also suggests that we install the apache-doc (for documentation) and www-browser (to act as our HTTP client/ web browser) packages.
We hope that you’ve enjoyed our 3-part series “Getting started with Linux – the basics”! Want to learn more about Linux in the data center? Download the full ebook titled “The Gorilla Guide to… Linux Networking 101” or visit our learn section for more information!