Hi
After 4 days of baptism of the feast, the whole people think of the secret Tatsu ... Yesterday's lazy, there is no reason for lazy, in short, is the pen to the pro
1. Lamp Configuration under Ubuntu
Basic knowledge of-----ubuntu-----
----Administrator Privileges
For security reasons, Ubuntu does not recommend using the root account for remote logins-forcing the use of other regular accounts
Since the normal account does not have Super Administrator privileges, by default it is not possible to log in with the root account (remote, etc.), so two commands are required
SU (switch User) switch to Super Administrator
sudo (Switch User and do) as a super administrator
There is an essential difference between the two-the former is the "Boss" (root), must use the root password, until exit to exit, the latter is the "younger brother" request the boss to give permission, and is temporary permission, the password only with ordinary on the line
----Preparatory knowledge
[Email protected]:~ $
User name @ Host Name: Current directory user type tag
where $ represents a normal user, #表示超级管理员
---
[Email protected]:~$ pwd
/home/liang
~ indicates that it is now in the current user's personal folder, the PWD command can give the actual directory
---
These two commands are shown below: Modifying the root password
[Email protected]:~$ sudo passwd root
[sudo] password for Liang:
Enter a new UNIX password:
Re-enter the new UNIX password:
passwd: Password has been successfully updated
[Email protected]:~$
Then the SU
[Email protected]:~$ su
Password:
[Email protected]:/home/liang#
Note that the directory path has changed, and there is a #
----Apt-get Software Installation Tool
The main function is to get the software list apt-get update and software installation Apt-get install
Learn----Other necessary commands
http://itlab.idcquan.com/linux/special/linuxcom/
---
Name: ls
Usage rights: All users
How to use: ls [-ALRTAFR] [name ...]
Description: Displays the contents of the specified working directory (lists the files and subdirectories included in the current working directory).
Parameters:
-a displays all files and directories (LS default starts the file name or directory name as ".") As hidden files, not listed)
-L In addition to the file name, but also the file type, permissions, owners, file size and other information detailed list
-R Displays the files in reverse order (originally alphabetical order)
-T lists the files in the order of establishment time
-A with-a, but not listed "." (current directory) and ".." (Parent directory)
-F adds a symbol after the listed file name, such as an executable file with "*" and a "/" in the directory.
-R If there is a file under the catalogue, the following files are also listed
Example:
Lists all files under the current working directory whose names are S, and the newer the following:
Ls-ltr s*
List all directories and archive details below the/bin directory:
Ls-lr/bin
List all the files and directories under the current working directory; add "/" to the name, and the executable file after the name with "*":
Ls-af
---
LL will list all the file information under the file, including the hidden files, while ls-l only lists the explicit files, stating that the two commands are still not equivalent!
---
directive name: LN
usage rights: All users
How to use: ln [options] Sou Rce Dist, where option is in the format:
[-BDFINSVF] [-S backup-suffix] [-v {numbered,existing,simple}]
[--help] [--ver SION] [--]
Description: Linux/unix file system, there is a so-called link, we can think of it as the alias of the file, and the link can be divided into two types: Hard link and soft link (symbolic link), hard link means a A file can have multiple names, whereas a soft link creates a special file with the contents of the file pointing to the location of another file. Hard links exist in the same file system, while soft links can span different file systems.
Ln Source Dist is to produce a link (dist) to source, and the use of a hard or soft link is determined by the parameter.
Whether a hard link or a soft link does not copy the original file, it only consumes a very small amount of disk space.
Parameter:
-F: The link will be deleted with dist file name-D: Allow the System Manager to hard-link their own directory-I: When deleting the file with the dist file with the first query-N: In the soft link, the Dist view For the general file-S: Soft link (symbolic Link)-V: Displays its file name before the link B: Files that will be overwritten or deleted at the end of the link are backed up by the-s SUFFIX: Add the backed up files to the SUFFIX-V method: Specify how the backups are made- -HELP: Display Auxiliary description--version: Display version
Example:
will file yy produce a symbolic link:zz
Ln-s yy zz
to produce a file yy Hard link:zz
Ln yy xx
---
Name: CD
Usage rights: All users
How to use: CD [DirName]
Description: Transform the working directory to DirName. Where dirName notation can be either an absolute path or a relative path. If the directory name is omitted, it is transformed to the user's home directory (that is, the directory where login was first).
In addition, "~" is also expressed as the meaning of home directory, "." is the current directory, "." indicates the current directory location of the previous level directory.
Example: Jump to/usr/bin/:
Cd/usr/bin
Jump to your home directory:
CD ~
Jump to the top two of the current directory:
Cd.. /..
CD-Returns the directory in front of the current directory
Name: CP
Usage rights: All users
How to use:
CP [Options] Source Dest
CP [options] source ... directory
Note: Copy one file to another file, or copy several files to another directory. (copy)
Parameters:
-A as far as possible file status, permissions and other information are reproduced as original.
-R If the source contains a directory name, the files under the directory are also copied to the destination.
-F If a destination already has a file with the same file name, it should be deleted before copying.
Example:
Copy the file AAA (already present) and name the BBB:
CP AAA BBB
Also known as sudo cp document_a Document_b
Copy all C-language programs to the finished subdirectory:
CP *.c finished
---
Name: MV
Usage rights: All users
How to use:
MV [options] Source Dest
MV [options] Source ... directory
Note: Move one file to another file, or move several files to another directory.
Parameter:-I if the destination already has the same name file, first ask whether overwrite the old file.
Example:
Rename file aaa to BBB:
MV AAA BBB
Move all C language programs to the finished subdirectory:
Mv-i *.c
---
Name: RM
Usage rights: All users
How to use: RM [options] name ...
Description: Delete files and directories.
Parameters:
-I ask for confirmation before deleting.
-F Even if the original file attribute is set to read-only, it is deleted directly without confirmation.
-R the directory and the following files are also deleted.
Example:
Delete all C language files; Ask for confirmation before deleting:
Rm-i *.c
Delete all the files in the finished subdirectory and subdirectories:
Rm-r finished
---
Name: mkdir
Usage rights: All users with appropriate permissions to the current directory
Mode of Use: mkdir [-P] DirName
Description: Create a subdirectory named DirName.
Parameter:-p ensure that the directory name exists and that it does not exist.
Example:
Under working directory, create a subdirectory called AAA:
mkdir AAA
In the BBB directory under the working directory, create a subdirectory named Test. If the BBB directory does not already exist, create one. (Note: If this example does not add-p and the original BBB directory does not exist, an error is generated.) )
Mkdir-p Bbb/test
---
Name: RmDir
Usage rights: All users with appropriate permissions to the current directory
Mode of Use: rmdir [-P] DirName
Description: Delete the empty directory.
Parameter:-P is deleted when the subdirectory is deleted and the directory becomes empty.
Example:
Delete the subdirectory named AAA under the working directory:
RmDir AAA
In the BBB directory under the working directory, delete the subdirectory named Test. If the BBB directory becomes an empty directory after the Test is deleted, BBB is also deleted.
Rmdir-p Bbb/test
---
chmod----Changing the access mode of one or more files (mode) chmod [options] mode files This feature can only be used by a file owner or a privileged user to change the file access mode. Mode can be expressed in digital form or in the form of who opcode permission. Who is optional and the default is a (all users). Only one opcode (opcode) can be selected. Multiple mode can be specified, separated by commas. Options: -c,--changesonly the information of the changed file is output -f,--silent,--quietusers who do not notify the file when chmod cannot change the file mode --helpoutput help information. -r,--recursiverecursively traverse subdirectories to modify all files and subdirectories in the directory --reference=filenameto set permissions by referencing the permissions of the filename -v,--verboseoutput information for each file, regardless of whether the modification was successful --versionoutput version information. W.H.O. uUser gGroup oother aall Users (default) opcode +Increase Permissions -Delete Permissions =Reassign Permissions Permission RRead WWrite xExecution sset the ID number of the user (or group) Tset the sticky bit (sticky bit) to prevent files or directories from being deleted by the non-owner uuser's current permissions gCurrent permissions for the group oCurrent permissions for other users as a choice, most of us represent permissions in the form of three-bit octal digits, the first one specifying the permissions of the master, the second specifying the group permissions, and the third specifying the permissions of the other user, each of which is determined by 4 (read), 2 (write), 1 (executed), and three numeric values. If 6 (4+2) represents a read-write right, 7 (4+2+1) has read, write, and execute permissions. You can also set the fourth bit, which is in front of the three-bit permission sequence, and the fourth digit value is 4,2,1, which means the following: 4, the user ID is set at execution time, and is used to authorize the file owner-based process instead of the user who created the process. 2, when executed, sets the user group ID, which is used to authorize the process based on the group of files, rather than on the user who created the process. 1, set the sticky bit. Example: $ chmod u+x file adds execute permission to the owner of file$ chmod 751 file assigns read, write, execute (7) permissions to the owner of file, assigns read, execute (5) permissions to the group where the file resides, and assigns permissions to other users to execute (1)$ chmod Another form of the example on U=rwx,g=rx,o=x file$ chmod =r file to assign Read permissions to all users$ chmod 444 file above example$ chmod a-wx,a+r file above example$ chmod-r u+r directory recursively reads permissions for the owner of all files and subdirectories in directory directory$ chmod 4755 sets the ID to assign read, write, and execute permissions to the owner, assigning read and Execute permissions to the group and other users.
-----Build Lamp Environment-----
----Installing Apache MySQL PHP with Apt-get
Apt-get has a feature, is that the installation of things will be related to some of the things together to install
---
[Email protected]:~$ sudo apt-get install apache2
Install Apache, then enter the password (normal user) and Y, and enter the following command to indicate that the installation was successful
[Email protected]:~$ apache2-v
Server version:apache/2.4.7 (Ubuntu)
Server built:oct 14 2015 14:18:49
Then enter ifconfig to get the IP address
(I am here) 192.168.1.100 Get It works page validation success
---
Install PHP
[Email protected]:~$ sudo apt-get install php5
[Email protected]:~$ php5-v
PHP 5.5.9-1ubuntu4.14 (CLI) (built:oct 28 2015 01:32:13)
Copyright (c) 1997-2014 the PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
With Zend Opcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
Then load/check php5.load this PHP implementation of the apache2 operation of the module (first, regardless of why, first do so)
[Email protected]:~$ cat/etc/apache2/mods-enabled/php5.load
LoadModule php5_module/usr/lib/apache2/modules/libphp5.so
---
Install MySQL
[Email protected]:~$ sudo apt-get install Mysql-server
This does not need to verify the version, but also to check PHP operation MySQL Module
[Email protected]:~$ Cat/etc/php5/mods-available/mysql.ini
Cat:/etc/php5/conf.d/mysql.ini: No file or directory
Note that the Ubuntu I use here is the 14LS version, and the 12 cat directory is not the same/etc/php5/conf.d/mysql.ini
This is because PHP does not install MySQL extension by default, so it needs to be installed manually
[Email protected]:~$ sudo apt-get install Php5-mysql
[Email protected]:~$ Cat/etc/php5/mods-available/mysql.ini
; Configuration for PHP MySQL module
; Priority=20
Extension=mysql.so
This will do it, then restart MySQL and apache2
[Email protected]:~$ sudo service mysql restart
[Email protected]:~$ sudo service apache2 restart
---
One-time installation: The above is a sub-process, the following a single-time installation
sudo apt-get install apache2 php5 mysql-server php5-mysql
----Creating Phpinfo Probes
First install Vim
sudo apt-get install vim
Then switch to the PHP www folder, using the CD command
Cd/var/www/html (Version 14.4)
Then create a PHP file here
sudo vim info.php
Write PHP code
<?php
echo mysql_connect (' localhost ', ' root ', ' hanhan123 ')? ' Hoho ': ' WTF ';
Phpinfo ();
Then the ESC key, enter: Wq Save exit
http://192.168.1.100/info.php Browser Input Validation results
Linux so it hurts, I don't write it, I'll see you tomorrow
Don't write, I'm afraid I'll never write the-lamp Foundation