Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3988字,纯文字阅读大概需要6分钟。
内容图文
![Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin)](/upload/InfoBanner/zyjiaocheng/501/d45e1f792a8b46ebbeaac3d0f4e2f74d.jpg)
安装apache
yum install httpd httpd-devel -y
启动apache服务
systemctl start httpd #启动服务
systemctl status httpd #查看状态
systemctl enable httpd #设置开机自动启动服务
查看服务器IP并用浏览器登录页面
ip a
http://192.168.0.64
安装mysql
yum install mariadb mariadb-server mariadb-libs mariadb-devel -y #安装相关组件
rpm -qa |grep maria #检查安装结果
[root@localhost ~]# rpm -qa |grep maria
mariadb-5.5.60-1.el7_5.x86_64
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-devel-5.5.60-1.el7_5.x86_64
systemctl start mariadb #启动mariadb
systemctl status mariadb #查看服务状态
systemctl enable mariadb #设置开机自动启动服务
使用 mysql_secure_installation 初始化数据库安全设置
-
输入root密码,没有密码直接回车
[root@localhost ~]# 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...
-
提示设置root user密码,Y
Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success!
-
删除系统创建的默认匿名用户:Y
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 ... Success!
-
禁止root用户远程登录:Y
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] y ... Success!
-
是否删除系统创建的test数据库,生产环境建议删除
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 ... skipping.
-
重载权限表:Y
Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... 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!
Install PHP
yum install php php-mysql php-gd php-pear -y #命令1,两个命令均可。
yum install php* -y #命令2,两个命令均可。
测试PHP
vi /var/www/html/info.php,并编辑以下内容
<?php
phpinfo();
?>
打开http://192.168.0.64/info.php可以看到php版本信息
Install phpMyAdmin(可选)
phpMyAdmin 是一个以PHP为基础,以Web-Base方式架构在网站主机上的MySQL的数据库管理工具,让管理者可用Web接口管理MySQL数据库。由于phpMyAdmin跟其他PHP程式一样在网页服务器上执行,您可以在任何地方使用这些程式产生的HTML页面,也就是于远端管理MySQL数据库,方便的建立、修改、删除数据库及资料表。也可借由phpMyAdmin建立常用的php语法,方便编写网页时所需要的sql语法正确性。
添加 EPEL repository 参照(Install EPEL Repository on RHEL/CentOS/Scientific Linux 7)
yum install epel-release
安装 phpMyAdmin:
yum install phpmyadmin -y
配置 phpMyAdmin
phpMyAdmin默认只能由本机访问。为了能够远程访问,编辑phpmyadmin.conf file:
vi /etc/httpd/conf.d/phpMyAdmin.conf
打开 phpMyAdmin
http://192.168.0.61/phpMyAdmin
Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin)
标签:password tar login user 启动服务 setting 创建 clean none
本文系统来源:http://blog.51cto.com/12254228/2298275
内容总结
以上是互联网集市为您收集整理的Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin)全部内容,希望文章能够帮你解决Centos7 配置LAMP(mysql+mariadb+php+phpMyAdmin)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。