- 1. 安装Apahce, PHP, MySQL以及php连接mysql库组件。
\#yum -y install httpd php mysql mysql-server php-mysql
2. 安装apache扩展#yum -y install httpd-manual mod\_ssl mod\_perl mod\_auth\_mysql
3. 安装php的扩展
\#yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc4. 安装MySQL的扩展#yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql 5\. 配置开机启动服务
\#/sbin/chkconfig httpd on
\[设置apache服务器httpd服务开机启动\] \#/sbin/service httpd start \[启动httpd服务,与开机启动无关\] \#/sbin/service mysqld start \[启动mysqld服务,与开机启动无关\] apache的配置文件是/etc/httpd/conf下
modules放在/usr/lib/httpd下
php的配置文件在/etc/php.d/下 和/etc/php.ini
php的modules放在/usr/lib/php/modules下6. 安装Tomcat6
#yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
7. 启动Tomcat6
#service tomcat6 start
8. 在浏览器输入http://www.2cto.com :8080/,可以看到Apache SoftWare Foundation页,如果看不到,请确认是否是防火墙问题
可以用service tomcat6 stop命令停止tomcat
可以用chkconfig tomcat6 on指令于开机时启动tomcat
Tomcat5安装目录位于/user/share/tomcat59. Apache与Tomcat整合
如果网站需同时整合Apache与Tomcat可以使用JK或者Proxy方式
使用VI编辑proxy_ajp.conf文件
#vi /etc/httpd/conf.d/proxy_ajp.conf
输入以下内容
ProxyPass /tomcat/ ajp://localhost:8009/
存储文件后,重启Apache
#service httpd restart
10. 在浏览器输入http://你的IP/tomcat/,可以看到Apache SoftWare Foundation页
开始安装MySQL5
首先我们应该先用下面的命令安装MySQL:
yum install mysql mysql-server
然后我们需要创建MySQL系统的启动键链接启动MySQL服务器,这样以便于MySQL在系统启动时自动启动
为MySQL root帐户设置密码:
SSH Secure Shell 3.2.9 (Build 283)
Copyright (c) 2000-2003 SSH Communications Security Corp – http://www.ssh.com/
This copy of SSH Secure Shell is a non-commercial version.
This version does not include PKI and PKCS #11 functionality.
Last login: Wed Aug 14 15:56:26 2013 from 10.191.197.39
[root@NercDev ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
In order to log into MySQL to secure it, we’ll need the current
password for the root user.
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Enter current password for root (enter for none):
#我艹,装完MySql后默认的密码是空啊。。。是没有密码的。。大家一定要知晓啊!!!
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.
go a bit smoother.
production environment.
Remove anonymous users? [Y/n] y
Normally, root should only be allowed to connect from ‘localhost’.
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
By default, MySQL comes with a database named ‘test’ that anyone can
access.
before moving into a production environment.
Remove test database and access to it? [Y/n] y
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
Cleaning up…
All done!
installation should now be secure.
Thanks for using MySQL!
#到此
[root@NercDev ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.
Your MySQL connection id is 19
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show databases;
+——————–+
| Database
+——————–+
| information_schema |
| mysql
+——————–+
2 rows in set (0.00 sec)
mysql> exit
Bye
[root@NercDev ~]#
3.安装阿帕奇2
Apache2的是作为一个CentOS的软件包,因此我们可以直接用下面命令安装它:
现在配置系统在引导时启动Apache
并启动Apache
[root@NercDev ~]# vi /etc/httpd/conf/httpd.conf
找到www.example.com:80#ServerName
在下面添加上这么一行
最后一定要关掉防火墙 [root@NercDev ~]# service iptables stop
或者将80端口添加到防火墙里面
现在,您的浏览器到http://202.205.XXX.XXX,你应该看到Apache2的测试页:
Apache的默认文档根目录是在CentOS上的/var/www/html 目录 ,配置文件是/etc/httpd/conf/httpd.conf。配置存储在的/etc/httpd/conf.d/目录。
安装PHP5
我们可以安装PHP5和Apache的PHP5的模块如下:
现在,我们可以用浏览器访问例如http://202.205.XXX.XXX/info.php文件
正如你所看到的,PHP5的工作,它通过Apache 2.0的处理程序,在服务器API线。如果你继续向下滚动,你会看到所有在PHP5中已经启用的模块。MySQL是没有列出,这意味着我们没有在PHP5支持MySQL。
PHP5获得MySOL的支持
让PHP在MySQL中获得支持,我们可以安装的php-mysql软件包。安装一些其他的PHP5模块,以及您可能需要的应用程序,这是一个好主意:
还安装需要安装的
现在,重载http://202.205.XXX.XXX/info.php在您的浏览器,并再次向下滚动到模块部分。现在,你应该找到许多新的模块,包括MySQL模块:
安装phpMyAdmin
配置
评论区