22
pictesolutions 1 Lets Understand 1. Linux/Unix Introduction

Unix Linux Admin 1

Embed Size (px)

Citation preview

Page 1: Unix Linux Admin 1

pictesolutions 1

Lets Understand

1.      Linux/Unix Introduction

Page 2: Unix Linux Admin 1

pictesolutions 2

Linux/Unix Introduction:1

• Linux is a modern, flexible, and mature operating system. Although it started life on the Intel platform, it has since been ported to many other platforms such as Amiga, DEC Alpha, Apple Power PC, Sun workstations, and others.

• Linux boasts many other features:• Multitasking - Linux is a true preemptive multitasking operating system. All

processes run independently of each other and leave processor management to the kernel.

• Networking - Linux supports a multitude of networking protocols.• Interoperability - Linux can interoperate with Windows 9x/NT/NT 2000, Novell,

Mac, and most other versions of UNIX.• Multi-user - Linux can handle multiple users simultaneously logged on to one

machine.• Advanced memory management Traditional UNIX systems used swapping to manage

memory, where the entire memory structure of a program was written to disk when the system began running low on memory. Linux uses paging, a method that intelligently allocates memory, when system memory is running low, by prioritizing memory task

Page 3: Unix Linux Admin 1

pictesolutions 3

Linux/Unix Introduction:2

• Linux currently supports up to 64GB of RAM.• Multiple file systems Linux must be installed on Extended 2 Linux-

formatted partitions, but if certain other OS file systems already exist on the same host, Linux will support several of these file system formats as well, including DOS/Windows, OS/2, and Novell. This is just another interoperability feature provided by Linux.

Page 4: Unix Linux Admin 1

pictesolutions 4

2. Overview of Linux/Unix File System

Hierarchy Standard (FHS)

Unix/Linux Architecture

Page 5: Unix Linux Admin 1

pictesolutions 5

FHS• Red Hat is committed to the Filesystem Hierarchy Standard (FHS), a

collaborative document that defines the names and locations of many files and directories.

• The FHS document is the authoritative reference to any FHS-compliant file system, but the standard leaves many areas undefined or extensible. This section is an overview of the standard and a description of the parts of the file system not covered by the standard.

• Compliance with the standard means many things, but the two most important are compatibility with other compliant systems and the ability to mount a /usr/ partition as read-only because it contains common executables and should not be changed by users. Since the /usr/ directory is mounted read-only, it can be mounted from

the CD-ROM or from another machine via a read-only NFS mount

Page 6: Unix Linux Admin 1

pictesolutions 6

FHS Organization • The directories and files noted here are small subsets of those specified by

the FHS document. Refer to the latest FHS document for the most complete information.

• The /dev/ Directory• The /dev/ directory contains file system entries which represent devices

that are attached to the system. These files are essential for the system to function properly.

• The /etc/ Directory• The /etc/ directory is reserved for configuration files that are local to the

machine.• Below are some important files which resides under /etc/ directory:• /etc/passwd :- contains all the local user’s information• /etc/system :- it is a system configuration file which helps to boot the server.

Page 7: Unix Linux Admin 1

pictesolutions 7

FHS Organization

• The /lib/ Directory• The /lib/ directory should contain only those libraries that are needed

to execute the binaries in /bin/ and /sbin/. These shared library images are particularly important for booting the system and executing commands within the root file system.

• The /mnt/ Directory• The /mnt/ directory is for temporarily mounted file systems, such as

CD-ROMs and fioppy disks.• The /opt/ Directory• The /opt/ directory provides storage for large, static application

software packages. All the third party software/application will be installed under this directory.

Page 8: Unix Linux Admin 1

pictesolutions 8

Standard directories

/etc – the system administration utility files

/bin – most commonly used UNIX commands

/usr – System related files

/dev – all device files

/lib – library files for C compiler

/tmp – temporary storage/

etc bin usr dev lib tmp

Page 9: Unix Linux Admin 1

pictesolutions 9

FHS Organization

• The /proc/ Directory• The /proc/ directory contains special files that either extract

information from or send information to the kernel. Due to the great variety of data available within /proc/ and the many ways this directory can be used to communicate with the kernel

• The /sbin/ Directory• The /sbin/ directory is for executables used only by the root

user.• Local-only system administration binaries should be placed

into /usr/local/sbin."

Page 10: Unix Linux Admin 1

pictesolutions 10

FHS Organization

• The /var/ Directory• The FHS states /var/ is for: "...variable data files. This includes spool

directories and files, administrative and logging data, and transient and temporary files."

Page 11: Unix Linux Admin 1

pictesolutions 11

FHS Organization

• System log files such as messages/ and lastlog/ go in the /var/log/ directory. The /var/lib/rpm/ directory also contains the RPM system databases. Lock files go in the /var/lock/ directory, usually in directories particular for the program using the file. The /var/spool/ directory has subdirectories for various systems that need to store data files

Page 12: Unix Linux Admin 1

pictesolutions 12

FHS Organization

/usr/local/ in Red Hat Linux• In Red Hat Linux, the intended use for the /usr/local/ directory is

slightly different from that specified by the FHS. The FHS says that /usr/local/ should be where software that is to remain safe from system software upgrades is stored. Since system upgrades from under Red Hat Linux performed safely with the rpm command and graphical Package Management Tool application, it is not necessary to protect files by putting them in /usr/local/. Instead, the /usr/local/ directory is used for software that is local to the machine.

• For instance, if the /usr/ directory is mounted as a read-only NFS share from a remote host, it is still possible to install a package or

program under the /usr/local/ directory.

Page 13: Unix Linux Admin 1

pictesolutions 13

File Locations• Special File Locations• Red Hat Linux extends the FHS structure slightly to accommodate

special files. Most files pertaining to the Red Hat Package Manager (RPM) are kept in the /var/lib/rpm/ directory. The /var/spool/up2date/ directory contains files used by Red Hat Update Agent, including RPM header information for the system. This location may also be used to temporarily store RPMs downloaded while updating the system.

• Another location specific to Red Hat Linux is the /etc/sysconfig/ directory. This directory stores a variety of configuration information. Many scripts that run at boot time use the files in this directory.

• Finally, one more directory worth noting is the /initrd/ directory. It is

empty, but is used as a critical mount point during the boot process.

Page 14: Unix Linux Admin 1

pictesolutions 14

File Locations• The sysconfig Directory• The /etc/sysconfig/ directory is where a variety of system configuration

files for Red Hat Linux are stored. Here we will outline some of the files found in the /etc/sysconfig/ directory. The information here is not intended to be complete, as many of these files have a variety of

options that are only used in very specific or rare circumstances.

Page 15: Unix Linux Admin 1

pictesolutions 15

File Locations• Files in the /etc/sysconfig/ Directory• The following files are normally found in the /etc/sysconfig/ directory:• |- amd• |- apmd• |- arpwatch• |- authconfig• |- cipe• |- clock• |- desktop• |- dhcpd• |- firstboot• |- gpm• |- harddisks• |- hwconf• |- i18n

Page 16: Unix Linux Admin 1

pictesolutions 16

File Locations• |- identd• |- init• |- ipchains• |- iptables• |- irda• |- keyboard• |- kudzu• |- mouse• |- named• |- netdump• |- network• |- ntpd• |- pcmcia• |- radvd• |- rawdevices

Page 17: Unix Linux Admin 1

pictesolutions 17

File Locations• |- redhat-config-securitylevel• |- redhat-config-users• |- redhat-logviewer• |- samba• |- sendmail• |- soundcard• |- spamassassin• |- squid• |- tux• |- ups• |- vncservers• |- xinetd• Note: If some of the files listed are not present in the /etc/sysconfig/

directory, then the corresponding program may not be installed.

Page 18: Unix Linux Admin 1

pictesolutions 18

3. Linux/Unix Resource Monitoring

Page 19: Unix Linux Admin 1

pictesolutions 19

Resource Monitoring

• Resource Monitoring Commands• Red Hat Linux comes with a variety of resource monitoring tools. While

there are more than those listed here, these tools are representative in terms of functionality. The tools are:

• top (and GNOME System Monitor, a more graphically oriented version of top)

• vmstat• The sysstat suite of resource monitoring tools• Let us look at each one in more detail.• free• The free command displays system memory utilization.

Page 20: Unix Linux Admin 1

pictesolutions 20

Resource Monitoring• top• While free displays only memory-related information, the top

command does a little bit of everything. CPU utilization, process statistics, memory utilization — top does it all. In addition, unlike the free command, top's default behavior is to run continuously; there is no need to use the watch command.

• The display is divided into two sections. The top section contains information related to overall system status —uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space. The lower section displays process-level statistics, the exact nature of which can be controlled while top is running.

Page 21: Unix Linux Admin 1

pictesolutions 21

Resource Monitoring• vmstat• For a more concise view of system performance, try vmstat. Using this

resource monitor, it is possible to get an overview of process, memory, swap, I/O, system, and CPU activity in one line of numbers:

Page 22: Unix Linux Admin 1

pictesolutions 22

Resource Monitoring• pstree• Gives a hierarchical structure of all currently running processs: