Yum Install lamp

Source: Internet
Author: User
Tags apache php

Lamp is the abbreviation of linux,apache,mysql,php. This tutorial is mainly about installing an Apache Web server with PHP and MySQL support in CentOS.

Add external sources to keep MySQL and php up to date

Because the system basic source of MySQL and PHP program is older, so we add a newer external source.

    1. # RPM--import Http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
    2. # Vi/etc/yum.repos.d/centos-base.repo

Add the following information at the bottom

    1. [Utterramblings]
    2. Name=jason ' s utter ramblings Repo
    3. baseurl=http://www.jasonlitka.com/media/el$releasever/$basearch/
    4. Enabled=1
    5. Gpgcheck=1
    6. Gpgkey=http://www.jasonlitka.com/media/rpm-gpg-key-jlitka
Install MySQL

Run the Yum program to install MySQL

    1. Yum install MySQL Mysql-server

Add the MySQL entry boot entry (so that MySQL starts automatically when the system starts) and start the MySQL server immediately:

    1. Chkconfig--levels 235 mysqld on
    2. /etc/init.d/mysqld start

To set the MySQL root account password:

    1. Mysql_secure_installation
  1. Note:running all PARTS of this SCRIPT are RECOMMENDED for all MySQL
  2. SERVERS in PRODUCTION use! Please READ each STEP carefully!
  3. In order to log into MySQL to secure it, we'll need the current
  4. Password for the root user. If you ' ve just installed MySQL, and
  5. You haven ' t set the root password yet, the password would be blank,
  6. So, should just press ENTER here.
  7. Enter current password to root (enter for none):
  8. OK, successfully used password, moving on ...
  9. Setting The root password ensures that nobody can log into the MySQL
  10. Root user without the proper authorisation.
  11. Set root Password? [y/n] <--ENTER
  12. New Password: <--your MySQL root password
  13. Re-enter new password: <--your MySQL root password
  14. Password Updated successfully!
  15. Reloading privilege tables.
  16. ... success!
  17. By default, a MySQL installation have an anonymous user, allowing anyone
  18. To log into MySQL without has to has a user account created for
  19. them. This was intended only for testing, and the installation
  20. Go a bit smoother. You should remove them before moving into a
  21. Production environment.
  22. Remove anonymous users? [y/n] <--ENTER
  23. ... success!
  24. Normally, Root should only is allowed to connect from ' localhost '. This
  25. Ensures that someone cannot guess at the root of password from the network.
  26. Disallow Root login remotely? [y/n] <--ENTER
  27. ... success!
  28. By default, MySQL comes with a database named ' test ' that anyone can
  29. Access. This was also intended only for testing, and should be removed
  30. Before moving into a production environment.
  31. Remove test database and access to it? [y/n] <--ENTER
  32. -Dropping test database ...
  33. ... success!
  34. -Removing privileges on test database ...
  35. ... success!
  36. Reloading the privilege tables would ensure that all changes made so far
  37. would take effect immediately.
  38. Reload privilege tables now? [y/n] <--ENTER
  39. ... success!
  40. Cleaning up ...
  41. All done! If you've completed all of the above steps, your MySQL
  42. Installation should now is secure.
  43. Thanks for using mysql!
Installing Apache

Apache is available in the CentOS package, so we can use Yum to install:

    1. Yum Install httpd

Set the system to boot from Apache when booting

    1. Chkconfig--levels 235 httpd on

and start Apache

    1. /ETC/INIT.D/HTTPD start

Now that you type http://192.168.0.100 directly in your browser, you should see the Apache test page.

Install PHP

We can install PHP and Apache PHP modules according to the following command:

    1. Yum Install PHP

Then restart the Apache server:

    1. /ETC/INIT.D/HTTPD restart
Install related modules using PHP support MySQL

In order for PHP to support MySQL, we can install the Php-mysql package. You can also install other PHP modules. You can use the following command to search for available PHP modules:

    1. Yum Search PHP

Select some of the modules you need to install:

    1. Yum install php-mysql Php-common php-mbstring php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Add Apache support PHP:
Edit/etc/httpd/conf/httpd.conf, add:

    1. AddType application/x-httpd-php. php

Now restart Apache:

    1. /ETC/INIT.D/HTTPD restart
Installing phpMyAdmin

phpMyAdmin is a visual management software for your MySQL database.
The installation is simple and the download is extracted to the root directory.
: http://www.phpmyadmin.net/home_page/downloads.php
Then we configure phpMyAdmin, in order to use phpMyAdmin not only to allow the localhost connection, we modify the Apache configuration.

    1. Vi/etc/httpd/conf.d/phpmyadmin.conf

Fill in the following content:

    1. #
    2. # WEB application to manage MySQL
    3. #
    4. #<directory "/usr/share/phpmyadmin" >
    5. # Order Deny,allow
    6. # Deny from all
    7. # Allow from 127.0.0.1
    8. #</directory>
    9. Alias/phpmyadmin/usr/share/phpmyadmin

To restart Apache:
/ETC/INIT.D/HTTPD restart
Then you can get into phpMyAdmin by HTTP://IP address/phpmyadmin/.

This article out to: https://www.centos.bz/2011/04/centos-yum-install-lamp-apache-mysql-php for reference

Yum Install lamp

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.