12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-25 09:55:10
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
首先确保CentOS7上网络配置正确,可以正常访问互联网。确保已经关闭了iptables。CentOS7上是firewall,关闭命令:#systemctlstopfirewalld.service#停止firewalld服务#systemctld
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
首先
确保CentOS7上网络配置正确,可以正常访问互联网。
确保已经关闭了iptables。
CentOS7上是firewall,关闭命令:
#systemctlstopfirewalld.service#停止firewalld服务#systemctldisablefirewalld.service#设置开机默认不启动
确保selinux已经关闭。
#setenforce0#不重启系统的状态下关闭selinux(permissive状态)#getenforce#查看状态#vim/etc/sysconfig/selinux#开机不启动SELINUX=disabled
现在开始介绍快速搭建LAMP的过程。
1.yum源配置
在这里使用阿里云的yum源,命令行输入:
#wget-O/etc/yum.repos.d/CentOS-Base.repo#yummakecache生成缓存
2.安装Apache
#yuminstall-yhttpd#vim/etc/httpd/conf/httpd.conf#修改配置文件DirectoryIndexindex.htmlindex.php#在该项后面添加index.php,支持index.php主页AddTypeapplication/x-httpd-php.ph#添加php支持#vim/var/www/html/index.php#在默认主页存放的路径下,添加index.php的测试文件<?phpphpinfo();?>#systemctlstarthttpd.service#启动httpd#systemctlstatushttpd.service#查看运行状态#ss-ntlp#查看监听的端口#systemctlenablehttpd.service#设置开机启动
注意:如果是配置zabbix server的LAMP环境,配置文件里
DirectoryIndexindex.html#该项后面不要添加index.php
3.安装MariaDB
#yuminstall-ymariadb-server#yum安装MariaDB,在CentOS6yuminstallmysql-server#vim/etc/my.cnf#在[mysql-safe]部分添加skip_name_resolve=on#禁止域名解析innodb_file_per_table=on#修改InnoDB为独立表空间模式#systemctlstartmariadb.service#启动mariadb#systemctlenablemariadb.service#mysqladmin-urootpassword'dtsdts';#创建管理员密码#mysql_secure_installation#初始化安全设置#mysql-uroot-pdtsdts#root用户登录MariaDB[(none)]>CREATEDATABASEzabbixCHARSET'utf8';#创建zabbix库,默认字符集为utf8MariaDB[(none)]>GRANTALLONzabbix.*TOzbxuser@'127.0.0.1'IDENTIFIEDBY'zbxpass';MariaDB[(none)]>GRANTALLONzabbix.*TOzbxuser@'localhost'IDENTIFIEDBY'zbxpass';#zbxuser可以从本机登录,密码为zbxpass,对zabbix拥有所有权限MariaDB[(none)]>GRANTALLONzabbix.*TOzbxuser@'10.10.10.%'IDENTIFIEDBY'zbxpass';#zbxuser可以从10.10.10.0网段登录,密码为zbxpass,对zabbix拥有所有权限MariaDB[(none)]>flushprivileges;#刷新权限
4、安装php
#yuminstall-yphpphp-mysql#yuminstall-yphp-gdphp-xmlphp-processphp-mbstringphp-bcmath#安装php扩展组件
可以修改/etc/php.ini进行简单的php优化(非必要):
max_execution_time=300memory_limit=128Mpost_max_size=16Mupload_max_filesize=2Mmax_input_time=300date.timezonePRC
5、测试
#重启服务#systemctlrestarthttpd.service#systemctlrestartmariadb.service
浏览器访问验证:
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19