"CentOS" builds a Web server

Source: Internet
Author: User
Tags apache log

Resources:

Http://www.paipat.com/?post=24

Http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html

1. Installing Apache

2. Install PHP

3. Install MySQL

1. Installing Apache

    • Installation: Installing Apache:yum install httpd directly with Yum

RPM using:

Format: Rpm-q "sub-option" "Software name"

Usage: Complete different queries with different sub-options

-QA: View a list of all RPM packages installed on the system

-qi: View detailed information for the specified software

-QL: Query execution package installed directory, file list

-QC: Querying only the configuration files for the specified package installation

-QD: Displays only documentation files for the specified package installation

    • Configuration:
      #service httpd Restart [start] [stop]//Restart, start, close Apache
      /ETC/HTTPD/CONF/HTTPD.CONF//Apache configuration information
      /VAR/LOG/HTTPD//Apache log information

Boot start: Chkconfig httpd on [off]

    • Error

Workaround:

Modify/etc/httpd/conf/http.conf Add ServerName localhost:80

    • Test

Browser input: http://127.0.0.1:80 or http://localhost:80

2. Install PHP

    • Installation

#yum Install PHP//installation PHP module
#yum Install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc//install PHP to support these components
#yum install Php-mysql//php support MySQL

    • Test

To create a modified/var/www/html/test.php file:

<?php phpinfo ();?>

Browser view http://localhost/test.php can display PHP page normally

3. Install MySQL

    • Uninstall MySQL
[Email protected] ~]# Rpm-qa | grep MySQL//check to see if MySQL is installed
[[email protected] ~]# rpm-e mysql//normal Delete mode    [[email protected] ~]# rpm–e  --nodeps mysql//brute force Delete mode
After the deletion we can pass Rpm-qa | grep mysql command to see if MySQL has been uninstalled successfully
    • Install MySQL

Enter Yum List | grep mysql command to view the downloadable version of the MySQL database available on Yum:

      [email protected] ~]# Yum List | grep MySQL

Downloadable version information for the MySQL database on the Yum server:

Enter the Yum install-y mysql-server mysql mysql-devel command to install the MySQL mysql-server mysql-devel.

[email protected] ~]# yum install-y mysql-server MySQL mysql-devel

[Email protected] ~]# Rpm-qi mysql-server

We installed the Mysql-server is not the latest version, if you want to try the latest version, then go to the MySQL website to download rpm package installation, so that our MySQL database has been installed.

    • MySQL Initialization and configuration

[[email protected] ~]# service mysqld start [restart] [stop]//Start, restart, stop MySQL

[[email protected] ~]# mysqladmin-u root password ' root '//Use this command to set the root account password to root

At this point we can log in to our MySQL database via the mysql-u root-p command.

    • MySQL configuration file

1,/etc/my.cnf This is the main configuration file of MySQL

2, /var/lib/mysql mysql database database file storage location

The database files for our MySQL database are usually stored in the/ver/lib/mysql directory.

3. /var/log MySQL database log output storage location

Some of our MySQL database's log output is stored in the/var/log directory

4. View MySQL port number

View the network ports for MySQL snooping

Command query port number in MySQL

    • Problem

Mysqladmin:connect to server at ' localhost ' failed error: ' Access denied for user ' root ' @ ' localhost ' (using Password:no )‘

Workaround:

1, Service mysqld stop//Stop mysqld

2. Login with Safe mode, Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &

3. Mysql–u root mysql //Login

4. Change Password update user set password =password(new_passwd) where user= ' root ';

5. Restart MySQL and log in again

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.