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 install apache+mysql 8+php7 with yum in Centos 7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "Centos 7 how to use yum to install apache+mysql 8+php7", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "Centos 7 how to use yum to install apache+mysql 8+php7" bar!

Mysql installation 1. Clean up the original mysql file

(1) check whether there is an installed version of mysql

Rpm-qa | grep mysql

Possible display: mysql-community-libs-8.0.12-1.el7.x86_64 mysql80-community-release-el7-1.noarch mysql-community-client-8.0.12-1.el7.x86_64 mysql-community-common-8.0.12-1.el7.x86_64 mysql-community-server-8.0.12-1.el7.x86_64

If any, delete it with the following command

Yum remove mysql-xxx-xxx-

(2) find the relevant files of mysql (if it is recommended to delete)

Find /-name mysql

(3) decide whether to delete the configuration file information of mysql according to your own needs

Rm-rf / var/lib/mysql

(4) find and delete database mariadb

Rpm-qa | grep mariadb

Possible results mariadb-libs-5.5.56-2.el7.x86_64

Forcibly delete the results found.

Rpm-e-nodeps mariadb-libs-5.5.56-2.el7.x86_642. Download and install mysql

(1) enter the mysql yum source and select linux7 jump

Regardless of login and sign up, right-click No thanks, just start my download below. Select copy link address

Select the address to download and store, such as

Cd / usr/local

(2) use the copied link address yum source, such as https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

(3) install yum source

Yum localinstall mysql80-community-release-el7-3.noarch.rpm

(4) Update the yum source

Yum clean allyum makecache

(5) start installing MySQL

Yum install mysql-community-server

(6) start MySQL

Systemctl start mysqld3. Change the default random password for mysql

After the startup is successful, you can view the randomly generated initialization password

Cat / var/log/mysqld.log | grep password

Log in to MySQL and enter the random password you just gave

Mysql-u root-pEnter password:

To change the password, the password must contain uppercase and lowercase alphanumerics and a special character!

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' new password; 4. Remote connection Settings mysql > use mysql;mysql > update user set host='%' where user='root'

Authorization of the user name, giving any host access to data

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' WITH GRANT OPTION;mysql > FLUSH PRIVILEGES

Note: centos7 needs to open the mysql service port in both the CVM management backend and the server firewall. Default is 3306. View the firewall configuration.

Firewall-cmd-permanent-zone=public-add-service=mysqlfirewall-cmd-reload

Connection attempts can be made through remote connection tools such as Navicat, such as connection failure 2003. Unknown error 1006 is a firewall problem. For other problems, you can try to change / etc/my.cnf and restart.

[mysqld] # allows any host to log in to MySQLbind-address = 0.0.0.0port=3306default-authentication-plugin=mysql_native_passwordapache installation

(1) check whether the system has apache installed by default before installation.

Rpm-qa | grep httpd

Delete if any

Rpm-e * (package name)

(2) installation

# Update yum update# installation prerequisite package yum-y install gcc gcc-c++ make# install apacheyum install httpd# apache service enable systemctl start httpd# setup apache boot boot systemctl enable httpd

(3) configure the firewall and open port 80. Note: centos7 needs to open the http service port in both the CVM management backend and the server firewall. The default is 80. Check the firewall configuration.

Firewall-cmd-permanent-zone=public-add-service=httpfirewall-cmd-reload

(4) now through the server ip:80 port access, you can see that the default apache interface is successful.

If not, try changing the vi / etc/httpd/conf/httpd.conf configuration file before restarting

ServerName localhost:80php installation

(1) check whether there are previous files. The default installation of yum is not 7.0. if you try, you need to delete the previous version completely.

Rpm-qa | grep php

There may be the following package php-pdo-5.1.6-27.el5_5.3 php-mysql-5.1.6-27.el5_5.3 php-xml-5.1.6-27.el5_5.3 php-cli-5.1.6-27.el5_5.3 php-common-5.1.6-27.el5_5.3 php-gd-5.1.6-27.el5_5.3

If any, it needs to be deleted. Note that packages may be interdependent. Delete non-dependent packages first.

Rpm-e * (package name)

(2) installation. Change the yum source

Rpm-Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum-y install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-pear.noarch php70w-process.x86_64 php70w-xml.x86_64 php70w-xmlrpc.x86_64

Php environment testing, in the / var/www/html directory, the vi index.php input is saved as follows.

Restart the httpd service and check the ip:80/index.php after systemctl restart httpd. The following interface is considered a success.

If output as is or download directly fails, failure check can try to change / etc/httpd/conf/httpd.conf restart

.. AddType application/x-compress .ZAddType application/x-gzip .gz .tgz add AddType application/x-httpd-php .php thank you for reading, the above is "Centos 7 how to use yum to install apache+mysql 8+php7" content, after the study of this article, I believe you have a deeper understanding of how to use yum to install apache+mysql 8+php7 in Centos 7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report