fedora21 mysql_Fedora 21 安装 LAMP 主机服务器

Fedora 21 安装 LAMP 主机服务器

imcn 2014年12月17日 3条评论 阅读 6,376 次

本教程按照 howtoforge.com 网站原文翻译而来,如果不成功,可参看原文。不久前 Fedora 21 发布了,版本有三个,其中有一个服务器版本,原文提示采用的就是 server 服务器版本,先看看 LAMP 是 Linux、Apache、MySQL/MariaDB、PHP 的简称。

本教程采用的实例域名为 server1.example.com,IP 地址为 192.168.0.100,实际上你安装的时候有所不同,请作相应修改。

1、先安装数据库MySQL/MariaDB 5。

MariaDB 安装命令:

yum install mariadb mariadb-server

为 MariaDB 创建开机自启动:

systemctl enable mariadb.service

启动 mysql 服务:

systemctl start mariadb.service

mysql_secure_installation

设置超级root用户密码,按照提示操作:

[root@server1 ~]# mysql_secure_installation

/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

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.

Set root password? [Y/n] 

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]

… 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] 

… 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]

– Dropping test database…

… Success!

– 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] 

… 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@server1 ~]#

2、安装Apache2

yum install httpd

设置随系统自启动:

systemctl enable httpd.service

启动服务:

systemctl start httpd.service

接下来我们需要添加Apache服务覆盖在防火墙命令如下:

firewall-cmd --set-default-zone=public

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

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

firewall-cmd --reload

好了,输入IP地址:http://192.168.0.100,看看 apache 运行情况:

977bd6ac5c43fb5f3c96c7d86ea87742.png

Fedora 系统 Apache 默认根目录 /var/www/html,配置文件目录 /etc/httpd/conf/httpd.conf,其他配置文件目录 /etc/httpd/conf.d/ directory。

3、安装PHP5

安装命令:

yum install php

重启 apache 命令:

systemctl restart httpd.service

4、测试 PHP5 获取 PHP5 安装情况:

在根目录下创建一个探针文件:

nano /var/www/html/info.php

添加文件内容:

phpinfo();

?>

然后访问探针文件:http://192.168.0.100/info.php

21638e7918e066040b712712b43adac6.png

5、让 MySQL 得到 PHP5 支持:

先搜索一下支持插件:

yum search php

安装:

yum install php-mysqlnd php-mssql php-opcache

重启服务:

systemctl restart httpd.service

再访问一下探针文件,看看是否已经支持。

6、安装 phpMyAdmin 管理数据库:

yum install phpmyadmin

现在我们设定PHPMyAdmin。我们改变了Apache配置使phpMyAdmin允许连接不仅仅限于localhost地址访问():

nano /etc/httpd/conf.d/phpMyAdmin.conf

配置内容如下:

# AddDefaultCharset UTF-8

#

# # Apache 2.4

#

# Require ip 127.0.0.1

# Require ip ::1

#

#

#

# # Apache 2.2

# Order Deny,Allow

# Deny from All

# Allow from 127.0.0.1

# Allow from ::1

#

Require all granted

重启 apache:

systemctl restart httpd.service

OK 安装完毕,现在访问phpmyadmin:http://192.168.0.100/phpmyadmin/

参考链接:

投稿作者

作者网站

订阅

提醒

新跟进评论

我评论的新回复

4a9528a9d16aa2a2d382ba150b860094.png

{}

[+]

名字*

Email*

Website

4a9528a9d16aa2a2d382ba150b860094.png

{}

[+]

名字*

Email*

Website

3 评论

最老的

最新

得票率最高的

直线反馈

查看所有评论

891eb5a731235b2def3f4e77a256f3d2.png

6 年 之前

经典组合

0

回复

426d5f748282150bbeff5b1e0eaf9ffb.png

确实是!

0

回复

9f7ee2f74d9f75f0ff793d46e481b4ff.png

6 年 之前

顶一下哦,不错的。

0

回复

为您推荐

请支持IMCN发展!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值