installing apache2 with php5 and mysql support on centos 6.3 (lamp)

Upload: hsda1

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Installing Apache2 With PHP5 and MySQL Support on CentOS 6.3 (LAMP)

    1/4

    LAMP is short for L inux, Apache, M ySQL, PHP. This tutorial shows how you caninstall an Apache2 webserver on a CentOS 6.3 server with PHP5 support (mod_php)and MySQL support.

    I do not issue any guarantee that this will work for you!

    1 Preliminary Note

    In this tutorial I use the hostname server1.example.com with the IP address192.168.0.100. These settings might differ for you, so you have to replace them whereappropriate.

    2 Installing MySQL 5

    To install MySQL, we do this:

    yum install mysql mysql-server

    Then we create the system startup links for MySQL (so that MySQL startsautomatically whenever the system boots) and start the MySQL server:

    chkconfig --levels 235 mysqld on

    /etc/init.d/mysqld start

    Set passwords for the MySQL root account:

    mysql_secure_installation

    [root@server1 ~]# mysql_secure_installation

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALLMySQL

    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

    In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou 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):OK, successfully used password, moving on...

  • 7/30/2019 Installing Apache2 With PHP5 and MySQL Support on CentOS 6.3 (LAMP)

    2/4

    Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.

    Set root password? [Y/n]

  • 7/30/2019 Installing Apache2 With PHP5 and MySQL Support on CentOS 6.3 (LAMP)

    3/4

    Thanks for using MySQL!

    [root@server1 ~]#

    3 Installing Apache2

    Apache2 is available as a CentOS package, therefore we can install it like this:

    yum install httpd

    Now configure your system to start Apache at boot time...

    chkconfig --levels 235 httpd on

    ... and start Apache:

    /etc/init.d/httpd start

    Now direct your browser to http://192.168.0.100, and you should see the Apache2placeholder page:

    http://static.howtoforge.com/images/lamp_centos_6.3/big/1.pnghttp://static.howtoforge.com/images/lamp_centos_6.3/big/1.pnghttp://static.howtoforge.com/images/lamp_centos_6.3/big/1.pnghttp://static.howtoforge.com/images/lamp_centos_6.3/big/1.png
  • 7/30/2019 Installing Apache2 With PHP5 and MySQL Support on CentOS 6.3 (LAMP)

    4/4

    Apache's default document root is /var/www/html on CentOS, and the configuration fileis /etc/httpd/conf/httpd.conf. Additional configurations are stored in the

    /etc/httpd/conf.d/ directory.

    4 Installing PHP5

    We can install PHP5 and the Apache PHP5 module as follows:

    yum install php

    We must restart Apache afterwards:

    /etc/init.d/httpd restart

    Installing Apache2 With PHP5 And MySQL Support On CentOS 6.3 (LAMP) -Page 2

    http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.3-lamp-p2