捣鼓了一个星期各种踩坑,终于linux的centos的lamp安装完成

记的东西太多了,下载源码安装太坑了,直接yum安装,上代码

安装========================.
php
yum install epel-release 
yum install httpd -y(检测rpm -qa httpd)
yum install gcc gcc++ libxml2-devel
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w
测试:php test.php
mysql
1.下载mysql的repo源
$wget       http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2.安装mysql-community-release-el7-5.noarch.rpm包
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
3.安装mysql
$ sudo yum install mysql-server
根据提示安装就可以了,不过安装完成后没有密码,需要重置密码
4.重置mysql密码
$ mysql -u root
登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:
$ sudo chown -R root:root /var/lib/mysql
重启mysql服务
$ service mysqld restart
接下来登录重置密码:
$ mysql -u root  //直接回车进入mysql控制台
mysql > use mysql;
mysql > update user set password=password('123456') where user='root';
mysql > exit;

apache
yum install gcc-c++
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz  
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
wget http://mirrors.shu.edu.cn/apache//httpd/httpd-2.2.34.tar.gz
接下来:https://www.cnblogs.com/yuzhaokai0523/p/4382974.html
(httpd是apache后来演变的)
(卸载apache:https://www.cnblogs.com/w10234/p/6649040.html)
【apache的Include conf.modules.d/*.conf不用改了,免得引起错误】
posted @ 2018-01-18 10:25  蜗牛使劲冲  阅读(3)  评论(0编辑  收藏  举报  来源