CentOS LAMP installation and configuration

Source: Internet
Author: User

 

Environment: Ubuntu11.04 desktop Virtualbox4.0 CetnOS 5.5

LAMP has been installed on Ubuntu and has never been installed on CentOS. It seems that both of them are the same and convenient.

Step 1: install apache mysql php

# Yum install httpd-devel mysql-server mysql-devel php-y

// Install the apacher server, the database required by the apacher, And the included files, the MySQL server, the library required by MySQL, And the included files, and the PHP

System prompt:

Installing

Httpd-devel, mysql-server, mysql, mysql-devel, php

Installing for dependencies:

Apr-devel, apr-util-devel, cyrus-sasl-devl, db4-devel, e2fsprogs-devel, expat-devel, gcc, glibc-debel, glibc-headers, kernel-headers, keyutils- libs-devel, krb5-devel, libselinux-devel, libsepol-devel, openldap-devel, openssl-devel, perl-DBD-MySQL, perl-DBI, php-cli, php-common, zlib-devel,

 

Step 2: Configure MySQL

Create mysql startup Link

Chkconfig -- levels 235 mysqld on // mysql will start as the system starts

 

Start mysql

# Etc/init. d/mysqld start

Set the password for the root user:

# Mysql_secure_installation

System prompt:

In order to log into MySQL to secure it, we'll need the current

Password for the root user. If you 've just installed MySQL, and

You haven't set the root password yet, the password will be blank,

So you shoshould just press enter here.

Enter current password for root (enter for none): (generally, mysql is installed, and root does not have a password. Enter directly here)

Setting the root password ensures that nobody can log into the MySQL

Root user without the proper authorisation.

Set root password? [Y/n] Y

New password: 12345678 // set a New password

Re-enter new password: 12345678 // confirm the password again

Then Enter all the way.

Step 3: Test apache and php

Create an httpd startup Link

Chkconfig -- levels 235 httpd on

Start apache

/Etc/init. d/httpd start

Apache test: Enter the Server IP address in the browser and open the apache classic page. OK! Apache is running normally (if a firewall is enabled, do not forget to allow www in the firewall ).

PHP test: Create a php.info File

Vim/var/www/html/info. php

<?

Phpinfo ();

?>

Enter http: // IP/info. php In the browser to view the test page.

Step 4: Let PHP support mysql

Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring

System prompt: (install the following Software Package)

Installed:

Php-gd.i386. 1.6-27. el5_5.3 php-imap.i386. 1.6-27. el5_5.3 php-ldap.i386. 1.6-27. el5_5.3

Php-mbstring.i386. 1.6-27. el5_5.3 php-mysql.i386. 1.6-27. el5_5.3 php-odbc.i386. 1.6-27. el5_5.3

Php-pear.noarch. 4.9-6. el5 php-xml.i386. 1.6-27. el5_5.3 php-xmlrpc.i386. 1.6-27. el5_5.3

Restart httpd after installation

#/Etc/init. d/httpd restart

Enter http: // IP/info. php In the browser to view the mysql module.

Step 5: Install phpmyadmin

In centos, phpmyadmin cannot be installed using yum install. You must first add

Wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

In this step, my server will not work, because I am going to connect through the ISA proxy, here I will report the error HTTP request sent. awaitiing response ...... ERROR 504: proxy Timeout (\ 350 \ 277 \ 236 \ 346 \ 216 \ 245 \ 350 \ 266 \ 205 \ 346 \ 227 \ 266 \ 343 \ 200 \ 202 \ 346 \ 234 \ 211 \ 345 \ 205 \ 263 \ 346 \ 255 \ 244 \ 344 \ 272 \ 213 \ 344 \ 273 \ 266 \ 347 \ 232 \ 204 \ 346 \ 233 \ 264 \ 345 \ 244 \ 232 \ 344 \ 277 \ 241 \ 346 \ 201 \ 257 \ 357 \ 274 \ 214 \ 350 \ 257 \ 267 \ 345 \ 217 \ 202 \ 351 \ 230 ISA \ 205 \ 234 \ 215 \ 345 \ 212 \ 241 \ 345 \ 231 \ 250 \ 345 \ 270 \ 256 \ 345 \ 212 \ 251 \ 346 \ 226 \ 207 \ 344 \ 273 \ 266 \ \ 343 \ 200 \ 202)

 

There is no way to download one locally and upload it to the server for installation.

Rpm-Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Then

Yum install phpmyadmin

The system prompts that the following packages will be installed

Installed:

Phpmyadmin. noarch 0: 2. 11.11.3-2. el5.rf

Dependency Installed:

Libmcrypt. i386 2. 5.8-4. el5.centos php-mcrypt.i386. 1.6-15. el5.centos. 1

Modify phpmyadmin. conf to allow users to log on remotely.

Vim/etc/httpd/conf. d/phpmyadmin. conf

Comment out all the following statements.

<Directory "/usr/share/phpmyadmin">

Order Deny, Allow

Deny from all

Allow from 127.0.0.1

</Directory>

Enter http: // IP/phpmyadmin in the browser and you will be able to see the phpmyadmin Management page. However, the system will prompt: "the configuration file now requires a password (blowfish_secret )."

 

There are two solutions: (the second method is recommended)

1. Configure config. inc. php under phpmyadmin to change the cookie to http

Vi/usr/share/phpmyadmin/config. inc. php

[...]

/* Authentication type */

$ Cfg ['servers'] [$ I] ['auth _ type'] = 'cooker ';

[...]

Open the browser and enter the management address. The logon window is displayed. Enter the user name and password and the password.

 

However, I am not used to it, and it will pop up again when I select to log out on the management interface, making people feel like logging out with a password.

2. Compare the configuration of phpmyadmin In ubuntu. There is such a configuration in config. inc. php In ubuntu.

// Load secret generated on postinst

Include ('/var/lib/phpmyadmin/blowfish_secret.inc.php ');

Check/var/lib/phpmyadmin/blowfish_secret.inc.php. There is only one sentence.

& Lt ;? Php

$ Cfg ['blowfish _ secret'] = 'w1hm7axcx5aqvutjvoygdepy ';

The "$ cfg ['blowfish _ secret'] =" statement in phpmyadmin installed in CentOS is in config. inc. php.

Vim/usr/share/phpmyadmin/config. inc. php

Find

$ Cfg ['blowfish _ secret'] = '';/* you must fill in this for cookie auth! */

Add any character after =

$ Cfg ['blowfish _ secret'] = centos '';/* you must fill in this for cookie auth! */

Centos is a random character.

Restart httpd and then open the management page.

 

Still look at this habit, but then enter the root and password, the system prompts me root @ localhost password error: error 'Access denied for user 'root' @ 'localhost' (using password: NO), it is always unable to enter, so the browser's cookie is cleared and then enters the normal

PS: I couldn't have used this for so many days. Half of this was my problem. Half was virtualbox's problem. The first day I installed centos5.5 on virtualbox, I suddenly remembered that virtualbox didn't mean I upgraded it? I upgraded from 4.0 to 4.1, modified some bugs, and added several features, so I started to upgrade it in a boring situation, and then started LAMP, half Done something to go out and thought about taking a snapshot first. The cup started to happen, and the virtualbox crashed as soon as the snapshot was taken. Without any prompts, The virtualbox was opened, the CentOS that just installed and just finished up is missing ...... I only left a large white box and a sentence. Simply put, I told you that the GAME is OVER. When I enter the log, I just said that the centos. vbox file could not run normally ...... % ¥ -...... % ¥, Bad mood ......

This article is from the blog "qingting ".

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.