Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build yum in LNMP Environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to build yum under the LNMP environment, the article is very detailed, has a certain reference value, interested friends must read it!

The method of Building yum in LNMP Environment

First, yum, take a look at the lnmp environment.

Check whether nginx php mysql exists

Command: which php

If it exists, uninstall it first.

Yum remove mysqlyum remove phpyum remove nginx

And then check

Rpm-qa | grep-I php

Use the command: rpm-e (data just checked out)-- nodeps forcibly delete

Use find /-name php to view all files and delete them all (same as nginx and mysql)

Use the command: rm-rf (file name)

After deleting it, you can install it. Check again to see if php nginx mysql is installed.

Use the command which mysql

Start installation of nginx list Nginx version

Command: yum list nginx

Installation command: yum install nginx

When there is complete! Indicates success

Now let's look at it again.

Which nginx, see if it exists now.

Let's start it here to talk about centos7.0, then we don't need service. This method is activated.

Instead, start it with systemctl

Command: / bin/systemctl start nginx.service (here bin is my path personal path is different, you may not need it)

Then check to see if the process runs successfully

Ifconfig # View Nic information

Open the browser: http://182.92.73.109/

Seeing the {nginx Welcome Interface} indicates that the installation is successful!

Next, let's install php (if you want yum to install 7.0, you can refer to the previous article)

Command:

Yum list php php-fpm # list the existence of yum-y install php php-fpm # install php and php-fpm packages for php and php-fpm

Complete appears! Then succeed.

Start php-fpm:/bin/systemctl start php-fpm

Modify the nginx configuration file to forward the request from PHP to the ip and port bound by php-fpm:

Vim / etc/nginx/nginx.conf.default # lines [65-71]

Get rid of #:

Location ~\ .php$ {root / usr/share/nginx/html; fastcgi_pass 127.0.0.1 root 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

Code interpretation:

When the user's request URL ends with .php

Then execute the contents of this block:

The directory specified by root

Pass forwarding port [e]

Index automatically adds index.php at the end of the specified directory.

Param wants to execute the file name passed by the file in documnetRoot

Include at-home profile [e]

Note: (1): wq # Save (2) I # insert (3): Q! # do not save exit

Display 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 to install Mysql

First check to see if Mysql exists. If so, uninstall it first.

Command: which mysql

If it is not shown, you can install it.

Note:

CentOS7 default database is mariadb, configuration and so on are not used, so I decided to change it to mysql, but there seems to be no mysql in the yum source of CentOS7. To solve this problem, we need to download the repo source for mysql.

1. Download the repo source for mysql

Copy command

$wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

two。 Install the mysql-community-release-el7-5.noarch.rpm package

$sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

After installing this package, you will 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

Installation is successful. Test it.

Mysql-uroot-p (no password by default, enter directly here)

2. Change the password

Format: mysqladmin-u username-p old password password new password

1. Add a password ab12 to root.

First enter the directory mysql\ bin under DOS, and then type the following command

Mysqladmin-u root-password ab12

Note: since root does not have a password at the beginning, the-p old password can be omitted.

2. Change the password of root to djg345.

Mysqladmin-u root-p ab12 password djg345

3. Add new users

Note: unlike the above, the following is a command in the MYSQL environment, so it is followed by a semicolon as the command Terminator

Format: grant select on database. * to user name @ login host identified by "password"

Restart and you can connect to the mysql on the line locally.

At this point, the lamp environment is installed.

These are all the contents of the article "how to build yum in LNMP". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report