configuração lamp centos
DESCRIPTION
Configurando servidor LAMP (Linux, Apache, MySQL e PHP) no CentOS.TRANSCRIPT
How to install LAMP server on centos 7
LAMP is a group of open source softwares
installed together to build a webserver.
LAMP refers to Linux (Operating system),
Apache (Web service), MySQL/MariaDB
(Database) , PHP (Programming language).
This guide helps you to install LAMP server
on centos 7.
Before starting installation, you need to
setup Static IP and hostname .
You can also refer this guide – Setup network on centos 7 to setup static ip and
hostname.
Install LAMP server on centos 7.
1. Apache installation.
2. Mysql installation.
3. PHP installation.
4. Testing all together.
let’s start
Apache installation
Step 1 » Update the repositories.
[root@krizna ~]# yum check-update
Step 2 » After updating repository, issue the below command to install apache
package.
[root@krizna ~]# yum install httpd
Step 3 » Now start the service and enable it at startup.
Command to start the service
[root@krizna ~]# systemctl start httpd.service
Command to enable at startup
[root@krizna ~]# systemctl enable httpd.service
Step 4 » By default, Apache will listen on port 80. you need to exclude from
firewall.
you can simply exclude http service from firewall.
[root@krizna ~]# firewall-cmd --permanent --add-service http
or you can exclude using port number. Below command will be useful for ports other
than 80
Sign up for our newsletter for updates
Your email address Subscribe
krizna.com1k likes
Like Page
Like Page
Recent Posts
Setup mail server on centos 7
Setup FTP server on centos 7 (VSFTP )
Setup File server on ubuntu14.04 ( Samba )
Setup DHCP server on ubuntu14.04
How to install VNC server onubuntu 14.04
CentosFedoraJqueryLinuxmintUbuntu
How to install LAMP server on centos 7 http://www.krizna.com/centos/install-lamp-serve...
1 de 5 01/09/2015 12:43
Step 5 » Now restart firewall service.
[root@krizna ~]# systemctl restart firewalld.service
Step 6 » Apache installation is over . For testing, open http://serverip in your
browser, you can see apache demo page like below.
MySQL installation.
Step 7 » Start installing MariaDB, MySQL drop-in replacement.
[root@krizna ~]# yum install mariadb-server mariadb
Step 8 » Now start the service and enable it at startup.
Start the service
[root@krizna ~]# systemctl start mariadb
Enable at startup
[root@krizna ~]# systemctl enable mariadb.service
Step 9 » Secure your DB installation. Type the below command and provide values.
[root@krizna ~]# mysql_secure_installation
1. current password ( Leave blank and hit Enter ).
2. Enter new password.
3. Re Enter password.
and Hit enter for all the other options.
Step 10 » MariaDB installation is over. For testing, Check login into DB using the
below command.
[root@krizna ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.37-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Setup File server on ubuntu14.04 ( Samba )
Setup DHCP server on ubuntu14.04
How to install VNC server onubuntu 14.04
How to setup SVN server onubuntu 14.04
How to configure DNS serverin ubuntu 14.04
Latest On Centos
Setup mail server on centos 7
Setup FTP server on centos 7 (VSFTP )
How to install phpmyadmin oncentos 7
How to install LAMP server oncentos 7
How to install VNC server onCentos 7
CentosFedoraJqueryLinuxmintUbuntu
How to install LAMP server on centos 7 http://www.krizna.com/centos/install-lamp-serve...
2 de 5 01/09/2015 12:43
MariaDB [(none)]>
PHP installation.
Step 11 » Install PHP and other recommended packages.
[root@krizna ~]# yum install php php-mysql
Additional packages are required if you would like to install phpmyadmin .
[root@krizna ~]# yum install php-gd php-pear php-mbstring php-pgsql
Step 12 » Now restart apache service.
[root@krizna ~]# systemctl restart httpd.service
Step 13 » For testing, Create a file phpinfo.php in /var/www/html/ ( Default root
directory ) and add the below code.
<?php phpinfo(); ?>
Now open http://serverIP/phpinfo.php in your browser. you will see PHP version and
other configuration details like below.
Testing all together
Step 14 » For testing Database connectivity through PHP. Create a file dbtest.php in
/var/www/html/ and add below code . Kindly replace with your root password in the
below code .
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo "Congrats! connection established successfully";
CentosFedoraJqueryLinuxmintUbuntu
How to install LAMP server on centos 7 http://www.krizna.com/centos/install-lamp-serve...
3 de 5 01/09/2015 12:43
Now access http://serverIP/dbtest.php . you should get congrats message.
Have a nice day.
Tags: Apache2, Basic guide, Centos 7, how to, installation, Mysql, php, Server, step by step
Related Posts» Setup mail server on centos 7
» Setup FTP server on centos 7 ( VSFTP )
» How to install phpmyadmin on centos 7
» How to install VNC server on Centos 7
» How to Setup network on centos 7
» How to install webmin on centos 6
» How to install phpmyadmin on nginx on centos 6
» How to install LEMP on centos 6 ( Nginx, PHP, Mysql )
» Installing node.js on centos 6 with sample app
» How to setup nfs server on centos 6
Be the first of your friends to like this
krizna.com1,007 likes
Like Page
Like Page
Share
Share
mysql_close($con);
?>
CentosFedoraJqueryLinuxmintUbuntu
How to install LAMP server on centos 7 http://www.krizna.com/centos/install-lamp-serve...
4 de 5 01/09/2015 12:43
« How to install VNC server on Centos 7 How to install phpmyadmin on centos 7 »
dYour Disqus account has been created! Learn more about usingDisqus on your favorite communities.
Get Started
Dismiss ×
Setup FTP server on centos 7 ( VSFTP )2 comments • 9 months ago
urmoucher — I followed the section on
setting up SFTP, but I still can't connect
with filezilla (after password entry - …
How to configure DNS server in ubuntu14.044 comments • a year ago
djegsi — Good tutorial , can you help me
how l can add these DNS to cpanel where l
am hosting a domain name ?
How to install adobe reader in ubuntu14.046 comments • a year ago
Anwar — Thanks, It works perfectly :)
How to install phpmyadmin on nginx oncentos 67 comments • 2 years ago
krizna — try this chmod 0777 /var/lib
/php/session
ALSO ON KRIZNA
1 Comment krizna Luis Fernando
Share⤤ Sort by Best
Join the discussion…
• Reply •
Kevin • 5 months ago
Thank you very much, working perfectly!
WHAT'S THIS?
Subscribe✉ Add Disqus to your sited Privacy🔒
Recommend
Share ›
RECENT POSTS
Setup mail server on centos 7
Setup FTP server on centos 7 ( VSFTP )
Setup File server on ubuntu 14.04 (
Samba )
Setup DHCP server on ubuntu 14.04
How to install VNC server on ubuntu
14.04
How to install phpmyadmin on centos 7
How to install LAMP server on centos 7
How to install VNC server on Centos 7
How to Setup network on centos 7
How to install webmin on centos 6
SOCIAL
Follow on Delicious
Follow on Diigo
Follow on Pinterest
Follow on Scoop
Follow on Stumbleupon
Privacy Terms and Conditions Copyright © 2015. All Rights Reserved.
CentosFedoraJqueryLinuxmintUbuntu
How to install LAMP server on centos 7 http://www.krizna.com/centos/install-lamp-serve...
5 de 5 01/09/2015 12:43