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 http://localhost/test.php
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 http://packages.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
=> 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.
Monday, November 3, 2008
Setup LAMP (Linux, Apache, Mysql, PHP) server on Linux / CentOS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment