1. Install apache as web server. type command below on your teminal :
[root:~]# yum -y install httpd httpd-devel
configuration file is located at /etc/httpd/conf/httpd.conf
start service httpd :
[root:~]# /etc/init.d/httpd start
or type this :
[root:~]# service httpd start
to make sure apache installation is work properly, open your browser
and goto url :
http://your_ip_address
2. Install mysql as database server on your machine.
[root:~]# yum -y install mysql mysql-server mysql-devel
start service mysql :
[root:~]# /etc/init.d/mysqld start
open database mysql :
[root:~]# mysqlWelcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 4 to server version: 5.0.51a-logType 'help;' or 'h' for help. Type 'c' to clear the buffer.mysql>
type quit to exit from mysql.
set user and password for mysql
[root:~]# mysqladmin -u root password your_password
try login into mysql
[root:~]# mysql -u root -pEnter password: <=== password that you set before.
set user and password above is to secure your mysql installation, but if not secure enough try to follow each step below by typing :
[root:~]# mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MYSQLSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into mysql to secure it, we'll need the currentpassword for the root user. If you've just installed mysql, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): {just return}OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the mysqlroot user without the proper authorisation.You already have a root password set, so you can safely answer 'n'.Change the root password? [Y/n] yNew password: {passwordmysqlroot}Re-enter new password: {passwordmysqlroot}Password updated successfully!Reloading privilege tables..... Success!By default, a mysql installation has an anonymous user, allowing anyoneto log into mysql without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y... Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y... Success!By default, mysql comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] y- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y... Success!Cleaning up...All done! If you've completed all of the above steps, your mysqlinstallation should now be secure.Thanks for using mysql!
3. Install php
[root:~]# yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
edit file httpd.conf
[root:~]# vi /etc/httpd/conf/httpd.conf
and add this line below on DIrectoryIndex:
DirectoryIndex index.html index.html.var index.htm index.shtml index.cgi index.php index.php5 index.php4index.php3 index.pl index.aspx default.aspx
now, create file test.php on /var/www/html/ to check php installation
[root:~]# touch /var/www/html/test.php[root:~]# vi /var/www/html/test.php
put this on test.php :
phpinfo();?>
save and restart service httpd
[root:~]# /etc/init.d/httpd restart
use your browser to open url : http://your_ip_address/test.php
Congrats! LAMP Server installed on your machine.


No comments:
Post a Comment