热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Fedora23如何安装LAMP服务器

LAMP是开源系统上Web服务器的梦幻组合。LAMP是Linux、ApacheHTTP服务、MySQL/MariaDB数据库和PHP、Perl或Python的简称。下面教你如何在Fedora23服务器上安装LAMP组合。下面的教程默认使用192.168.1.102/24实例,请按照你的服务器做修改。安装ApacheApache是一

LAMP 是开源系统上 Web 服务器的梦幻组合。 LAMP 是 Linux、 Apache HTTP 服务、 MySQL/MariaDB 数据库和 PHP、 Perl 或 Python 的简称。

下面教你如何在 Fedora 23 服务器上安装 LAMP 组合。

下面的教程默认使用 192.168.1.102/24 实例,请按照你的服务器做修改。

安装 Apache

Apache 是一款开源的 web 服务框架。完全支持 CGI, SSL。

切换到 root 账户:

su

Fedora 23/22 输入以下命令来安装Apache:

dnf install httpd -y

Fedora 21 及更早的版本:

yum install httpd -y

启动httpd服务,以在每次系统启动服务:

systemctl enable httpd

使用以下命令来启动httpd服务:

systemctl start httpd

如果您遇到以下错误:


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

删除所有内容在/etc/hostname,并加上“localhost”。同时,在/etc/httpd/conf/httpd.conf文件中的“Servername”的值设定为“localhost”,并再次尝试启动httpd服务。
 并调整防火墙以允许httpd服务,从远程客户端访问。

firewall-cmd --permanent --add-service=http


firewall-cmd --permanent --add-service=https

重新启动firewalld服务:


firewall-cmd --reload

打开浏览器,输入服务器IP访问:

安装MariaDB

Fedora 23/22 用户安装命令:


dnf install mariadb mariadb-server -y

Fedora 21 及早前版本命令:


yum install mariadb mariadb-server -y

随系统自动启动命令:


systemctl enable mariadb

启动数据库服务器:

systemctl start mariadb

设置 MariaDB root 账户密码,默认情况下MySQL root用户的密码为空。因此,以防止未经授权的访问MySQL数据库,我们设置需要root用户密码:


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):
 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 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] ## Press Enter ##
… 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] ## Press Enter ##
… Success!
 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] ## 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 should now be secure.
 Thanks for using MariaDB!

安装PHP

Fedora 23/22 用户命令:

dnf install php -y

Fedora 21 及早期版本:

yum install php -y

测试PHP是否运行:

vi /var/www/html/testphp.php

输入以下内容:
phpinfo();
?>

重启 Http 服务:

systemctl restart httpd

浏览器输入看看:

安装PHP模块

搜索模块并安装:

Fedora 23/22 用户:

dnf search php

Fedora 22及早期版本:

yum search php

现在安装你所选择所需模块,例如php-mysql,使用以下命令:

Fedora 23/22 用户:


dnf install php-mysql -y

Fedora 22及早期版本:


yum install php-mysql -y

重启 HTTP 服务:

systemctl restart httpd

浏览器查看模块安装是否成功:

安装phpMyAdmin

phpmyadmin 用于管理数据库:
Fedora 23/22 用户:

dnf install phpmyadmin -y

Fedora 22及早期版本:

yum install phpmyadmin -y

缺省情况下,phpMyAdmin 只能从本地主机进行访问。若要从远程系统访问您的网络中,请执行下列操作步骤。

vi /etc/httpd/conf.d/phpMyAdmin.conf

查找并注释掉127.0.0.1 和请求 ip ::1 lines。然后添加一个额外的行要求所有授予略低于为注释行。

这是我的更改后的 phpMyAdmin.conf 文件。这些变化以粗体标记。
[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

  AddDefaultCharset UTF-8
 
    # Apache 2.4
   
#      Require ip 127.0.0.1
#      Require ip ::1
        Require all granted
   

 

 
    # Apache 2.2
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1
    Allow from ::1
 



 
    # Apache 2.4
   
#      Require ip 127.0.0.1
#      Require ip ::1
        Require all granted
   

 

 
[...]

重要提示:不过让localhost以外的人访问数据库,应视为危险,除非通过SSL适当保护。做到这一点需要您自担风险。

保存并关闭文件。重新启动httpd服务。

systemctl restart httpd

OK,打开 phpmyadmin 测试一下:

好了,安装完毕!

下面关于LAMP相关的内容你可能也喜欢

LAMP平台安装Xcache和Memcached加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7下搭建LAMP平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP结合NFS构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

更多Fedora相关信息见Fedora 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=5

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-11/124968.htm


推荐阅读
  • 如何实现织梦DedeCms全站伪静态
    本文介绍了如何通过修改织梦DedeCms源代码来实现全站伪静态,以提高管理和SEO效果。全站伪静态可以避免重复URL的问题,同时通过使用mod_rewrite伪静态模块和.htaccess正则表达式,可以更好地适应搜索引擎的需求。文章还提到了一些相关的技术和工具,如Ubuntu、qt编程、tomcat端口、爬虫、php request根目录等。 ... [详细]
  • 本文介绍了Python高级网络编程及TCP/IP协议簇的OSI七层模型。首先简单介绍了七层模型的各层及其封装解封装过程。然后讨论了程序开发中涉及到的网络通信内容,主要包括TCP协议、UDP协议和IPV4协议。最后还介绍了socket编程、聊天socket实现、远程执行命令、上传文件、socketserver及其源码分析等相关内容。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
    本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • 1.安装libeventyuminstalllibevent.x86_64libevent-devel.x86_64没有libevent编译memcached为出错checking ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了python面试题——数据库和缓存(46题)相关的知识,希望对你有一定的参考价值。1、列举常见的关系型数据库和非关系型都有那些? ... [详细]
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文介绍了在Hibernate配置lazy=false时无法加载数据的问题,通过采用OpenSessionInView模式和修改数据库服务器版本解决了该问题。详细描述了问题的出现和解决过程,包括运行环境和数据库的配置信息。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 本文介绍了Linux系统中正则表达式的基础知识,包括正则表达式的简介、字符分类、普通字符和元字符的区别,以及在学习过程中需要注意的事项。同时提醒读者要注意正则表达式与通配符的区别,并给出了使用正则表达式时的一些建议。本文适合初学者了解Linux系统中的正则表达式,并提供了学习的参考资料。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • Linux如何安装Mongodb的详细步骤和注意事项
    本文介绍了Linux如何安装Mongodb的详细步骤和注意事项,同时介绍了Mongodb的特点和优势。Mongodb是一个开源的数据库,适用于各种规模的企业和各类应用程序。它具有灵活的数据模式和高性能的数据读写操作,能够提高企业的敏捷性和可扩展性。文章还提供了Mongodb的下载安装包地址。 ... [详细]
author-avatar
黄敬定241
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有