Here, we came a long way because Linux and Internet was shared by someone for free. Keep spirit of sharing alive. ___________________________This blog is a Personal Repository for Linux/Windows server administration notes.
Wednesday, August 21, 2013
Zend Forums • View topic - Guard Loader vs. Zend Optimizer
http://forums.zend.com/viewtopic.php?f=57&t=20753
Nginx
http://www.unixmen.com/install-nginx-with-php-and-mysql-in-centos-6-4-rhel-6-4/
http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/
http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/
http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/
http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/
RHCE preassessment test
www.mhprofessional.com/downloads/products/0071765654/0071765654_preassess.pdf
Training Docs - Part II
Notes taken in live session :
·
Thegeekstuff.com
·
Boot process : power on – BIOS –Post-MBR-GRUB-init-runlevel
·
Oracle VM – VirtualBox Manager
·
RPM
·
File system and file structure
·
LILO /boot/lilo/lilo.conf or /etc/lilo.conf
·
Linux flavours
·
Types of architecture : 86, X86, etc.
·
Runlevels :
0.
Halt – to shutdown
1.
Single usesr = for system administration purpose
2.
Multiuser without NFS
3.
Multiuser with NFS
4.
User-defined
5.
X11 – GUI
6.
Reboot
Examples, User-defined runlevels : LIC and
Railway information terminals
Command to check runlevel : runlevel
·
whoami – to see your login username
·
arch – to check architecture
·
cat /etc/redhat-release – to see OS version in
centos/fedora
debian – cat /etc/lsb-release
ubuntu—cat /etc/lsb-release
·
mount – to see file version
·
/etc/SUSE-release – for SUSE release
·
linux is case sensitive and windows is not.
·
/etc/inittab
id:3:initdefault
·
Windows swap memory is called as virtual memory
·
Swap partition is the portion of the hard drive
that linux uses as virtual memory.
It should be double the size of RAM.
free –m
·
Psuedo file system
·
CentOS Community
Enterprise OS
·
OS installation :
1.
Install or upgrade
2.
media test
3.
language – US-EN
4.
types of devices
5.
configure network : Hostname
6.
time zone
7.
root password
8.
type of installation : create custom layout
9.
select a device : click create button
device - size(Mb) - mountpont/rain/volume – type – front
10.
Install boot loader
11.
………………Select Basic server
·
Assigning Server IP :
cat /etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR =
NETMASK =
you can define gateway in this file, but
standard location is as below
/etc/sysconfig/network --- to define
network gateway and hostname
HOSTNAME =
GATEWAY =
/etc/resolve.conf --- to assign nameservers
nameserver = 8.8.8.8
nameserver = 4.2.2.2
service network restart
setup ---- command to set network, etc.
setup >> network configuration
>> device configuration >> eth0
·
HARD DISK STRUCTURE :
4(four) hard drives can be connected to a
system
1.
Primary Master – sda
2.
Primary Slave – sdb
3.
Secondary Master – sdc
4.
Secondary slave – sdd
·
fdisk –l
·
difference between sda and had :
sda ----- SCSI and SATA
sda ------IDE
SCSI – small computer system Interface
SATA ---
IDE --- integrated development environment
·
Steps to attach secondary hard disk :
1.
DC will add hard disk
2.
fdisk –l
------command to see how many harddisks are attached
3.
fdisk /dev/sdb ======== to identify HDD
n
p
1
enter
enter
w
4.
fdisk –l It should show /dev/sdb1
5.
mkfs .ext4 /dev/sdb1 --------------to format HDD
(make file system)
6.
mount /dev/sdb1 /mnt (temporary mounting)
7.
umount /mnt (to unmount)
8.
another example, mkdir backup and
then mount /dev/sdb1 /backup
·
To devide a new hard disk in two parts :
fdisk –l
fdisk /dev/sdb
n
p
2
enter
enter
w
fdisk –l
.
.
.
.
·
To make permanent mounting :
vi /etc/mtab
vi /etc/fstab
mount command shows information as per mtab
·
fstab
·
How to change hostname ?
hostname abc.xyz.com
to make permanent hostname change, edit
/etc/sysconfig/network
and
add entry in
vi /etc/hosts
entry to be added : 117.239.185.135 abc.xyz.com
hostname –i
·
Cpanel installation :
on debian OS it is not possible
cpanel runs on following OS only
centos 4,5,6
redhat 4,5,6
free bsd 7.3 7.4 8.0 8.1 8.2
cloudlinux 5 6
generally speaking 50gb hdd and 2gb RAM is
good for cpanel.
·
cat proc/cpuinfo |grep processor
·
cat /proc/meminfo
·
cd /home
wget –N …………………….latest
sh latest
·
server password and cpanel/whm password will
always be same and cannot be different.
·
HOMEWORK
fstab
Pseudo file system
CentOS Community
Enterprise OS
·
/etc/fstab
fstab
is a configuration file that contains information of all the partitions and
storage devices in your computer.
The fstab (/etc/fstab) (or file systems table) file is a system configuration
file commonly found on Unix systems. It is part of the util-linux package. The fstab file typically
lists all available disks and disk partitions,
and indicates how they are to be initialized or otherwise integrated into the
overall system's file system. fstab is still used for basic system
configuration, notably of a system's main hard drive and startup file system,
but for other uses has been superseded in recent years by automatic mounting.
The fstab file
is most commonly used by the mount command, which reads the fstab file to determine which
options should be used when mounting the specified device. It is the duty of
the system administrator
to properly create and maintain this file.
# device name -- mount point -- fs-type
-- options -- dump-freq -- pass-num
LABEL=/ / ext4 defaults 1 1
/dev/sda6 swap swap defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
The columns are as follows:
- The device name or other means of locating the partition or data source.
- The mount point, where the data is to be attached to the filesystem.
- The filesystem type, or the algorithm used to interpret the filesystem.
- Options, including if the filesystem should be mounted at boot.
- dump-freq adjusts the archiving schedule for the partition (used by dump).
- pass-num Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be either 2 (to check after root) or 0 (to disable checking for that partition altogether).
defaults Uses the
default options that are rw, suid, dev, exec, auto, nouser, and async.
A
value of zero in either of the last 2 columns disables the corresponding
feature. For the whitespace character in paths the character code
"\040" is used.
Refer
: http://www.tuxfiles.org/linuxhelp/fstab.html
Pseudo file system
The /proc directory on GNU/Linux systems provides a
file-system like interface to the kernel. This allows applications and users to
fetch information from and set values in the kernel using normal file-system
I/O operation.
The proc file system is
sometimes referred to as a process information pseudo-file system. It does not
contain ``real'' files but rather runtime system information (e.g. system
memory, devices mounted, hardware configuration, etc). For this reason it can
be regarded as a control and information center for the kernel. In fact, quite
a lot of system utilities are simply calls to files in this directory. For
example, the command lsmod, which lists the modules loaded by the kernel, is
basically the same as 'cat /proc/modules' while lspci, which lists devices
connected to the PCI bus of the system, is the same as 'cat /proc/pci'. By altering
files located in this directory you can change kernel parameters while the
system is running.
CentOS Community Enterprise OS
free, open source
uses code of Redhat
community support
Training docs - part I
Linux filesystem
structures and understand the meaning of individual high-level directories.


1. / – Root
§ Every single file and directory starts from
the root directory.
§ Only root user has write privilege under this
directory.
§ Please note that /root is root user’s home
directory, which is not same as /.
2. /bin – User
Binaries
§ Contains binary executables.
§ Common linux commands you need to use in
single-user modes are located under this directory.
§ Commands used by all the users of the system
are located here.
§ For example: ps, ls, ping, grep, cp.
3. /sbin – System
Binaries
§ Just like /bin, /sbin also contains binary
executables.
§ But, the linux commands located under this
directory are used typically by system aministrator, for system maintenance
purpose.
§ For example: iptables, reboot, fdisk,
ifconfig, swapon
4. /etc –
Configuration Files
§ Contains configuration files required by all
programs.
§ This also contains startup and shutdown shell
scripts used to start/stop individual programs.
§ For example: /etc/resolv.conf,
/etc/logrotate.conf
5. /dev – Device Files
§ Contains device files.
§ These include terminal devices, usb, or any
device attached to the system.
§ For example: /dev/tty1, /dev/usbmon0
6. /proc – Process
Information
§ Contains information about system process.
§ This is a pseudo filesystem contains
information about running process. For example: /proc/{pid} directory contains
information about the process with that particular pid.
§ This is a virtual filesystem with text
information about system resources. For example: /proc/uptime
7. /var – Variable
Files
§ var stands for variable files.
§ Content of the files that are expected to grow
can be found under this directory.
§ This includes — system log files (/var/log);
packages and database files (/var/lib); emails (/var/mail); print queues
(/var/spool); lock files (/var/lock); temp files needed across reboots
(/var/tmp);
8. /tmp – Temporary
Files
§ Directory that contains temporary files
created by system and users.
§ Files under this directory are deleted when
system is rebooted.
9. /usr – User
Programs
§ Contains binaries, libraries, documentation,
and source-code for second level programs.
§ /usr/bin contains binary files for user
programs. If you can’t find a user binary under /bin, look under /usr/bin. For
example: at, awk, cc, less, scp
§ /usr/sbin contains binary files for system
administrators. If you can’t find a system binary under /sbin, look under
/usr/sbin. For example: atd, cron, sshd, useradd, userdel
§ /usr/lib contains libraries for /usr/bin and
/usr/sbin
§ /usr/local contains users programs that you
install from source. For example, when you install apache from source, it goes
under /usr/local/apache2
10. /home – Home
Directories
§ Home directories for all users to store their
personal files.
§ For example: /home/john, /home/nikita
11. /boot – Boot
Loader Files
§ Contains boot loader related files.
§ Kernel initrd, vmlinux, grub files are located
under /boot
§ For example: initrd.img-2.6.32-24-generic,
vmlinuz-2.6.32-24-generic
12. /lib – System
Libraries
§ Contains library files that supports the
binaries located under /bin and /sbin
§ Library filenames are either ld* or lib*.so.*
§ For example: ld-2.11.1.so, libncurses.so.5.7
13. /opt – Optional
add-on Applications
§ opt stands for optional.
§ Contains add-on applications from individual
vendors.
§ add-on applications should be installed under
either /opt/ or /opt/ sub-directory.
14. /mnt – Mount
Directory
§ Temporary mount directory where sysadmins can
mount filesystems.
15. /media – Removable
Media Devices
§ Temporary mount directory for removable
devices.
§ For examples, /media/cdrom for CD-ROM;
/media/floppy for floppy drives; /media/cdrecorder for CD writer
16. /srv – Service
Data
§ srv stands for service.
§ Contains server specific services related
data.
§ For example, /srv/cvs contains CVS related
data.
Linux
supports numerous file system types
§ Ext2: It has the concepts of
blocks, inodes and directories.
§ Ext3: It is ext2 filesystem
enhanced with journalling capabilities. Journalling allows fast file system
recovery.
§ Isofs (iso9660): Used by
CDROM file system.
§ Sysfs: It is a ram-based
filesystem initially based on ramfs. It is use to exporting kernel objects so
that end user can use it easily.
§ Procfs: The proc file system
acts as an interface to internal data structures in the kernel. It can be used
to obtain information about the system and to change certain kernel parameters
at runtime using sysctl command.
ext2, ext3 and ext4 are all
filesystems created for Linux. This article explains the following:
§ High level difference between
these filesystems.
§ How to create these
filesystems.
§ How to convert from one
filesystem type to another.
Ext2
§ Ext2 stands for second
extended file system.
§ It was introduced in 1993.
Developed by Rémy Card.
§ This was developed to
overcome the limitation of the original ext file system.
§ Ext2 does not have journaling
feature.
§ On flash drives, usb drives,
ext2 is recommended, as it doesn’t need to do the over head of journaling.
§ Maximum individual file size can
be from 16 GB to 2 TB
§ Overall ext2 file system size
can be from 2 TB to 32 TB
Ext3
§ Ext3 stands for third
extended file system.
§ It was introduced in 2001.
Developed by Stephen Tweedie.
§ Starting from Linux Kernel
2.4.15 ext3 was available.
§ The main benefit of ext3 is
that it allows journaling.
§ Journaling has a dedicated
area in the file system, where all the changes are tracked. When the system
crashes, the possibility of file system corruption is less because of
journaling.
§ Maximum individual file size
can be from 16 GB to 2 TB
§ Overall ext3 file system size
can be from 2 TB to 32 TB
§ There are three types of
journaling available in ext3 file system.
§ Journal – Metadata and
content are saved in the journal.
§ Ordered – Only metadata is
saved in the journal. Metadata are journaled only after writing the content to
disk. This is the default.
§ Writeback – Only metadata is
saved in the journal. Metadata might be journaled either before or after the
content is written to the disk.
§ You can convert a ext2 file
system to ext3 file system directly (without backup/restore).
Ext4
§ Ext4 stands for fourth
extended file system.
§ It was introduced in 2008.
§ Starting from Linux Kernel
2.6.19 ext4 was available.
§ Supports huge individual file
size and overall file system size.
§ Maximum individual file size
can be from 16 GB to 16 TB
§ Overall maximum ext4 file
system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB
(terabyte).
§ Directory can contain a
maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
§ You can also mount an
existing ext3 fs as ext4 fs (without having to upgrade it).
§ Several other new features
are introduced in ext4: multiblock allocation, delayed allocation, journal
checksum. fast fsck, etc. All you need to know is that these new features have
improved the performance and reliability of the filesystem when compared to
ext3.
§ In ext4, you also have the
option of turning the journaling feature “off”.
#######################################################
/etc/shadow file stores actual password in encrypted
format for user's account with additional properties related to user password
i.e. it stores secure user account information. All fields are separated by a
colon (:) symbol. It contains one entry per line for each user listed in /etc/passwd file Generally, shadow file entry looks as
follows (click to enlarge image):
/etc/shadow file fields
(Fig.01: /etc/shadow file fields)
1.
User name : It is your
login name
2.
Password: It your
encrypted password. The password should be minimum 6-8 characters long
including special characters/digits
3.
Last password change
(lastchanged): Days since Jan 1, 1970 that password was last changed
4.
Minimum: The minimum
number of days required between password changes i.e. the number of days left
before the user is allowed to change his/her password
5.
Maximum: The maximum
number of days the password is valid (after that user is forced to change
his/her password)
6.
Warn : The number of
days before password is to expire that user is warned that his/her password
must be changed
7.
Inactive : The number of
days after password expires that account is disabled
8.
Expire : days since Jan
1, 1970 that account is disabled i.e. an absolute date specifying when the
login may no longer be used
The last 6 fields
provides password aging and account lockout features (you need to use chage
command to setup password aging). According to man page of shadow - the
password field must be filled. The encrypted password consists of 13 to 24
characters from the 64 character alphabet a through z, A through Z, 0 through
9, \. and /. Optionally it can start with a "$" character. This means
the encrypted password was generated using another (not DES) algorithm. For
example if it starts with "$1$" it means the MD5-based algorithm was
used
A. /etc/passwd file stores essential information,
which is required during login i.e. user account information.
/etc/passwd is a text
file, that contains a list of the system's accounts, giving for each account
some useful information like user ID, group ID, home directory, shell, etc. It
should have general read permission as many utilities, like ls use it to map
user IDs to user names, but write access only for the superuser (root).
Understanding fields in /etc/passwd
The /etc/passwd contains
one entry per line for each user (or user account) of the system. All fields
are separated by a colon (:) symbol. Total seven fields as follows.
Generally, passwd file
entry looks as follows (click to enlarge image):
1.
Username: It is used when user logs in. It should be
between 1 and 32 characters in length.
2.
Password: An x character indicates that encrypted
password is stored in /etc/shadow file.
3.
User
ID (UID): Each user must be
assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are
reserved for other predefined accounts. Further UID 100-999 are reserved by
system for administrative and system accounts/groups.
4.
Group
ID (GID): The primary group ID
(stored in /etc/group file)
5.
User
ID Info: The comment field. It
allow you to add extra information about the users such as user's full name,
phone number etc. This field use by finger command.
6.
Home
directory: The absolute path to
the directory the user will be in when they log in. If this directory does not
exists then users directory becomes /
7.
Command/shell: The absolute path of a command or shell
(/bin/bash). Typically, this is a shell. Please note that it does not have to
be a shell.
Subscribe to:
Comments (Atom)