本文共 1569 字,大约阅读时间需要 5 分钟。
centos7.6快速搭建lamp环境调试过程
最小化安装系统后先更新
[root@Server ~]# yum update -y
[root@Server ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)[root@Server ~]# uname -r
3.10.0-957.10.1.el7.x86_64关闭防火墙
systemctl stop firewalld.service关闭防火墙开机启动
systemctl disable firewalld.service关闭SELINUX (重启生效)
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config1.安装AMP
[root@Server ~]# yum install -y httpd mariadb-server php php-mysql2.启动服务及加入开机自启
[root@Server ~]# systemctl start httpd.service;systemctl start mariadb.service;systemctl enable httpd.service;systemctl enable mariadb.service3.设置mysql root密码
[root@Server ~]# mysql_secure_installation依次会有以下提示:提示输入密码,没有密码就直接回车(新安装的默认没有密码)提示设置root user密码 Y 设置好密码生产环境建议删除系统创建的匿名用户 Y禁止root用户远程登录 Y删除test数据库 Y重载权限表 Y完成4.验证mysql (可选操作)
[root@Server html]# mysql -u root -p 输入你设置的root密码MariaDB [(none)]> show databases;MariaDB [(none)]> select user,host from mysql.user;MariaDB [(none)]> exit;5.创建info.php 并测试 (可选操作)
访问 如果出现testing 123.. 页面 表示apche安装正确echo '<?php phpinfo();?>' >>/var/www/html/info.php
访问 如出现php信息页面 表示php安装正确6.将网站源码放在 /var/www/html/ 下 即可 (PHP扩展模块可按需自行安装)
至此LAMP环境搭建完成
附:安装samba 将网站目录共享 方便上传源码
[root@Server ~]# yum install -y samba
编辑smb.conf 在配置文件最下面 新增共享网站目录
[root@Server ~]vi /etc/samba/smb.conf [myshare]comment = mysharepath = /var/www/htmlwritable = yes保存退出创建samba的root用户密码:
touch /etc/samba/smbpasswdsmbpasswd -a root重启SMB服务并加入开机自启
[root@Server ~]# systemctl restart smb; systemctl enable smbwindows电脑访问验证
开始--运行 输入 \ip 输入密码即可访问转载于:https://blog.51cto.com/airsky/2383680