Yesterday, a simple understanding of the basic Linux commands, today to learn the Linux build environment (installation files, configuration files) and permissions operations.
First, install LNMP related software
Lnmp refers to linux+nginx+mysql+php
Ubuntu installation File command: Apt-get install software name to determine the correct software name when installing
The CentOS command is: Yum install software name
1. Installing Nginx
① Execute command apt-get install Nginx
nginx Default installation location is the/etc/nginx directory , the default site directory under/usr/share/nginx/html, the default website domain name configuration file is/etc/nginx/sites-available /directory under the default file.
② starting Nginx,etc/init.d/nginx Start
③ the default page of Nginx by accessing the IP, the following page shows the installation and launch success.
2. Install MySQL
Execute command apt-get install Mysql-server mysql-client
During installation, you will be prompted to set the password of the database root user, set it yourself, enter two times
3. Install PHP
Execute command apt-get install php7.0-fpm php7.0-cli php7.0-common php7.0-mysql php7.0-mbstring php7.0-gd Php7.0-json php7.0-curl
The first three are required, followed by PHP extension files according to their own needs, can also be later installed separately.
Second, modify the file configuration
Then learn some of the necessary VIM commands:
①j K h L move the cursor position on the left and right
②/keywords and then enter keyword search, n for the next, N to find the previous
③:set Nu return line number
④ctrl+b Prev, Ctrl+f Next
⑤vim Copy command
YY Copy cursor line,
Y2Y Copy the current two lines, the middle number is variable,
y8g Copy from the current line to line 8th, the middle number is variable,
Ygg Copy from the current line to the beginning,
YG Copy from current line to last row
⑥p paste.
1, PHP.ini
When you modify the configuration file, remember to copy one, make sure to replace the original, so as not to modify the source file so that PHP does not work properly.
Find the PHP fpm under the/etc/directory below the php.ini, depending on the PHP version of the different directories are also different,
Vim PHP.ini Open and modify it to suit your needs.
2. Nginx configuration file
File location/etc/nginx/sites-enabled/default, where to configure the site
Vim default opens, adds or modifies site information
Site information related parameters: Listen is the port, the default 80.;root is the project path; Index Project access home; server_name bound domain name
Third, modify the permissions
For example, this app file, the first d indicates that the app is a folder, the following rwxr-xr-x is divided into three groups of permissions, each group of three, respectively, the file owner, the file group, all users corresponding permissions.
There are three kinds of permissions: R read 4;w write 2;x execution 1, such as RWXRWXRWX, the file has a permission of 777.
chmod permission file name or folder name, such as: chmod 777 app to change the app's permissions to 777
Chmod-r Permissions folder name folder and the following sub-file permissions are modified together
The Chmod-x app removes execution permissions, and the same can be-r,-w
chmod +x app to add execute permissions, or you can +r,+w
chmod the G-x app removes the group's execute permissions, plus the minus sign in front of the parameter G for the group, U for the owner, O for the public, a for the front three all (and no effect)
Four, the above command to practice a lot!
Linux Server Learning (ii)