LAMP is a platform that uses linux as operating system, apache as the Web server, mysql as the relational database management system and php as the scripting language.Thus it is of great importance. In some cases we also use pearl or python instead of php.
Installing
Apache
The first step is installing httpd package
#yum install httpd -y
Now start
the service
#systemctl start httpd
Now enable httpd service
#systemctl
enable httpd.service
To check it just open your browser and access http://localhost
Create
a MySQL/MariaDB Database
Now next step is installing mysql.Here iam using mysql-community package.So we want to create a repository for it.
First
create a mysql-repository
#vi
/etc/yum.repos.d/mysql-community.repo
[mysql57-community]
name=MySQL
5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Now reload the repository
#yum update
#yum repolist
Now
install mysql package and after that start the mysqld service
#yum
install mysql-community-server
#systemctl
start mysqld
#systemctl
enable mysqld
Once you
start and enable MySql service, it will generate temporary root password to
login, you can find the temp password in /var/log/mysqld.log
#cat
/var/log/mysqld.log | grep temporary
login using mysql command using
temp password and reset the password:
mysql –u
root -p
SET
PASSWORD FOR 'root'@'localhost' = PASSWORD('tiger');
flush
privileges;
exit
Installing
php
Install
php and other required packages(php-pear and php-mysql are optional.However
it is installed to make sure no conflicts while we are planning for packages
like php-myadmin in future)
#yum
install php php-pear php-mysql
#yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel (Install dependencies and required packages)
#vi /var/www/html/info.php
Add
the following into info.php file
<?php
Phpinfo();
?>
Now restart the services
#systemctl restart httpd
#systemctl restart mysqld
Now open your browser and access http://localhost/info.php
|