采暖炉厂家
免费服务热线

Free service

hotline

010-00000000
采暖炉厂家
热门搜索:
技术资讯
当前位置:首页 > 技术资讯

Fedora23如何安装LAMP服务器

发布时间:2020-06-29 16:45:57 阅读: 来源:采暖炉厂家

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

安装 ApacheApache?是一款开源的 web 服务框架。完全支持 CGI, SSL。切换到 root?账户:suFedora 23/22 输入以下命令来安装Apache:dnf install httpd -yFedora 21 及更早的版本:yum install httpd -y启动httpd服务,以在每次系统启动服务:systemctl enable httpd使用以下命令来启动httpd服务:systemctl start httpd如果您遇到以下错误:

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

删除所有内容在/etc/hostname,并加上“localhost”。同时,在/etc/httpd/conf/nf文件中的“Servername”的值设定为“localhost”,并再次尝试启动httpd服务。并调整防火墙以允许httpd服务,从远程客户端访问。firewall-cmd --permanent --add-service=httpfirewall-cmd --permanent --add-service=https重新启动firewalld服务:firewall-cmd --reload打开浏览器,输入服务器IP访问:

安装MariaDBFedora 23/22 用户安装命令:dnf install mariadb mariadb-server -yFedora 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 MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we’ll need the currentpassword for the root user. If you’ve just installed MariaDB, andyou haven’t set the root password yet, the password will be blank,so you should just press enter ter current password for root (enter for none):OK, successfully used password, moving on…Setting the root password ensures that nobody can log into the MariaDBroot user without the proper u 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 anyoneto log into MariaDB without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction move anonymous users? [Y/n] ## Press Enter ##… Success!Normally, root should only be allowed to connect from ‘localhost’. Thisensures that someone cannot guess at the root password from the sallow root login remotely? [Y/n] ## Press Enter ##… Success!By default, MariaDB comes with a database named ‘test’ that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production move 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 farwill take effect load privilege tables now? [Y/n] ## Press Enter ##… Success!Cleaning up…All done! If you’ve completed all of the above steps, your MariaDBinstallation should now be anks for using MariaDB!

安装PHPFedora 23/22 用户命令:dnf install php -yFedora 21 及早期版本:yum install php -y测试PHP是否运行:vi /var/www/html/p输入以下内容:

<?phpphpinfo();?>

重启 Http 服务:systemctl restart httpd浏览器输入看看:

安装PHP模块搜索模块并安装:Fedora 23/22 用户:dnf search phpFedora 22及早期版本:yum search php现在安装你所选择所需模块,例如php-mysql,使用以下命令:Fedora 23/22 用户:dnf install php-mysql -yFedora 22及早期版本:yum install php-mysql -y重启 HTTP 服务:systemctl restart httpd浏览器查看模块安装是否成功:

安装phpMyAdminphpmyadmin 用于管理数据库:Fedora 23/22 用户:dnf install phpmyadmin -yFedora 22及早期版本:yum install phpmyadmin -y缺省情况下,phpMyAdmin 只能从本地主机进行访问。若要从远程系统访问您的网络中,请执行下列操作步骤。vi /etc/httpd/conf.d/nf查找并注释掉127.0.0.1 和请求 ip ::1 lines。然后添加一个额外的行要求所有授予略低于为注释行。这是我的更改后的 nf 文件。这些变化以粗体标记。

[...]Alias /phpMyAdmin /usr/share/phpMyAdminAlias /phpmyadmin /usr/share/phpMyAdmin<Directory /usr/share/phpMyAdmin/>?? AddDefaultCharset 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>[...]

重要提示:不过让localhost以外的人访问数据库,应视为危险,除非通过SSL适当保护。做到这一点需要您自担风险。保存并关闭文件。重新启动httpd服务。systemctl restart httpdOK,打开 phpmyadmin 测试一下:好了,安装完毕!

金小宝pos

现代金控

金大宝pos机

金小宝pos机