Linux under apache+mysql+php RPM package installation Implementation Discuz Forum

Source: Internet
Author: User
Tags egrep

1. Environmental Statement and preparation

[[email protected] ~]# yum list | egrep -i  "(httpd|mysql|php)"  |  grep  ' installed ' This system is not registered with rhn. rhn support will be disabled.httpd.i386                                 2.2.3-11.el5            installed       mysql.i386                                 5.0.22-2.1.0.1         installed        mysql-server.i386                         5.0.22-2.1.0.1          installed       perl-DBD-MySQL.i386                        3.0007-1.fc6           installed        php.i386                                   5.1.6-15.el5           installed        php-cli.i386                               5.1.6-15.el5           installed        php-common.i386                           5.1.6-15.el5            installed       php-mysql.i386                             5.1.6-15.el5            installed       php-pdo.i386                               5.1.6-15.el5            installed       [[email protected] ~]# 


Description

First, apache+mysql+php all use yum source installation complete, you can mount the installation of ISO CD-ROM, made into a yum source.

My yum configuration file is listed below for your reference.

[Email protected] ~]# Cat/etc/yum.repos.d/mytest1.repo [mytest1]name=myyumtest1baseurl=file:///home/yum/cdrom/ Serverenabled=1gpgcheck=0[[email protected] ~]#


Second, about the configuration of Apache.

For a detailed analysis of Apache httpd, refer to my blog:

http://zhangfengzhe.blog.51cto.com/8855103/1545425

What needs to be explained here is that I will be experimenting with a virtual host based on ServerName. The configuration is as follows:

[Email protected] ~]# cat/etc/httpd/conf.d/myhttpd.conf namevirtualhost 192.168.204.88:80<virtualhost 192.168.204.88:80> documentroot/web/v1/servername www.zfz1.com errorlog logs/www.zfz1.com-error_log Cu Stomlog logs/www.zfz1.com-access_log common</virtualhost><virtualhost 192.168.204.88:80> DocumentRoot/ Web/v2/servername www.zfz2.com errorlog logs/www.zfz2.com-error_log customlog Logs/www.zfz2.com-access_log Co Mmon</virtualhost>[[email protected] ~]#

Of course, you need to configure the hosts in the client, the servername and IP to match the relationship.


Third, about the configuration of MySQL.

For MySQL installation and getting started using, you can refer to my blog:

http://zhangfengzhe.blog.51cto.com/8855103/1547611

It is important to note that the user's access authorization:

mysql> show grants for  ' root ' @ '% '; +---------------------------------------------------- ----------------------------------------------------------------------------+| grants for [ email protected]%                                                                                                                    |+------------------------------------------------------------------------ --------------------------------------------------------+| grant all privileges on *.* to  ' root ' @ '% '  IDENTIFIED BY PASSWORD  ' *a488bc0454fa2fd261762bd37034100fff0b0510 '  with grant  option | +------------------------------------------------------------------------------------ --------------------------------------------+1 row in set  (0.00 sec) mysql>


Because PHP needs to access MySQL, the Php-mysql package needs to be installed. Like accessing Oracle,mysql in JDBC, etc.

Database when need to provide the same driver jar.



2.Test LAMP

After the first stage of the lamp platform is built, we should test the lamp to make sure that they work together.


The first step is to start httpd,mysql.

[[email protected] ~]# service httpd startstarting httpd:                                               [  OK  ][[email protected] ~]# service  mysqld startstarting mysql:                                              [  OK   ][[email protected] ~]# [[email protected] ~]# netstat -tnlp |  egrep  ' (80|3306) ' tcp        0       0 0.0.0.0:3306                0.0.0.0:*                     Listen      3686/mysqld         tcp         0      0 :::80                         :::*                          listen      3566/ httpd          [[email protected] ~]#

It can be found that the httpd,mysql has started normally and is listening at the specified port.


The second step is to test httpd with PHP.

[Email protected] v2]# Cd/web/v2[[email protected] v2]# cat test.php <?phpphpinfo ();? >[[email protected] v2]#

Test access is as follows:


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/48/A7/wKiom1QKZR6wGLEaAAKKu9eW6I4889.jpg "title=" 001. PNG "alt=" wkiom1qkzr6wgleaaakku9ew6i4889.jpg "/>


Explains that Apache can already interact with PHP.


The third step is to test the apache,mysql,php.

[Email protected] v2]# Pwd/web/v2[[email protected] v2]# cat index.php <?php#phpinfo (); $con =mysql_connect (' 192.168.204.88 ', ' root ', ' Zhangfengzhe '); if (! $con) {echo "Can not connect to MySQL";} mysql_select_db ("MYDB1", $con); $result = mysql_query ("SELECT * from users"); ><table border= ' 1 ' ><?phpwhile ($row = mysql_fetch_array ($result)) {echo ' <tr><td> ', $row [' ID '  ], "</td><td>", $row [' name '], "</td></tr>"; }mysql_close ($con);? ></table>[[email protected] v2]#


The test access results are as follows:


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/48/A9/wKioL1QKaq3CykgUAABPY0wPzJ4063.jpg "title=" 002. PNG "alt=" wkiol1qkaq3cykguaabpy0wpzj4063.jpg "/>

To view the MySQL database:

mysql> use mydb1; reading table information for completion of table and column  Namesyou can turn off this feature to get a quicker startup  with -adatabase changedmysql> show tables;+-----------------+| tables_in_ mydb1 |+-----------------+| users           |  +-----------------+1 row in set  (0.00 sec) mysql> select *  from users;+------+----------+------+----------+| id   | name      | sex  | birthday |+------+----------+------+----------+| 001   | zhangsan | NULL | NULL     | | 002   | lisi     | NULL | NULL     | +------+----------+------+----------+2 rows in set  (0.00 sec) mysql> 


By now, lamp testing has been completed, and they are ready to work together.



3. Install the deployment Discuz

Enter www.discuz.net download Zip, you can choose the UTF-8 version.

upload the downloaded zip package to the Linux server, unzip it, copy all the files under the upload directory to/WEB/V1, and then access the Www.zfz1.com/install for installation.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/48/A8/wKiom1QKbsXCMqfcAAG7QBD8mFE363.jpg "title=" 003. PNG "alt=" wkiom1qkbsxcmqfcaag7qbd8mfe363.jpg "/>


In the installation process, you need to change the permissions on the directory, according to the prompts to modify the item.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/48/A8/wKiom1QKbhHwv2WrAAHFe8yFzj8664.jpg "title=" 004. PNG "alt=" wkiom1qkbhhwv2wraahfe8yfzj8664.jpg "/>


Specifies information about the database connection. In fact, this step will complete the creation of the database-related tables.


Once the installation is complete, you can access the front desk:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/48/A8/wKiom1QKb2uSal72AAG0GaVDdOU047.jpg "title=" 006. PNG "alt=" wkiom1qkb2usal72aag0gavddou047.jpg "/>


Background:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/48/A8/wKiom1QKb8aiTP1WAAG0xkjDjYk874.jpg "title=" 007. PNG "alt=" wkiom1qkb8aitp1waag0xkjdjyk874.jpg "/>


View MySQL Related information:

mysql> use luntan; reading table information for completion of table and column  Namesyou can turn off this feature to get a quicker startup  with -adatabase changedmysql> show tables;+-----------------------------------+|  Tables_in_luntan                   |+-----------------------------------+| pre_common_admincp_cmenu           | | pre_common_admincp_group           | | pre_common_admincp_member          | | pre_common_admincp_perm            | | pre_common_admincp_session        | | pre_common_admingroup             |  | pre_common_adminnote               | | pre_common_advertisement           | | pre_common_advertisement_custom   | | pre_common_banned                  |


At this point, our lamp not only built, but also deployed a forum application, it is so simple ~


This article is from the "I want to surpass myself" blog, please be sure to keep this source http://zhangfengzhe.blog.51cto.com/8855103/1549533

Linux under apache+mysql+php RPM package installation Implementation Discuz Forum

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.