装了好些次lamp环境了,都没好好总结下,现在总结下 ^ ^
1.替换163的yum源
1.检查系统版本
cat /etc/redhat-releas (我的版本是CentOS release 6.4 (Final))
cate /etc/issue
(附:查看系统配置常用命令 http://www.cnblogs.com/codewater/articles/1818210.html)
2.替换yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
mv CentOS6-Base-163.repo CentOs-Base.repo
(生成缓存)
yum clean all
yum makecache
3.查看是否已安装软件
rpm -qa | grep httpd
rpm -qa| grep mysql
rpm -qa|grep php
4.安装
安装httpd: yum install httpd
安装mysql:
yum install mysql mysql-server mysql-devel mysql-libs
/etc/init.d/mysqld start
mysql_secure_installation (安全初始化mysql)
安装php与php扩展:
yum install php
yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo
yum -y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear
yum -y install php-pecl-memcache php-eaccelerator
启动httpd:
/etc/init.d/httpd start
设置自启动httpd、mysql:
chkconfig --levels 235 httpd on
chkconfig --levels | grep httpd
chkconfig --levels 235 mysqld on
chkconfig --levels | grep mysqld
5.测试
用phpinfo()测试安装是否成功
附:阿里云lnamp一键安装包: http://help.aliyun.com/view/11108189_13435438.html?spm=5176.7224445.1997283057.5.La9FTo