Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2537657
  • 博文数量: 245
  • 博客积分: 4125
  • 博客等级: 上校
  • 技术积分: 3113
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-25 23:56
文章分类

全部博文(245)

文章存档

2015年(2)

2014年(26)

2013年(41)

2012年(40)

2011年(134)

2010年(2)

分类: LINUX

2012-02-14 17:25:30

From: http://cyberheight.blogspot.com/2008/11/setup-lamp-linux-apache-mysql-php.html

To setup LAMP server install a CentOS or Linux server and follow this step by step guide.

Install Apache

Apache is a the most popular Web HTTP server for a Linux servers.
Use this command on Terminal (Applications->Terminal), it will download and install Apache server

=> yum install httpd httpd-devel

To start Apache server use the following command:

=> /etc/init.d/httpd start


Install MySQL Database Server

MySQL is widely used open source database server on most linux servers and can very well integrated to PHP and Apache server in Centos/RHEL. To download/install mysql type the following command and press enter

=> yum install mysql mysql-server mysql-devel

Changing MySQL Root Password

By default the root password is empty for mysql database. It is a good idea to change mysql root password to a new one from security point of view. Use the following commands on Terminal.

=> /etc/init.d/mysqld start
=> mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;


Install PHP5 Scripting Language

Installing PHP5 with necessary modules is so easy and can be configured for both Apache and mysql environment. Use the following command to install PHP

=>yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

Restart the apache to load php.

=> /etc/init.d/httpd restart

To test PHP Working or not:
Create a file named /var/www/html/test.php with the following phpinfo() function inside php quotes.

// test.php


Then point your browser to

At this point mostly users get the error 403 - Permission denied, to resolve this problem use the following command

=> chown -R apache:apache /var/www/html

Now the owner of the folder is the current user.


Install phpMyAdmin

Since phpMyAdmin is not available by yum by default, you need to get the rpm and then yum it.

=> wget
=> rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
=> yum install phpmyadmin


Configure the Apache and MySQL to run during startup in CentOS

=> chkconfig httpd on
=> chkconfig mysqld on


Now pint your browser to localhost/phpmyadmin you will see the permission's error, to resolve this problem
edit the file /usr/share/phpmyadmin/config.inc.php.

=> vi /usr/share/phpmyadmin/config.inc.php

and put a blowfish secret
$cfg['blowfish_secret'] = 'secret';

Now refresh the browser and phpmyadmin will ask for user name and password, type root in user name and your newpassword in password field.
阅读(901) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~