If you buy a wrong movie ticket, you may need to watch it with tears-LAMP setup & amp; Linux basics, and movie ticket-lamp. When I bought the wrong movie ticket, I had to watch it with tears-LAMP built the Linux Foundation. The movie ticket-lamphi did not say that my roommate gave birth to a treat last Friday and had a good time in LongLake, on the way back, let's talk about buying the wrong movie tickets, with tears in mind-LAMP Building & Linux basics, movie tickets-lamp
Hi
I never said that my roommate gave birth to a treat last Friday and had a good time in LongLake. I went back and talked about it. I agreed to go to the last blockbuster of the year from Monday. The Mars rescue team, who knows that Lao Tzu's eyes are not good and he has bought the wrong movie... We pushed our Saturday appointment to this afternoon, madan. we couldn't even send it out. we only went to work.
1. LAMP
----- Build a LAMP environment (2 )-----
---- Add common extensions to PHP
The gd and curl commands have been found online. this is too long.
Liang @ liang-andy :~ $ Sudo apt-get install php5-gd curl libcurl3-dev php5-curl
Time is also a little long
For verification, you need to restart the apache2 service first, and then go to the probe file mentioned last time, that is, check whether there are meters in phpinfo.
---- Filezilla
Ssh tools to manage server files
----- LAMP environment Configuration Optimization (1 )-----
---- LAMP environment file overview
Common sense
/Etc -- Ubuntu system configuration file directory. the configuration files of the software installed by the apt-get command are usually located here.
LAMP is also here
/Etc/apache2
/Etc/mysql
/Etc/php5
---- Detailed description of the environment file
---
Open the apache2 file list first
Liang @ liang-andy :~ $ Cd/etc/apache2
Liang @ liang-andy:/etc/apache2 $ ll
Total usage 96
Drwxr-xr-x 8 root 4096 November 23 19:08 ./
Drwxr-xr-x 134 root 12288 November 25 12:37 ../
-Rw-r -- 1 root 7115 August January 7 2014 apache2.conf
Drwxr-xr-x 2 root 4096 November 23 19:08 conf-available/
Drwxr-xr-x 2 root 4096 November 23 19:08 conf-enabled/
-Rw-r -- 1 root 1782 August January 3 2014 envvars
-Rw-r -- 1 root 31063 January 3 2014 magic
Drwxr-xr-x 2 root 12288 November 23 19:21 mod-available/
Drwxr-xr-x 2 root 4096 November 23 19:21 mod-enabled/
-Rw-r -- 1 root 320 January 7 2014 ports. conf
Drwxr-xr-x 2 root 4096 November 23 19:08 sites-available/
Drwxr-xr-x 2 root 4096 November 23 19:08 sites-enabled/
Apache. conf exists in apache2, which is the total entry to the configuration file. you can include many other configuration files. the configuration is more flexible and the total file is not very large.
Core configuration:Mod-*** apache module; sites-*** virtual host
* ** Avaliable (available) and enabled (enabled) can be used (for details, refer to the last column of the above Command)
Enabled and avaliable use the ln-s command for soft connection. In other words, the module itself is like a lamp, and then the command is to switch
---
Mysql and php
The core modules are my. cnf and php. ini.
Further details
2. Linux basics
The environment is centOS6 and xshell5 in the VM.
Shortcut key, ctrl + l
----- Common Linux commands (1 )-----
We need to know about 6 and 70, and there may be 200 in total in the future.
[Root @ andy ~] #
User @ host name ~ Current location (folder) # superuser prompt $ normal user prompt
Note that the user in linux is not admin; the default host name is localhost ;~ Express/root, home for short
[Root @ andy ~] # The cd/root address remains unchanged.
The home directory of a common user is a second-level address.
---- Command format
Command [option] [parameter]
Note that some commands do not follow this format; multiple options can be written together, such as-au; there are simplified options and complete options, such as-a and-all
--- Ls: query files in the directory
Ls [] [files and directories]
-A all: displays all files, including hidden files.
-L long display details, also known as long Format
-D direct directory properties
-H human: displays the size that people can understand
-I innode
[Root @ andy ~] # Ls-al
Total usage 80
Dr-xr-x ---. 2 root 4096 November 25 05:06.
Dr-xr-x. 24 root 4096 November 26 03:41 ..
-Rw -------. 1 root 1272 November 25 03:55 anaconda-ks.cfg
-Rw -------. 1 root 183 November 25 05:06. bash_history
-Rw-r --. 1 root 18 August 2009. bash_logout
-Rw-r --. 1 root 176 May 20 2009. bash_profile
-Rw-r --. 1 root 176 September 23 2004. bashrc
-Rw-r --. 1 root 100 September 23 2004. cshrc
-Rw-r --. 1 root 26420 November 25 03:55 install. log
-Rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
-Rw-r --. 1 root 129 December 4 2004. tcshrc
-Rw -------. 1 root 768 November 25 04:20. viminfo
-- Ll command, which is ls-l
-- About long format
-- First column, permission
-Rw-r -- indicates the permission. the default value is 10 bits.
-Indicates the file type (-file d Directory | soft-link file). There are 7 types of files in total. if other files are used less often, the files are special files in the system, what you want to see
[Root @ andy ~] # Ls-l/dev/
The last nine digits, each of which is a group, represent the u owner of the file, the g owner group, and the other three identities (the permission rules for the file and the three)
(Linux user groups are user sets with the same permissions)
R read, w write, x execute (three basic permissions)
For example, rw-u has read and write permissions on it.
-- Click ".".
Represents ACL permissions
-- Number 1
Reference count
-- Root
Owner and group
-- Number
File size, in bytes. use the-h option.
[Root @ andy ~] # Ls-lh
Total usage 44 K
-Rw -------. 1 root 1.3 K November 25 03:55 anaconda-ks.cfg
-Rw-r --. 1 root 26 K November 25 03:55 install. log
-Rw-r --. 1 root 7.4 K November 25 03:52 install. log. syslog
-- Date
Last modification time
-- Last,
File name
The file name starts with "." is a hidden file.
---D
View directory permissions
-- I
Show I node and ID
---- File processing command
Create a directory and a file
--- Directory Processing Command & file processing command
The directory is also a file.
-- Create a directory: mkdir
Make directory
Mkdir-p [directory name]
-P recursive creation, which means to create a multilevel directory recursively
[Root @ andy ~] # Mkdir-p japan/cangls
--- Switch Directory: cd
Cd [Directory]
It is very simple, that is, you can cut a lot of levels, you can also cut a level, without entering the Directory, directly go home directory
-Simplified operations
Cd or cd ~ Go Home (~ Originally represents the home directory)
Cd .. back to the upper-level Directory
Cd-go to the last Directory
Cd. enter the current directory
[Root @ andy ~] #
[Root @ andy ~] # Cd/etc
[Root @ andy etc] # cd sysconfig
[Root @ andy sysconfig] # cd ..
-Bash: cd...: command not found
[Root @ andy sysconfig] # cd ..
[Root @ andy etc] # cd-
/Etc/sysconfig
[Root @ andy sysconfig] # cd ~
[Root @ andy ~] #
--
Relative path and absolute path
[Root @ andy ~] # Cd ../usr/local/src
[Root @ andy src] # cd ../usr/local/src
-Bash: cd: ../usr/local/src: the file or directory does not exist.
[Root @ andy src] # cd/usr/local/src
[Root @ andy src] # cd/usr/local/src
[Root @ andy src] #
Relative path, that is, relative to the current location to cd
The absolute path is to start from the root directory, which is troublesome but reliable and suitable for beginners.
-- About the tab key
Complete the command and Directory, press the button twice, and make sure the result is correct.
-- Query directory location: pwd
Direct use
-- Delete an empty directory: rmdir
Remove empty directory
Rmdir [Directory]
[Root @ andy ~] # Rmdir bols
[Root @ andy ~] # Rmdir japan
Rmdir: failed to delete "japan": the directory is not empty.
So it's not easy to use.
-- Delete a file or directory: rm
Remove
[Root @ andy ~] # Rm japan
Rm: Cannot delete "japan": is a directory
[Root @ andy ~] # Rm-r japan
Rm: Do you want to go to the "japan" directory "? Y
Rm: delete the directory "japan/cangls "? Y ^ Hn ^ H
Rm: delete the directory "japan "? N
[Root @ andy ~] # Rm-rf japan
[Root @ andy ~] # Ls-l
Total usage 44
-Rw -------. 1 root 1272 November 25 03:55 anaconda-ks.cfg
-Rw-r --. 1 root 26420 November 25 03:55 install. log
-Rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
[Root @ andy ~] #
Rm-rf [Directory]
If you use-rf to delete a file directly, you can delete it without asking a question. Therefore, you may even delete the entire system with caution.
-R: Delete a directory.
-F Force
-- Copy: cp
Copy
-R copy Directory
-P-d
-A is equivalent to-rpd.
So with cp, cp-Make sure that all copies are the same, time, or something.
-- Cut or rename: mv
Move
Note: No option is added for cropping.
-- Common directory functions
[Root @ andy ~] # Cd/
[Root @ andy/] # ls
Bin boot cgroup dev etc home lib lost + found media misc mnt net opt proc root sbin selinux srv sys tmp usr var
Switch to the root directory first/
These are level-1 directories.
Bin and sbin, and bin and sbin in usr both save system commands.
/Boot Startup directory to save user startup data
/Dev special file save Directory, do not tamper
The default configuration file of the/etc system, which will be updated frequently in the future.
/Home: home directory of common users,/home directory of root super users
/Lib Library
Misc media mnt empty directory, used for mounting, external to other devices, set to use
Proc sys cannot be operated directly. it is a memory drive letter.
/Tmp temporary directory
/Usr system resource directory
/Var save the system variable document directory
In short, you can store anything in the home directory and/tmp.
--- Link command:Ln
Link
Ln-s [source file] [target file]
-S soft link
Note: The fundamental purpose of creating a link is to create a shortcut
-- Hard link
Basically, it can be understood that different access points/names of the same file (as imagined as the front and back doors of the same classroom)
Has the same I node and storage block. you can still use
The disadvantage is that it cannot span partitions or target directories.
[Root @ andy ~] # Ln/root/anaconda-ks.cfg/tmp/ana. hard
[Root @ andy ~] # Ll
Total usage 48
-Rw -------. 2 root 1272 November 25 03:55 anaconda-ks.cfg
-Rw-r --. 1 root 26420 November 25 03:55 install. log
-Rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
Drwxr-xr-x. 3 root 4096 November 26 04:55 japan
[Root @ andy ~] # Ll/tmp
Total usage 92
-Rw -------. 1 root 1272 November 26 04:55 ana
-Rw -------. 2 root 1272 November 25 03:55 ana. hard
Drwxr-xr-x. 3 root 4096 November 26 04:56 japan
-Rw -------. 1 root 81920 November 26 04:40 whatis.2kxNR9
-Rw -------. 1 root 0 November 25 03:32 yum. log
Basically, it cannot be seen, except the reference count + 1; but you can see the I node number.
[Root @ andy ~] # Ls-li
Total usage 48
135177-rw -------. 2 root 1273 November 26 05:32 anaconda-ks.cfg
130564-rw-r --. 1 root 26420 November 25 03:55 install. log
130565-rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
135180 drwxr-xr-x. 3 root 4096 November 26 04:55 japan
[Root @ andy ~] # Ls-li/tmp
Total usage 92
550003-rw -------. 1 root 1272 November 26 04:55 ana
135177-rw -------. 2 root 1273 November 26 05:32 ana. hard
550005 drwxr-xr-x. 3 root 4096 November 26 04:56 japan
550004-rw -------. 1 root 81920 November 26 04:40 whatis.2kxNR9
522243-rw -------. 1 root 0 November 25 03:32 yum. log
If a file is deleted, the reference count is changed to 1.
However, it is not recommended to create hard links: Limited to many; relatively hidden, only I node-soft ~ is recommended ~
-- Soft link
Windows Shortcuts
Has its own I node and block, but only the file name and I node number of the source file are saved in the data block, and there is no actual file data(Similar to storing a treasure map)
The permissions for soft links are lrwxrwxrwx.
Deleting the source file, the soft link becomes invalid (both are shortcuts)
Modify one, and the other will change.
[Root @ andy ~] # Cp-a anaconda-ks.cfg/root/japan
[Root @ andy ~] # Ln-s/root/japan/anaconda-ks.cfg/tmp/an. soft
[Root @ andy ~] # Ll
Total usage 48
-Rw -------. 2 root 1273 November 26 05:32 anaconda-ks.cfg
-Rw-r --. 1 root 26420 November 25 03:55 install. log
-Rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
Drwxr-xr-x. 3 root 4096 November 26 05:43 japan
[Root @ andy ~] # Ll/tmp
Total usage 92
-Rw -------. 1 root 1272 November 26 04:55 ana
-Rw -------. 2 root 1273 November 26 05:32 ana. hard
Lrwxrwxrwx. 1 root 27 November 26 05:44 an. soft->/root/japan/anaconda-ks.cfg
Drwxr-xr-x. 3 root 4096 November 26 04:56 japan
-Rw -------. 1 root 81920 November 26 04:40 whatis.2kxNR9
-Rw -------. 1 root 0 November 25 03:32 yum. log
[Root @ andy ~] # Ll-I/tmp
Total usage 92
550003-rw -------. 1 root 1272 November 26 04:55 ana
135177-rw -------. 2 root 1273 November 26 05:32 ana. hard
533111 lrwxrwxrwx. 1 root 27 November 26 05:44 an. soft->/root/japan/anaconda-ks.cfg
550005 drwxr-xr-x. 3 root 4096 November 26 04:56 japan
550004-rw -------. 1 root 81920 November 26 04:40 whatis.2kxNR9
522243-rw -------. 1 root 0 November 25 03:32 yum. log
[Root @ andy ~] # Ll-I
Total usage 48
135177-rw -------. 2 root 1273 November 26 05:32 anaconda-ks.cfg
130564-rw-r --. 1 root 26420 November 25 03:55 install. log
130565-rw-r --. 1 root 7572 November 25 03:52 install. log. syslog
135180 drwxr-xr-x. 3 root 4096 November 26 05:43 japan
Note the following: I node, permission, and file name
In the soft link, the source file must be written to the absolute path; otherwise, an error may be reported.
I wrote few examples by myself, and you practiced more.
Tomorrow
Hi, I didn't say that my roommate gave birth to a treat last Friday and had a good time in LongLake. I went back and talked about it...