<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Install LamP Centos 7 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/install-lamp-centos-7/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Wed, 17 Jan 2018 14:26:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Install LAMP  in CentOS 7 and  RHEL7</title>
		<link>https://www.osradar.com/install-lamp-centos-rhel7/</link>
					<comments>https://www.osradar.com/install-lamp-centos-rhel7/#respond</comments>
		
		<dc:creator><![CDATA[Mel K]]></dc:creator>
		<pubDate>Wed, 03 Jan 2018 20:43:06 +0000</pubDate>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Install LamP Centos 7]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=944</guid>

					<description><![CDATA[<p>Let&#8217;s keep it easy. Linux is one of the best OS for building a server. To build a small Linux web server, you need the following packages &#8211; any Linux OS (here, it&#8217;s CentOS 7), Apache, MySQL, and PHP. This is why its called LAMP. Sometimes, people add phpMyAdmin to facilitate the MySQL tasks for beginners. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-lamp-centos-rhel7/">Install LAMP  in CentOS 7 and  RHEL7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Let&#8217;s keep it easy. Linux is one of the best OS for building a server. To build a small Linux web server, you need the following packages &#8211; any Linux OS (here, it&#8217;s CentOS 7), Apache, MySQL, and PHP. This is why its called LAMP. Sometimes, people add phpMyAdmin to facilitate the MySQL tasks for beginners.</p>
<p>Let me explain step by step. Starting from my test machine, my VM is Centos 7.4 with IP= 192.168.1.100</p>
<p><img loading="lazy" class="alignnone size-full wp-image-950" src="https://www.osradar.com/wp-content/uploads/2018/01/mymachine.png" alt="" width="1114" height="493" srcset="https://www.osradar.com/wp-content/uploads/2018/01/mymachine.png 1114w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-300x133.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-768x340.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-1024x453.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-696x308.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-1068x473.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/mymachine-949x420.png 949w" sizes="(max-width: 1114px) 100vw, 1114px" /></p>
<h4>Install Apache Webserver</h4>
<p>CentOS 7 ships with Apache 2.4. It&#8217;s a basic package available on CentOS 7. Let&#8217;s install it the withfollowingollow command:</p>
<pre class="">yum -y install httpd</pre>
<p>You see  something like this:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-953" src="https://www.osradar.com/wp-content/uploads/2018/01/httpd.png" alt="" width="1114" height="513" srcset="https://www.osradar.com/wp-content/uploads/2018/01/httpd.png 1114w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-300x138.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-768x354.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-1024x472.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-696x321.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-1068x492.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/httpd-912x420.png 912w" sizes="(max-width: 1114px) 100vw, 1114px" /></p>
<p>Now, configure your apache to start at boot time</p>
<pre class="">systemctl start httpd.service
systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.</pre>
<p>If your firewall is activated, please add the following rules to make your servers to be accessible remotely.</p>
<pre class="">firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload</pre>
<p><strong>Check if server listening on port 80</strong></p>
<pre class="">[root@osradar-test ~]# netstat -an | grep 80
tcp6 0 0 :::80 :::* LISTEN</pre>
<p>Ow!!! Server only listening on TCP6 . It&#8217;s not available via IP address. Run this command:</p>
<p>edit /etc/httpd/conf/httpd.conf</p>
<p>Replease</p>
<pre class="">Listen 80</pre>
<p>with</p>
<pre class="">Listen 192.168.1.100:80  ##  please put your own IP address</pre>
<p><strong>Restart Apache and check netstat</strong></p>
<pre class="">[root@osradar-test conf]# systemctl restart httpd.service
[root@osradar-test conf]# netstat -an | grep 80
<span style="color: #ff0000;">tcp</span> 0 0 192.168.1.100:80 0.0.0.0:* LISTEN</pre>
<p>Everything looks fine. Now, visit your welcome page at http://192.168.1.100.  and see  the bellow result.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-957" src="https://www.osradar.com/wp-content/uploads/2018/01/Apache.png" alt="" width="1278" height="736" srcset="https://www.osradar.com/wp-content/uploads/2018/01/Apache.png 1278w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-300x173.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-768x442.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-1024x590.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-696x401.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-1068x615.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/Apache-729x420.png 729w" sizes="(max-width: 1278px) 100vw, 1278px" /></p>
<h4>Install MySQL</h4>
<p>CentOS is  using  MariaDB instead of MySQL package . MariaDB is open source and fully compatible with MySQL.</p>
<p>Install mariadb-server and client with the following command:</p>
<pre class="">[root@osradar-test conf]# yum install mariadb mariadb-server -y 

Installed:
 mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7

Dependency Installed:
 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 
 perl-DBD-MySQL.x86_64 0:4.023-5.el7 perl-DBI.x86_64 0:1.627-4.el7 
 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 
 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7</pre>
<p><strong>Enable MySQL service to start at boot and start it now.</strong></p>
<pre class="">systemctl start mariadb.service
systemctl enable mariadb.service</pre>
<p>Now, set passwords for the MySQL root :</p>
<pre class="">[root@osradar-test conf]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you 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): &lt;=== <span style="color: #ff0000;">just  Enter</span>
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y  &lt;== <span style="color: #ff0000;">set new password</span>
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y &lt;== <span style="color: #ff0000;">remove anonymous user</span>
 ... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n &lt;== <span style="color: #ff0000;">allow or not to login with root remotly</span>
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n &lt;== <span style="color: #ff0000;">delete  test database</span>
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y &lt;== <span style="color: #ff0000;">Reload privileges</span>
 ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@osradar-test conf]#</pre>
<p><strong>Test you access and see the created databases</strong></p>
<pre class="">[root@osradar-test conf]# mysql -u root -p
Enter password:     &lt;&lt;== <span style="color: #ff0000;">insert your mysql created password in the step before</span> 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]&gt;</pre>
<p>If you followed everything as said, all things should be fine.</p>
<h4>Install PHP</h4>
<p>Please note that PHP 7 is not yet supported  in CentOS 7. The only supported PHP version is 5.x.</p>
<p>To install the official PHP package just run</p>
<pre class="">yum install php  -y</pre>
<p>If you choose to install PHP 7.2, you have to  activate Remi and EPEL repository.</p>
<pre class="">yum install yum-utils
yum install epel-release
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php72</pre>
<p>Now, let&#8217;s install PHP.</p>
<pre class="lang:default decode:true ">yum --enablerepo=remi,remi-php72 install httpd php php-common
-------
Installed:
 php.x86_64 0:7.2.1-1.el7.remi php-common.x86_64 0:7.2.1-1.el7.remi Dependency Installed: php-cli.x86_64 0:7.2.1-1.el7.remi php-json.x86_64 0:7.2.1-1.el7.remi Complete!</pre>
<p><strong>Test your PHP page and settings</strong></p>
<pre class="">vi /var/www/html/info.php</pre>
<p>Add these lines into the file.</p>
<pre class="">&lt;?php
phpinfo();
?&gt;</pre>
<p class="">Now, save and exit.</p>
<p class="">Restart apache and  check your PHP file on http://192.168.1.100/info.php</p>
<pre class="">systemctl restart  httpd</pre>
<p><img loading="lazy" class="alignnone size-full wp-image-966" src="https://www.osradar.com/wp-content/uploads/2018/01/phpinfo.png" alt="" width="1960" height="1084" srcset="https://www.osradar.com/wp-content/uploads/2018/01/phpinfo.png 1960w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-300x166.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-768x425.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-1024x566.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-696x385.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-1068x591.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-759x420.png 759w, https://www.osradar.com/wp-content/uploads/2018/01/phpinfo-1920x1062.png 1920w" sizes="(max-width: 1960px) 100vw, 1960px" /></p>
<p>To Install additional PHP 7.2 modules, run these commands.</p>
<pre class="language-bash"><code class=" language-bash">yum --enablerepo<span class="token operator">=</span>remi,remi-php72
 <span class="token function">install -y</span> php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml</code></pre>
<h4>Install phpMyAdmin</h4>
<p>This chapter is optional. It&#8217;s just to help you to manager your databases via a web interface. This tool is mostly used by beginners and professionals as well.</p>
<p>Installing phpMyAdmin</p>
<pre class="">yum install phpmyadmin</pre>
<p>phpMyAdmin is not normally accessible remotely from another PC or servers. That&#8217;s why you have to make some changes to make this possible.</p>
<p>Let&#8217;s edit phpMyAdmin.conf file using command line:</p>
<pre class="">vi  /etc/httpd/conf.d/phpMyAdmin.conf</pre>
<p>and adjust the bellow settings</p>
<pre class="">&lt;Directory /usr/share/phpMyAdmin/&gt;
 AddDefaultCharset UTF-8

&lt;IfModule mod_authz_core.c&gt;
 # Apache 2.4
 Require all granted
 &lt;/IfModule&gt;
 &lt;IfModule !mod_authz_core.c&gt;
 # Apache 2.2
 Order Deny,Allow
 Allow from All
 Allow from 127.0.0.1
 Allow from ::1
 &lt;/IfModule&gt;
&lt;/Directory&gt;</pre>
<p>Now, restart apache to load the new settings.</p>
<pre class="">systemctl restart  httpd</pre>
<p>Now, check the changes :  http://IP/phpmyadmin  ( http://192.168.1.100/phpmyadmin/)</p>
<p><img loading="lazy" class="alignnone size-full wp-image-970" src="https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1.png" alt="" width="1320" height="700" srcset="https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1.png 1320w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-300x159.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-768x407.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-1024x543.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-696x369.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-1068x566.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin1-792x420.png 792w" sizes="(max-width: 1320px) 100vw, 1320px" /></p>
<p>You can login with root access already. You can easily defined and create databases and users :</p>
<p><img loading="lazy" class="alignnone size-full wp-image-971" src="https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3.png" alt="" width="1320" height="700" srcset="https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3.png 1320w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-300x159.png 300w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-768x407.png 768w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-1024x543.png 1024w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-696x369.png 696w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-1068x566.png 1068w, https://www.osradar.com/wp-content/uploads/2018/01/phpmyadmin3-792x420.png 792w" sizes="(max-width: 1320px) 100vw, 1320px" /></p>
<p>Please feel free to ask questions or comment on this article!!!</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-lamp-centos-rhel7/">Install LAMP  in CentOS 7 and  RHEL7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-lamp-centos-rhel7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
