Build a web hosting business course - 03. Linux

26
Build a Web Hosting Business Mohamed Hafez http://seovortex.com

description

Build a web hosting business course – Linux. If you have any further questions about this topic or your personal situation, please do not hesitate to contact me: facebook.com/MHafez207

Transcript of Build a web hosting business course - 03. Linux

Page 1: Build a web hosting business course - 03. Linux

Build a Web Hosting Business

Mohamed Hafezhttp://seovortex.com

Page 2: Build a web hosting business course - 03. Linux

Session 3 Linux

Introduction to Linux and Command-Line Operation.

Page 3: Build a web hosting business course - 03. Linux

http://www.cs.ucr.edu/~weesan/cs183/

What is Unix?

▪ A multi-task and multi-user Operating System

▪ Developed in 1969 at AT&T’s Bell Labs by– Ken Thompson (Unix)– Dennis Ritchie (C)– Douglas Mcllroy (Pipes - Do one thing, do it well)

▪ Some other variants: System V, Solaris, SCO Unix, SunOS, 4.4BSD, FreeBSD, NetBSD, OpenBSD, BSDI

Page 4: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

What is Linux?

▪ Developed in 1991 by Linus Torvalds, a Finnish graduate student

▪ Inspired by and replacement of Minix

▪ Linus' Minix became Linux

▪ Consist of– Linux Kernel– GNU (GNU is Not Unix) Software– Software Package management– Others

Page 5: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

What is GNU?▪ The name “GNU” is a recursive acronym

for “GNU's Not Unix”; it is pronounced g-noo,

as one syllable with no vowel sound between the g and the n.

▪ The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system.

▪ GNU's kernel isn't finished, so GNU is used with the kernel Linux. The combination of GNU and Linux is the GNU/Linux operating system, now used by millions.

Page 6: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Page 7: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Which Linux Distribution is better?

▪ > 300 Linux Distributions– Slackware (one of the oldest, simple and stable distro.)– Redhat▪ RHEL (commercially support)▪ Fedora (free)

▪ CentOS (free RHEL, based in England)– SuSe ( based in German)– Gentoo (Source code based)– Debian (one of the few called GNU/Linux)– Ubuntu (based in South Africa)– Knoppix (first LiveCD distro.)– …

Page 8: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

FOSS

▪ Free Open Source Software

▪ Free – Means Liberty and not related to Price or cost

▪ Open – Source code is available and any body can contribute to the development. Organization independent

Page 9: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Kernel

▪ Core or nucleus of an operating system

▪ Interacts with the hardware

▪ First program to get loaded when the system starts and runs till the session gets terminated

▪ Different from BIOS which is hardware dependent.

▪ Kernel is software dependent

Page 10: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Shell

▪ Program that interacts with kernel

▪ Bridge between kernel and the user

▪ Command interpreter

▪ User can type command and the command is conveyed to the kernel and it will be executed

Page 11: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Types of Shell

▪ Sh – simple shell

▪ BASH – Bourne Again Shell

▪ KSH – Korne Shell

▪ CSH – C Shell

▪ SSH – Secure Shell

▪ To use a particular shell type the shell name at the command prompt.– Eg $csh – will switch the current shell to c shell

▪ To view the available shells in the system, type cat /etc/shells at the command prompt

▪ To view the current shell that is being used, type echo $SHELL at the command prompt.

Page 12: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

A shell is not an operating system. It is a way to interface with the operating system and run commands.

Page 13: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Linux Operating System

Page 14: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

GNU/Linux

▪ Only the kernel is called by the name Linux

▪ The rest are the tools developed under GNU Project

▪ Hence the name GNU/Linux

Page 15: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Linux Booting

GRUB GRUB stands for Grand Unified Bootloader. If you have multiple kernel images installed on your system, you can choose which one to be executed.

Page 16: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Linux Booting

Init Looks at the /etc/inittab file to decide the Linux run level. Following are the available run levels 0 – halt 1 – Single user mode 2 – Multiuser, without NFS 3 – Full multiuser mode 4 – unused 5 – X11 6 – reboot•  Init identifies the default initlevel from /etc/inittab and uses that to load all

appropriate program.•  Typically you would set the default run level to either 3 or 5.

Page 17: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Runlevel programs

 When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level. Depending on your default init level setting, the system will execute the programs from one of the following directories.

 Run level 0 – /etc/rc.d/rc0.d/ Run level 1 – /etc/rc.d/rc1.d/ Run level 2 – /etc/rc.d/rc2.d/ Run level 3 – /etc/rc.d/rc3.d/ Run level 4 – /etc/rc.d/rc4.d/ Run level 5 – /etc/rc.d/rc5.d/ Run level 6 – /etc/rc.d/rc6.d/

Page 18: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Features of Linux OS

▪ Multi user & Multi processMany people can use one machine at the same time.

▪ Files  and Process- Data, directory, process, hard disk etc (almost everything) are expressed as a file.- Process is an running program identified by a unique id (PID).

▪ Normal user and Super userIn Linux system, there is one special user for administrator, which can do anything.  This special user is called root or super user.

Normal User $ 

Super User  #    

Page 19: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Linux Directory Structure

Linux directory structure starts with / (root), files are put in a directory. All directories are in a hierarchical structure (tree structure).  User can put and remove any directories on the tree.  Top directory is “/”, which is called slash or root.

Page 20: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Important Directories

/bin This contains files that are essential for correct operation of the system. These are available foruse by all users./mnt Provides a location for mounting devices, such as remote file systems and removable media/home This is where user home directories are stored. /var This directory is used to store files which change frequently, and must be available to be written to./etc Various system configuration files are stored here./dev This contains various devices as files, e.g. hard disk, CD ROM drive, etc. /root This is the root (administrator) user's home directory /sbin Binaries which are only expected to be used by the super user. /tmp Temporary files. /boot Has the bootable Linux kernel and boot loader configuration files(GRUB) /usr Contains user documentation, games, graphical files, libraries

Page 21: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Basic Commands

man - format and display the on-line manual page Usage : man date

help - Display help for a built-in command Usage : date --help

info - information about the command info date

ls lists the content of directorylsls -l list the files with all informationls –a list files including hidden filesls –la long list with hidden files

Page 22: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Basic Commands

cd Change Directorycd /home/user/Absolute bath /home (absolute path: Relating to file systems, the location of a directory or file that can be accessed regardless of the current working location of a user) eg /home/user/mypicture.jpgRelative path The relative pathnames are opposite to absolute pathname. A reative pathname does not begin with a slash ( / ). Generally you specifies location relative to your current working directory.eg cd home/user/myfile.jpg,cd .. goes one directory backcd - return to the last directorycd ~ go to the current user's home directory

Page 23: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Basic Commands

mkdir Create one or more directoriesmkdir folder1 folder2mkdir -p work/junk/questions (mkdir -p Create intervening parent directories if they don't exist)

pwd Print the full pathname of the current working directory. See also the dirs shell command built intobash.pwd

cp Copy files/directoriescp file1 file2cp –vrf dirA dirB

Page 24: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Basic Commands

mv move files to another location or rename filesmv /home/user/myfile /home/Admin/myfilemv myfile your file

rm remove files/directoriesrm myfilerm -rf mydirectory (rmdir remove directory)

echo display a line of text echo "hello world" (displays hello world in command line)

Page 25: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Most Popular Text Processing Commands

catcat Read one or more files and print them on standard output.cat filename.txt (display the content of filename.txt)cat -n myfiles.txt number all output lines, starting with 1cat > newfile to exit, enter EOF (Ctrl-D)cat >> newfile to append the file

vi editorvi editor External Link 1 2 A screen-oriented text editor. Vi has two modes insert mode and command mode. The editor begins in command mode, where cursor movement and copy/paste commands may be issuedvi filename (creating or opening a filename)esc + i insert the text:wq Save and exit:q exit without save:wq! save and exit forcefully (! forcefully)

Page 26: Build a web hosting business course - 03. Linux

Build a Web Hosting Business - By: Mohamed Hafez

Thank you

Mohamed Hafezhttp://seovortex.com