1.安装mysql
[root@zhangchuan ~]# yum install mysql mysql-server
添加mysql开机启动
[root@zhangchuan ~]# chkconfig mysqld on
启动mysql
[root@zhangchuan ~]# /etc/init.d/mysqld start
设置 MySQL 数据 root 账户的密码:
[root@zhangchuan ~]# mysql_secure_installation
当出现如下提示时候直接按回车:
Enter current password for root
出现如下再次回车:
Set root password? [Y/n]
出现如下提示输入你需要设置的密码,回车后在输入一次确认:
New password:
接下来还会有四个确认,分别是:
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
直接回车即可。
更改mysql的用户名:
mysql的用户都存在mysql数据库的user表中,
据说默认使用root用户不是很安全,
使用update user set user=’mysqlroot’更换用户名即可。
但别忘了刷新权限:flush privileges;
2.安装apache
[root@zhangchuan ~]# yum install httpd
添加apache开机启动:
[root@zhangchuan ~]# chkconfig httpd on
启动apache:
[root@zhangchuan ~]# /etc/init.d/httpd start
在 CentOS 中 Apache 的默认根目录是 /var/www/html,
配置文件 /etc/httpd/conf/httpd.conf。
其他配置存储在 /etc/httpd/conf.d/ 目录
3.安装php:
[root@zhangchuan ~]# yum install php
重启apache
[root@zhangchuan ~]# /etc/init.d/httpd restart
测试php
[root@zhangchuan ~]# vi /var/www/html/info.php
4.php相关模块安装:
[root@zhangchuan ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
重启apache
[root@zhangchuan ~]# /etc/init.d/httpd restart
5.memcahced安装:
网上有的说要导入memcache库,但我安装的时候就是直接安装的,可能是centos版本不同
我的是CentOS release 6.3 (Final),内核为:2.6.32-279.el6.x86_64
关于导入包的的步骤可以查看:http://www.bootf.com/442.html
[root@zhangchuan ~]# yum install memcached php-pecl-memcache
添加memcache开机启动:
[root@zhangchuan ~]# chkconfig memcached on
启动memcached:
[root@zhangchuan ~]# /etc/init.d/memcached start
重启apache:
[root@zhangchuan ~]# /etc/init.d/httpd restart
测试php的memcache是否安装成功:
connect('127.0.0.1', 11211);
$memcache->set('key', 'hello memcache!', 0, 60);
$result = $memcache->get('key');
echo $result;
?>
6. jdk安装:
yum install java-1.7.0-openjdk*