Analysis on the method of yum construction under LNMP environment
- 2020-09-28 09:17:58
- OfStack
The example of this paper describes the method of yum under LNMP environment. To share for your reference, the details are as follows:
Today I got the socket extension, which ruined my environment. The posix extension was ruined by me. So I got it from the new one
First yum look at the lnmp environment
Check for the presence of nginx php mysql
Command:
which php
If it exists, uninstall it first
yum remove mysql
yum remove php
yum remove nginx
Then look at
rpm -qa|grep -i php
Use the command:
rpm -e
(Data just found out)
--nodeps
Forced to delete
with
find / -name php
Go to see all the files and delete them all (nginx, mysql1 sample)
Use the command:
rm -rf
(File name)
After the deletion, the installation can be carried out. Again, check whether php nginx mysql is installed
With the command
which mysql
Start installing nginx lists the Nginx version
Command:
yum list nginx
Installation command:
yum install nginx
When a complete! Indicates success
Now let's look at it again
which nginx
Let's see if it exists now
So let's start it up and we're going to say 1 es67EN7.0 and then we're not going to use service. The method starts
But with the
rpm -qa|grep -i php
0
Start the
Command: /bin/systemctl start nginx.service (bin here is my path personal path different, you may not need)
Then check to see if the process is running successfully
ifconfig # View network card information
Open the browser: http://182.92.73.109/
When you see {nginx welcome screen}, the installation is successful!
Next we will load php (refer to the previous article if you want yum to load 7.0)
Command:
yum list php php-fpm # list php and php-fpm If there is a
yum -y install php php-fpm # The installation php and php-fpm The software package
Appear Complete! The successful
Start the php - fpm:
/bin/systemctl start php-fpm
Modify the nginx configuration file so that PHP requests are forwarded to the ip and port to which php-ES110en is bound:
vim /etc/nginx/nginx.conf.default # line [65-71]
Remove the # sign:
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Code explanation:
When the user's request for URL ends with.php
Then execute the contents of this block:
root specified directory
pass forwarding port [e]
index automatically adds index.php if you specify the end of the directory
param executes the file name passed from the file in documnetRoot
include At home profile [e]
Note: (1) : wq # save (2) i # insert (3) : q! # Exit without saving
According to the number of rows
set nu
Restart nginx after wq comes out
Restart nginx:
/bin/systemctl restart nginx
Verify that the request PHP file is processed:
vim /usr/share/nginx/html/info.php
Access the test path to see if phpinfo information is displayed.
OK !
Now I start installing Mysql
Check to see if Mysql exists and if so, uninstall first
Command:
which mysql
It says no and it's ready to install
Note:
The default database of CentOS7 is mariadb, so I decided to change it to mysql, but CentOS7's yum source seems to have no mysql by default. To solve this problem, we need to download the repo source for mysql.
1. Download repo source for mysql
Copy command
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Install mysql-ES200en-ES201en-el7-5. noarch. rpm package
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
After installing this package, you get two yum repo sources for mysql
/ etc yum. repos. d/mysql - community. repo,
/ etc yum. repos. d/mysql - community - source. repo.
3. Install mysql
$ sudo yum install mysql-server
Install successfully, test 1
mysql -uroot -p
(Default is no password, press enter here)
2. Change your password
Format: mysqladmin-ES243en Username -p Old password password New password
1. Add a password to root ab12.
First under DOS enter the directory mysql\bin, and then type the following command
ifconfig # View network card information
0
Note: Since root did not have a password at the beginning, one item of the old -ES259en password can be omitted.
2. Change the password of root to djg345.
ifconfig # View network card information
1
3. Add new users
Note: Unlike the above, the following commands in MYSQL are followed by a semicolon as the end of the command
Format: grant select on database * to username @ Login host identified by "Password"
Restart to connect to mysql on the local cable
At this point the lamp environment is installed
Hopefully this article has helped you with your Linux server configuration.