One 、Linux System Overview
Linux The system is called windows Different platform system of the system
Different platforms are two systems under different platform modes
○ Have a good command of Windows Installation and configuration of the operating system
○ Have a good command of Windows Installation and configuration of common services
○ Familiar with network architecture and common protocol usage
○ Network architecture
○ The concept and purpose of the agreement
○ Windows Common services under (WWW、FTP、SMTP、DNS、POP3 etc. )
The construction of experimental environment , need linux
linux It's also called network operating system , Need to be very familiar with network architecture
The operating system of the server behind Baidu must be linux operating system
Only linux When it comes to operating systems , To be more stable
windows There's a graphical interface ,win+R Open the run window ,cmd What's open is windows Command line interface
operation linux It depends on the text environment , There is no graphical interface , It's all orders
The biggest advantage of command line mode is No GUI , So the operating environment is more stable , Faster
CentOS7 It's in the enterprise , The system with the most servers ; No need for extra computers ,Vmware Virtual machine
Two 、Linux Origin and development （ One ）
Linux Origin and development
> UNIX System introduction
C Language is called universal language ,C Language development UNIX System
Linux Namely Unix A replica of ,unix Itself is B Language Business Software , It is generally used on the server of bank class
For example, the system background of ICBC is unix operating system
unix Good stability , Fast
If you test a bank project , It's more likely that IBM
> UNIX System introduction
○ IBM Of AIX
○ HP Of HP-UX
○ SUN Of Solaris
○ SGI Of IRIX
SUN and SGI There are quite a lot of them abroad
Insurance and other industries HP More
> Classification of software
○ Public software ： The original author has given up his rights 、 Copyright expired 、 Or software whose author is no longer available , There are no restrictions on its use . In the early , Public software is understood as free and free to use , But in fact, the correct understanding of public software is “ No copyright ” (Not Copyrighted) .
○ Proprietary software ： Also known as proprietary software , This kind of authorization usually does not allow users to copy at will 、 Research 、 Modify or distribute the software , Violation of such authorization usually carries serious legal liability .
○ Business software ： Commercial software is developed by commercial companies , Make a profit by charging royalties . Commercial and exclusive ( private ) It's not the same thing , Most business software is proprietary , But it could also be commercial free software .
○ shareware ： The trial version is usually available and used free of charge , But it will be limited in function or use period . Developers will encourage users to pay for a fully functional commercial version . For most shareware , No source code .
○ Open source software ： The source code of software is completely open to anyone .
○ The free software ： Such licensing is the opposite of proprietary software , Give users replication 、 Research 、 The right to modify and distribute the software , And provide source code for users to use freely .
Software without copyright is public software
Business software is private software , such as windows System , You need to buy a serial number , This is business software
Linux Namely Open source free Software for , That's why more companies are willing to use Linux One of the reasons for the operating system
3、 ... and 、Linux Origin and development （ Two ）
Linux Origin and development
> Free software and Linux
○ stay 1984 Founded the free software foundation (Free Software Foundation, FSF) .
○ GNU plan , Published GNU GPL Statement . According to the statement , be-all GNU Software can be downloaded by anyone 、 sell 、 Copy and modify , But you have to provide the source code or let the user know where to get the source code .
○ What is? Linux?
○ Linux It's a compliance POSIX(Portable Operating System Inter-face of Unix, Portable operating system interface )
○ follow GPL Statement (GNU General Public License, namely GNU General public permit )
○ OpenSUSE、Fedora、Ubuntu、Debian、Slackware Linux、Gentoo Linux、Red Flag、Red Hat、Open Linux、 Create open source together 、 xinhua 、 Just in time
○ Linux And UNIX The difference is that the idea of the former comes from UNIX, But the source code is similar to UNIX The code is irrelevant , It's just a successful imitation UNIX The system function and operation style of , And the source code is open , and UNIX Is the source code implementation of property rights protection of commercial software , The core code is not public .
○ Linux Fully compatible with UNIX System
○ stay Linux You can run most of the UNIX Program .
○ Linux Range of application
○ Scientific Computing
○ Network server
○ Animation design
linux Application scope of , Scientific Computing , Artificial intelligence , Big data servers are linux
There will be a server behind the website , These web servers are linux System
> Linux It can run on a personal computer
○ Linux Can be based on Intel 386/486、PentiumPro、Pentium MMX、Pentium System processors and Cyrix、AMD Compatible chips run on personal computers .
Linux Can read the source code , Do secondary development , You can continue to distribute its program
Linux It can be big or small , Big enough to be a server , As small as a chip
Android The kernel of is Linux
Four 、Linux Origin and development （ 3、 ... and ）
Linux Origin and development
> Free software and Linux
○ Linus Torvalds( Linus . Joe watts )
○ 1991 year 10 month 5 It was announced that a similar Unix A small operating system for
○ 1992 year 3 The official 1.0 edition
○ Linux What is it? ?
○ Linux It's a kind of UNIX Cloning of the operating system , it ( The kernel of ) from Linus Torvalds Together with the loosely organized hacker team on the Internet, it was written from scratch .Linux Our goal is to keep and POSIX Compatibility .
Linux and POSIX Compatibility , send linux It has very good portability
> Linux The history of
○ Linux The birth and development of the five pillars
○ UNIX operating system
○ Minix operating system
○ GNU plan
○ POSIX standard
○ Internet The Internet
Linux From Unix;Linus The first version of the system was called Minix;GNU The plan is completely free ; Interface part POSIX standard ;Linux yes Linux and An operating system developed by a loose network of hackers , therefore , No, Internet The Internet , There will be no Linux
therefore Linux There's a community version , It refers to the version generated by programmers in the network community , It's completely free ; The Internet drives linux The development of
> common Linux Version of
○ SUSE Linux ○ Turbo Linux ○ Dedian Linux ○ SlackWare Linux ○ RedHat Linux
> Chinese version ：
○ The red flag Linux ○ Xteam Linux ○ Blue dot Linux
Individual Linux System ubuntu There are many versions ; redhad Version is generally used as a server system ,CentOS Also comes from RedHat, It's just a completely free version ,RedHat It's gradually starting to use service fees
> Linux Characteristics
○ The freedom of software
○ system stability
○ System security ( Because it's a product developed by hackers )
○ Strong platform scalability ( It can be installed on the server , It can be installed on the chip of mobile phone )
○ True multitasking, multiuser (linux Altogether 6 individual terminal , Every terminal can receive 255 Users )
○ Powerful network function
○ Powerful development capabilities
○ It's completely in line POSIX standard
5、 ... and 、VMware Virtual machine installation
Linux Basic knowledge of
○ Technically speaking Linux It's a kernel .“ kernel ” It refers to a hardware abstraction layer 、 Disk and file system control 、 Multi task and other functions of the system software . A kernel is not a complete operating system . A set of based on Linux The complete operating system of the kernel is called Linux operating system , or GNU/Linux(Linux Distribution version )
> The kernel version number consists of
○ use major.minor.patch( Main version . Next version . The revision ) The number format of
○ minor The odd number represents the development version , Such as 2.5.1
○ minor Even number means stable version , Such as 2.6.1
> Kernel source code acquisition
6、 ... and 、 Preliminary use Linux
Preliminary use Linux
> Sign in Linux
○ Linux There are two types of user interfaces ： Character interface and graphic interface . Character interface , You have to enter a command to use ; The graphical interface can be operated with the mouse , It's very intuitive and convenient for workstations .
The character interface is also called the text interface , Text or characters , Can't operate with mouse , It can only be operated by keyboard
stay CentOS in , Right click to open the terminal
> Launch graphical interface
○ If you want to operate in a graphical interface Linux, You can enter... After logging in to the character interface :
○ init 5
init 5 It's a command to start GUI mode
Now I want to launch the text interface , use init 3
@ In front of the symbol root Represents the current user
@ After the symbol localhost It represents our computer name
# The well number represents Log in to System administrator identity
Input init 5 Back to the graphical interface
Input again init 3 Enter the text interface , And use Ordinary users Sign in
> The interface and use after login
○ Right click in the blank space on the desktop , choice “ Open the terminal ” command
> The graphical interface returns to the character interface
○ stay “ terminal ” Enter the command in the window ：init 3
> Restart the computer
○ init 6
shutdown -r now
shutdown -r Minutes of delay “ Restart the reminder ”
init 6 originate init 3 init 6 It's the lowest order , It is not recommended to use too much , Because it may cause problems in the system
reboot Is also called init 6 But is in init 6 And an interface is added to it （ Shell ）
shutdown -r now -r It means restart now On behalf of the now
ctrl + C Cancel the order , End waiting
If you restart now , It is best to reboot; If you want to restart regularly , Just choose shutdown
> Turn off the computer
○ init 0
shutdown -h now (now Means to execute immediately )
shutdown -h Minutes of delay “ Prompt information ”
To turn it off , commonly poweroff More commonly used ,shutdown -h now -h It means shut down now On behalf of the immediate start
shutdown -h +5 It's for five minutes
Too many orders , Rebooting can stabilize your system
○ Timed shutdown
If you're ready 5 There are other commands to execute after the shutdown , Or you want to put the command of timing shutdown in the background , be ：
shutdown -h +5 &
Then press enter several times , You can continue to use the terminal to perform other operations . If you want to terminate the above 5 minute To turn it off , be
If it's just timing 5 Turn it off in minutes , And no other command is executed , directly ：
shutdown -h+ 5
here , If you want to cancel the timed shutdown , Then press Ctrl+C Mandatory termination order .
Hope that in 20:13 Turn off the computer ：
shutdown -h 20:13
adopt shutdown -h +5 & After running in the background , If you want to stop ,ctrl+C It 's no use , Can pass shutdown -c The way to stop , End the five minute shutdown command
& Representatives go backstage
7、 ... and 、Linux File and directory structure
Linux File and directory structure
○ A file is a collection of related records .Linux The files in are unstructured character streams , That is, any two bytes in the file are completely independent . Files are identified and referenced by file names , Every file in the system has a file name .Linux in , except / Can't appear in the file name , The rest of the characters are OK . If special characters are used in the file name , It can be used \ escape .Linux The maximum length of a file name in depends on the file system ,ext3 Under the maximum support 255 Characters , Chinese maximum support 127 individual .
CentOS Namely The biggest support 255 Characters , Chinese maximum support 127 individual .
> Linux Documents can generally be divided into ordinary documents 、 Device file 、 Pipeline files 、 Link to the file 、 Catalog files, etc , This book only introduces the following three
○ Ordinary documents ： For storing data 、 Program and other information files . They are usually stored in external memory for a long time ( disk 、 Tape, etc ) in , Ordinary files are generally divided into text files and binary files .
○ Device file ： Used with I/O A file that provides a connection , It is divided into character device file and block device file , Corresponding to character devices and block devices .Linux Put the device's I/O The operation is the reading and writing of ordinary files , Each of these I/O The device corresponds to a device file , Store in /dev Directory , Like the first one SCSI The hard disk corresponds to /dev/sda, The first floppy disk drive corresponds to /dev/fd0, Line printers correspond to /dev/lp etc. .
linux It's not like windows So you can read it directly to the hard disk or hardware ,linux All the hardware is stored in the computer in the form of files ; Device files are actually our hardware information
○ Directory file ： It is a file composed of directory entries contained in a directory in the file system . The directory file only allows the system to modify . User processes can read directory files , But they can't be modified . Two special directory entries “.” Represents the directory itself ,“..” Represents the parent directory .
○ If there are too many files, there will be chaos , So you need a directory . A directory is a collection of related files , Be similar to Windows Folder in . The catalog also has its own name . In addition to being able to put files in a directory , You can also store directories , It's called a subdirectory of this directory . This subdirectory can also have its own subdirectory , And so on to form a tree structure . The top directory is called the root directory , All the directories in the system are subdirectories of the root directory .
windows My folder is in linux It's called Catalog ; Travel abroad , The clothes you bring are documents , The trunk is the catalog
The problem directory solves is to avoid file confusion
○ After entering the GUI , Double click... On the desktop “ Computer ” One >“ file system ”
Click to enter , The files you see , These directories are the contents of the root folder ;
dev All the hardware products in the current computer are saved in , The files inside don't need to be studied
etc Is a directory ,rc.d Is subdirectory
> / The root file system
> /boot： Start Directory , Where the kernel is stored
> /tmp： Temporary documents generated by the program
> /home： User's directory
> /lib： The library files
> /bin： Executable files and commands
> /sbin： System administrator's commands and tools
> /usr： Where the user's applications and files are installed
> /mnt： Personal Edition 9.0, Attach another disk or partition
> /media： Enterprise Edition 5.6, Attach another disk or partition
> /lost+found： Lost files retrieved for file system repair
> /selinux： Deposit SELinux File system instance
> /proc Catalog ： adopt /proc The files in the directory can get the current running information of the system （ such as CPU Memory The Internet Etc ）
linux The kernel of is in /boot in ,linux Source code It's all in it , It can be used for self research
Temporary documents that may be thrown away when used up , It will be placed in /tmp in
If you load the disc in graphics mode , It just came out ; however , If in text mode , What to do ？
It needs to be loaded into /media in ,/media It's the directory where the server loads the CD-ROM
/mnt It is our linux My personal operating system , ubuntu ,fedora And so on ; This is a /mnt and /media The difference between
/proc The catalogue is nonexistent , From the graphical interface, it's all locked , So it's virtual
> Mount and mount point
○ Device file
○ Files and directories should be placed on the partition of the hard disk ： Whether it's Windows still Linux Will follow that . But different from Windows, stay Linux in , Every hardware device is mapped to a system file , Or the hardware is Linux Is represented as a file , This file is called device file for short . For hard drives 、 CD drive 、 floppy disk 、 Printers and all kinds of IDE and SCSI This is true of all devices .
stay Linux in , Every hardware device is mapped to a system file ,linux You can't recognize the hardware ,linux Will use hardware as software , Or the hardware is linux Is represented as a file
○ Such as IDE The hard disk is Linux Will be stored as something like /dev /hdxy The file of , among hd Indicates the device type of the partition , namely IDE Hard disk ：x Generally, lowercase English letters are used to indicate the hard disk number (a For the basic main disk ,b For basic slave disk ,c For auxiliary main panel ,d For auxiliary slave );y Generally, Arabic numerals are used to indicate the number of the partition （1,2,3 etc. ）.SCSI The hard disk uses /dev/sdxy Named after the . CD drive ( Whether it's IDE Type or SCSI) The method of naming is the same as hard disk . for example ,/dev/hda1 Express IDE The first primary partition of the disk ,/dev/sda1 Represents the first SCSI The first primary partition of the hard disk .
When we create a virtual machine , Created is SCSI Hard disk , So it was sd At the beginning , Can enter the dev Directory to view ;sda1 and sda2 Namely The first and second zones
Because there is only one hard disk in the virtual machine , So it is sda, If there is Two hard drives , It would be sdb
> Linux The mount point
○ stay Linux in , Device files are not allowed to be directly accessed and operated by users , When using, you need to map the device files to a directory , This process is called mounting , The corresponding directory is called mount point or mount point (Mount Point) . If you want to access a partition and other devices ( Such as CD-ROM drive 、 Floppy drive, etc ), You have to hook it up to the file system tree . After successfully mounting , Access different partitions and other devices by accessing mount points . By visiting the mount point , Users can actually access a file system , To read data or to modify and save files .
Load the hardware into a directory , This process is called mount ; Direct operation directory , It's actually operating hardware devices
mount /dev/cdrom /mnt/cdrom This mount mode , It's a personal version of linux
mount /dev/cdrom /media This mount mode , It's enterprise services , Enterprise server linux
When you mount it , It's better to go into text mode , stay vmware There is a circular CD-ROM file in the lower right corner of , Click Select CentOS7 Installation CD file for
After successful connection , It can be mounted
/dev/sr0 It's where the load is , Patterns are read-only , Because optical drives are read-only ,cd Get into media
cd Representatives enter the directory ,DOS There are also cd command
cd Go to the root directory media
ls View the information in the current directory
If there is a mount, there will be an unload , Because the CD-ROM is in the CD-ROM. after reading it , It needs to be taken out , For unloading umount /media
So I'm going to step back ,cd .. Go back to the parent directory