LInux-Lamp搭建
一 yum安装(自动会下载依赖包)
(一)mysql安装
检测是否安装:
yum list installed mysql*
rpm -qa | grep mysql*
安装:
服务端:
yum install mysql-server -y
包:
yum install mysql-devel -y
mysql配置:
/etc/my.cnf中加入default-character-set=utf8
启动服务:
service mysqld start
或/etc/init.d/mysqld start
设置密码:
mysqladmin -u root password root
登陆:
mysql -u root -p
注意:(2)(3)最好直接安装php依赖安装上apache比较简单
(2)apcche安装
yum install httpd -y
启动服务:
[[email protected]_80_143_centos ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
修改:
vim /etc/httpd/conf/httpd.conf
ServerName 118.89.173.205:80
注意读这段话,意思这是默认页面,你需要注释file /etc/httpd/conf.d/welcome.conf和www/html为根目录
vim /etc/httpd/conf.d/welcome.conf
重启
(3)php安装(apache和php有依赖关系,先安装php会自动安装httpd,这样直接支持php)
yum install php -y
配置apache支持php:
vim /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
(4)安装phpmysql拓展
yum php-mysql
二 二进制安装
参考网址:http://www.cnblogs.com/yangxia-test/p/4174372.html
mysql错误解决参考:http://support.moonpoint.com/software/database/mysql/not-running-centos7.php