本篇文章主要介绍了"CentOS 70 安装配置LAMP服务器过程 Apache+PHP+MariaDB (MariaDB可以认为就是mysql)",主要涉及到方面的内容,对于PHPjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下:
安装 wget yum -y install wget更改yum源与更新系统 (可选)[1] 首先备份/etc/yum.repos.d/CentOS-Base...
- 安装 wget
yum -y install wget
- 更改yum源与更新系统 (可选)
[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[2] 进入yum源配置文件所在文件夹
[root@localhost yum.repos.d]# cd /etc/yum.repos.d/
[3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[4] 运行yum makecache生成缓存
[root@localhost yum.repos.d]# yum makecache
[5] 更新系统
[root@localhost yum.repos.d]# yum -y update
- 关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
安装Apache
yum -y install httpd
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动
在客户端浏览器中打开服务器IP地址,会出现下面的界面,说明apache安装成功
安装MariaDB(就是mysql)
yum -y install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
systemctl start mariadb.service #启动MariaDB
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重启MariaDB
systemctl enable mariadb.service #设置开机启动
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝覆盖配置文件
为root账户设置密码
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!
MySql密码设置完成
给root 远程访问授权
mysql -uroot -proot
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
systemctl restart mariadb.service #重启MariaDB
用mysql客户端连接测试
安装PHP