LAMP Study Notes for CentOS 6.5

Source: Internet
Author: User

Learning notes for LAMP installation and configuration in CentOS 6.5.

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment

1. Install related software and dependent packages in Yum.

Yum install httpd-devel mysql-server mysql-devel php-mysql php-common php-gd libjpeg * php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

[Root @ lamp ~] # Chkconfig httpd on

[Root @ lamp ~] # Chkconfig mysqld on


[Root @ lamp ~] # Service httpd start

Startinghttpd: httpd: cocould not reliably determine the server's fullyqualified domain name, using lamp.test.com for ServerName

[OK]

[Root @ lamp ~] # Service mysqld start

Startingmysqld: [OK]

[OK]

2. Now, you can open http: // localhost or http: // 127.0.0.1 in the browser to see The Apache2 Test Page.

3. Install phpmyadmin to manage the mysql database.

[Root @ lamptmp] # wgethttp: // response


[Root @ lamptmp] # tar zxvf phpMyAdmin-4.1.12-all-languages.tar.gz

[Root @ lamptmp] # Music phpMyAdmin-4.1.12-all-languages/var/www/html/phpmyadmin

[Root @ lamptmp] # cd/var/www/html/phpmyadmin/

[Root @ lampphpmyadmin] # cp config. sample. inc. php config. inc. php

[Root @ lampphpmyadmin] # vi config. inc. php

[Root @ lampphpmyadmin] # service httpd restart

4. Enter http: // 192.168.2.105/phpMyAdmin in the browser to view the phpMyAdmin logon interface. Enter the database username and password to log on to the phpMyAdmin system.

5. Understand the structure of apache2, which helps us configure the application:

/Etc/httpd/conf/httpd. conf: The main configuration file;

/Etc/httpd/conf. d /*. conf: This is a feature of CentOS. If you do not want to modify the original configuration file httpd. conf, other configurations are configured independently here. When apache is started, this file will be read into the main configuration file;

/Usr/lib/httpd/modules: apache supports many modules. The modules you want to use are stored in this directory by default;

/Var/www/html: the default "Homepage" Directory of CentOS;

/Var/www/error: the default system error message. If the host is set incorrectly or the data requested by the browser is incorrect, the error message displayed in the browser is based on the information here;

/Var/www/icons: provides some small icons of apache;

/Var/www/cgi-bin: The Directory of some executable CGI programs by default;

/Var/log/httpd: directory of log files. The files here are easy to increase and sufficient space is required;

/Usr/sbin/apachectl: This is the main execution file of Apache. The execution file is actually shellscript, which can actively detect some settings on the system, this makes Apache startup easier;

/Usr/sbin/httpd: This is the main apache binary file;

/Usr/bin/htpasswd: When you want to log on to some web pages, you need to enter your account and password. Apache itself provides the most basic password protection method. This command is used to generate the password.


6. mysql-related operations.


6.1 set the mysql password

[Root @ lamp ~] # Mysqladmin-u root password admin

6.2 reset the root password of the mysql database.

[Root @ lampetc] # service mysqld stop

Stoppingmysqld: [OK]

[Root @ lampetc] # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &

14033021: 19: 34 mysqld_safe Logging to '/var/log/mysqld. log '.

14033021: 19: 34 mysqld_safe Starting mysqld daemon with databases from/var/lib/mysql


Reset the root user password:

[Root @ lampetc] # mysql-u root mysql

Mysql> update user set password = password ("administrator") whereuser = "root ";

Mysql> flush privileges;

Mysql> quit


In this way, your root user password has been successfully reset, then the security mode is stopped, and MySQL is restarted normally:

[Root @ lampetc] # service mysqld stop

14033021: 18: 14 mysqld_safe mysqld from pid file/var/run/mysqld. pidended

Stoppingmysqld: [OK]

[1] + Done mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking


[Root @ lamp ~] # Service mysqld start

Startingmysqld: [OK]


6.3. Operate MySQL

[Root @ lamp ~] # Mysql-u root-p

Enterpassword:

Welcometo the MySQL monitor. Commands end with; or \ g.

YourMySQL connection id is 3

Serverversion: 5.1.73 Source distribution

...................................................................................................

Mysql>

At last, MySQL has several important directories and files:

/Etc/my. cnf: This is the Mysql configuration file, including mysql database optimization;

/Usr/lib/mysql: the directory where the MySQL database is stored. Make sure that the directory is completely backed up during Backup.

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.