How to install the LAMP server on Fedora 23

Source: Internet
Author: User

How to install the LAMP server on Fedora 23

LAMP is a fantastic combination of Web servers on open-source systems. LAMP is short for Linux, Apache HTTP service, MySQL/MariaDB database, and PHP, Perl, or Python.

The following describes how to install the LAMP combination on the Fedora 23 server.

The following tutorial uses the 192.168.1.102/24 instance by default. Modify the instance according to your server.

Install Apache

Apache is an open-source web Service Framework. Fully supports CGI and SSL.

Switch to the root account:

Su

Run the following command on Fedora 23/22 to install Apache:

Dnf install httpd-y

Fedora 21 and earlier versions:

Yum install httpd-y

Start the httpd service to start the service in each system:

Systemctl enable httpd

Run the following command to start the httpd service:

Systemctl start httpd

If you encounter the following errors:


Job for httpd. service failed. See 'systemctl status httpd. service' and 'journalctl-xn 'for details.

Delete all content in/etc/hostname and add "localhost ". At the same time, in the/etc/httpd/conf/httpd. conf file, set "Servername" to "localhost" and try to start the httpd service again.
And adjust the firewall to allow the httpd service to be accessed from a remote client.

Firewall-cmd -- permanent -- add-service = http


Firewall-cmd -- permanent -- add-service = https

Restart the firewalld service:


Firewall-cmd -- reload

Open your browser and enter the Server IP address for access:

Install MariaDB

Fedora 23/22 installation command:


Dnf install mariadb-server-y

Command earlier than Fedora 21:


Yum install mariadb-server-y

The command is automatically started with the system:


Systemctl enable mariadb

Start the database server:

Systemctl start mariadb

Set the password of the MariaDB root account. By default, the password of the MySQL root User is blank. Therefore, to prevent unauthorized access to the MySQL database, we need to set the root user password:


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 shoshould just press enter here.
Enter current password for root (enter for none ):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n '.
Change the root password? [Y/n] y # Enter 'y' and press enter ##
New password: # Enter password ##
Re-enter new password: # Re-enter 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
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.
Remove anonymous users? [Y/n] # Press Enter ##
... Success!
Normally, root shoshould 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] # Press Enter ##
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.
Remove test database and access to it? [Y/n] # Press Enter ##
-Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn' t exist
... Failed! Not critical, keep moving...
-Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.
Reload privilege tables now? [Y/n] # Press Enter ##
... Success!
Cleaning up...
All done! If you 've completed all of the above steps, your MariaDB
Installation shoshould now be secure.
Thanks for using MariaDB!

Install PHP

Fedora 23/22 USER command:

Dnf install php-y

Fedora 21 and earlier versions:

Yum install php-y

Test whether PHP is running:

Vi/var/www/html/testphp. php

Enter the following content:
<? Php
Phpinfo ();
?>

Restart the Http service:

Systemctl restart httpd

Enter the following information in the browser:

Install the PHP Module

Search for a module and install it:

Fedora 23/22 users:

Dnf search php

Fedora 22 and earlier versions:

Yum search php

Run the following command to install the required modules, such as php-mysql:

Fedora 23/22 users:


Dnf install php-mysql-y

Fedora 22 and earlier versions:


Yum install php-mysql-y

Restart the HTTP service:

Systemctl restart httpd

Check whether the module is successfully installed in the browser:

Install phpMyAdmin

Phpmyadmin is used to manage databases:
Fedora 23/22 users:

Dnf install phpmyadmin-y

Fedora 22 and earlier versions:

Yum install phpmyadmin-y

By default, phpMyAdmin can only be accessed from a local host. To access your network from a remote system, perform the following steps.

Vi/etc/httpd/conf. d/phpMyAdmin. conf

Find and comment out 127.0.0.1 and request ip: 1 lines. Then add an additional row that requires that all be granted slightly below the annotation line.

This is my changed phpMyAdmin. conf file. These changes are marked in bold.
[...]
Alias/phpMyAdmin/usr/share/phpMyAdmin
Alias/phpmyadmin/usr/share/phpMyAdmin
<Directory/usr/share/phpMyAdmin/>
Adddefacharcharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
# Require ip: 1
Require all granted
</RequireAny>
</IfModule>
<IfModule! Mod_authz_core.c>
# Apache 2.2
Order Deny, Allow
Deny from All
Allow from 127.0.0.1
Allow from: 1
</IfModule>
</Directory>
<Directory/usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
# Require ip: 1
Require all granted
</RequireAny>
</IfModule>
<IfModule! Mod_authz_core.c>
[...]

Important: however, it should be considered dangerous to allow others other than localhost to access the database unless it is properly protected through SSL. To do this, you need to take your own risk.

Save and close the file. Restart the httpd service.

Systemctl restart httpd

OK. Open phpmyadmin and test it:

Now, the installation is complete!

You may also like the following LAMP-related content:

Install Xcache and Memcached on the LAMP platform to accelerate website operation

Build a LAMP platform environment in CentOS 7

CentOS 6.5 system installation and configuration LAMP (Apache + PHP5 + MySQL) server environment

Configure the LAMP + phpMyAdmin PHP (5.5.9) development environment in Ubuntu 14.04

Install LAMP in Ubuntu 14.10

LAMP combines NFS to build a small blog site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.