1、安装Apache:
#yum update #yum install httpd
修改配置文件:/etc/httpd/conf/httpd.conf
#ServerName www.example.com:80 ServerName localhost:80 #AddDefaultCharset UTF-8 AddDefaultCharset off
安装当前版本的Apache配置环境,然后配置httpd.conf(位置在/etc/httpd/conf/httpd.conf)文件,一般如何类似Linode 1GB方案可以这样的设置,也可以默认。
KeepAlive Off ......StartServers 2 MinSpareServers 6 MaxSpareServers 12 MaxClients 80 MaxRequestsPerChild 3000
设置开机自动启动:
chkconfig --levels 235 httpd on
如果安装完成后,到浏览器中访问localhost或者127.0.0.1 ,会看到apache默认的欢迎界面和相关的介绍信息
2、安装PHP
#yum install php php-pear
开启GD库的支持
#yum install php-gd
安装PHP环境,然后配置/etc/php.ini文件。
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR display_errors = Off log_errors = On error_log = /var/log/php/error.log max_execution_time = 30 memory_limit = 128M register_globals = Off max_input_time = 30 #request_order = "GP" request_order = "CGP"
用vi寻找上述的几个参数,然后对应进行修改参数,保存退出。
#mkdir /var/log/php #chown apache /var/log/php
创建日志文件,如果我们需要支持MYSQL在PHP中,需要输入下面的命令安装php5-mysql包。
# yum install php-mysql # /etc/init.d/httpd restart
安装并设置启动。
3、安装MySQL
#yum install mysql-server #service mysqld restart
安装设置ROOT权限,根据提示设置ROOT密码
#mysql_secure_installation
可以移除默认的其他用户和其他默认数据。
用户及权限设置:
mysql -uroot -p use mysql; update user set Password=PASSWORD('123456') where User='root'; GRANT ALL PRIVILEGES ON *.* TO root@"%.%.%.%" IDENTIFIED BY "123456"; GRANT select,insert,update,delete on tlbbdb.* to tlbb_123456@"%" identified by "yang123456"; GRANT ALL PRIVILEGES ON *.* TO yangweixu@"%.%.%.%" IDENTIFIED BY "yangweixu1986"; flush privileges; exit
安装驱动包:
#yum install -y mysql-connector-odbc
数据库自动启动:
chkconfig --level 3 mysqld on
最后, 重启Apache,
service httpd restart