Quick 'n' Easy LAMP Server For CentOS/RHEL
|
Submitted by olddocks (Contact Author) (Forums) on Wed, 2008-05-28 19:16. :: CentOS | Apache | MySQL | PHP
Quick 'n' Easy LAMP Server For CentOS/RHELThis tutorial shows a quick way of installing a LAMP server (Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.) on CentOS and RHEL server systems.
GoalTo set up a LAMP server on a fresh VPS/Dedicated server running CentOS 5.0 with atleast 256mb of RAM. We will also be installing Webmin, a free server control panel for linux. If you are using a Debian/Ubuntu refer to this article.
Install ApacheApache is the most popular Web HTTP server for a Linux servers. yum install httpd httpd-devel We might need the httpd-devel libraries to compile and install other modules from the sources, just to be on the safer side. /etc/httpd/conf/httpd.conf - Apache configuration file location. /etc/init.d/httpd start
Install MySQL Database ServerMySQL is a widely used open source database server on most Linux servers and can very well integrate to PHP and Apache server on CentOS/RHEL. yum install mysql mysql-server mysql-devel If you attempt to type mysql in command prompt, you will be getting this nasty error. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ This is because you are not running the mysqld daemon before launching the mysql client. The file /var/lib/mysql/mysql.sock will be automatically created upon running the first instance of mysql. To fix: First start the mysql daemon, then type mysql: /etc/init.d/mysqld start
Changing MySQL Root PasswordBy default the root password is empty for the mysql database. It is a good idea to change the mysql root password to a new one from a security point of view. mysql> USE mysql; Once done, check by logging in: mysql -u root -p
To Create A New MySQL UserTo create a new mysql user 'guest' with 'all privileges' on the database 'demo': mysql > create database demo That's it! MySQL is ready! Don't forget to remember the root password as we might be using it with phpmyadmin.
Install PHP5 Scripting LanguageInstalling PHP5 with the necessary modules is so easy and can be configured for both the Apache and mysql environment. yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml Don't forget to install php-gd (gd library). It is very important if we plan to run captcha scripts on our server and so as other which are dependent on mysql and other functions. Restart Apache to load php. /etc/init.d/httpd restart
To Test If PHP Is Working Or Not:Create a file named /var/www/html/test.php with the following phpinfo() function inside php quotes. // test.php <?php phpinfo(); ?> Then point your browser to http://ip.address/test.php. That's it! You should see a php configuration file displaying all kind of paths and installed modules. Closely observe the installed configuration on your server. * PHP Paths (php.ini path)
Install phpMyAdminphpMyAdmin is a free web based MySQL database Administration Tool. Without phpMyAdmin it is almost impossible to mysql db operations in the command line. phpMyAdmin has become so convenient and it is absolutely sought by most webmasters to be present along with the mysql server. yum install phpmyadmin Point your browser to: http://ip.address/phpmyadmin.
Common ErrorsYou might encounter the following errors while configuring phpmyadmin. Forbidden To fix: Edit the /etc/httpd/conf.d/phpmyadmin.conf and uncomment the line deny from all. nano /etc/httpd/conf.d/phpmyadmin.conf <Directory "/usr/share/phpmyadmin"> Order Deny,Allow # Deny from all Allow from 127.0.0.1 </Directory>
Error To fix: nano /usr/share/phpmyadmin/conf.inc.php Look for a line and enter any password. Just dont leave it empty! $cfg['blowfish_secret'] = 'mydemopass'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ It worked for me using the above methods!
Install WebminWebmin a free server hosting control panel for Linux. It is a web based hosting administration tool and can be handy to tweak settings in your server if you are a beginner to Linux! You can download webmin here. Since webmin cannot be installed using yum, we can download an RPM package and install it on our server. wget <webmin rpm path> That should be a pretty easy installation! Remember webmin uses port 10000 and should not be blocked by your firewall. Point your browser to: http://ip.address:10000 You should see a webmin login. But we don't know the login and password yet! To set up the webmin password run the script below... /usr/libexec/webmin/changepass.pl /etc/webmin admin <newpasswd> Log in with the admin username and new webmin password! /etc/webmin/uninstall.sh
Final StepsWe want the Apache and mysql to be loaded at every boot so we switch them on using chkconfig: chkconfig httpd on You can also place comments in my blog. I would appreciate any feedbacks as well! This tutorial was written and contributed to HowToForge by Mr.Balakrishnan who currently runs MySQL-Apache-PHP.com. Permission is fully granted to copy/republish this tutorial in any form, provided a source is mentioned with a live link back to the authors site.
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
14 hours 51 min ago
19 hours 15 min ago
21 hours 54 min ago
23 hours 15 min ago
1 day 3 hours ago
1 day 4 hours ago
1 day 5 hours ago
1 day 6 hours ago
1 day 6 hours ago
1 day 10 hours ago