2024年6月11日发(作者:)

一.Apache

1.查看httpd包是否可用

yum list | grep httpd

2.安装Apache

yum install httpd

3.配置servername

vi /etc/httpd/conf/

修改这行: ServerName localhost:80

4.启动

systemctl start httpd

5.设置开机启动

chkconfighttpd on

二 MySQL

1.安装MySQL源

yum localinstall /get/

2.安装MySQL

yum install mysql-community-server

3.启动MySQL

systemctl start mysqld

4.获取密码

grep 'temporary password' /var/log/

得到这行A temporary password is generated for root@localhost: Jqqskhz1Wr(? 冒号后面

的就是密码

5.修改密码

[root@localhost ~]# mysql_secure_installation

当出现如下提示时候直接按回车:

Enter current password for root

出现如下再次回车:

Set root password? [Y/n]

出现如下提示输入你需要设置的密码,回车后在输入一次确认:

New password:

接下来还会有四个确认,分别是:

Remove anonymous users? [Y/n] Disallow root login remotely? [Y/n]

Remove test database and access to it? [Y/n] Reload privilege tables now? [Y/n]

6.进入MySQL

mysql -uroot -p

7.开放远程访问权限

use mysql;

update user set host = '%' where user = 'root';

百分号相当于*号,意为全部放行,也可改为IP地址则只允许此IP连接,也可以设置为

192.168.%.%或者192.168.0.1/9代表允许一个ip段进行连接,也可以多加几条数据设置

不同ip允许连接

三、PHP安装

1. 首先输入"yum upgrade"进行更新。

2. 2

更新完毕后输入"yum install php"尝试进行安装。

3. 3

显示PHP版本为5.4.16-42.e17,不是PHP7。