LAMP–Linux(Mariadb)+Apache+Mysql+PHP环境是经常用到的组合,以下内容在Centos7.3虚拟机上进行配置,以做学习记录:
- 首先确认虚拟机操作系统的版本:
uname -a
&
cat /etc/redhat-release
-
yum -y update
#更新下系统和内核,如虚拟机有限制可略(更新成功后可以看到版本前后差别)ps:#
yum upgrade
大规模更新中使用,区别是连同旧的、淘汰的RPM包一同升级
- 安装Apache
yum install httpd httpd-devel
- 启动Apache服务,在Centos中要使用:
systemctl start httpd
or CentOS6.x
service httpd start|stop|status|restart
&
chkconfig httpd on
#将Apache加入开机启动 查看下Apache的状态:
systemctl status httpd
Active:(running)
- 打开浏览器,输入IP地址,查看是否安装成功,记着把Centos7的防火墙关了哦,查看防火墙状态:
systemctl status firewalld.service
&
systemctl stop firewalld.service
&
systemctl disable firewalld.service
#禁止防火墙开机启动
- 安装MYSQL :
yum install mariadb mariadb-devel mariadb-server
CentOS6.x:
yum install -y mysql-server mysql mysql-devel
在centos最新的内核中已经将mysql替代成了Mariadb
- 启动Mariadb服务:
systemctl start mariadb
CentOS6.x:
service mysqld start
chkconfig mysqld on
#根据向导初始化mysql的一些参数 :
mysql_secure_installation
- 输入当前数据库root密码,初始为空,直接回车,是否设置root密码:“Y”,是否删除匿名用户:“Y”后面的选项根据自己的需求选择
- 设置mysql允许远程登陆:
mysql -u root -p
& 设置root允许远程登陆,这样就可以通过mysql管理工具进行远程管理:
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
- 安装PHP使其支持MariaDB:
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash php-fpm php
FOR CENTOS7.X & PHP7.0
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmyum install php71w-common mod_php71w php71w-opcache php71w-gd php71w-mysql php71w-mbstring php71w-pecl-redis php71w-pecl-memcached php71w-devel php71w-bcmath php71w-ldap
CentOS6.x:
yum install php php-fpm php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
- 启动php-fpm:
systemctl start php-fpm.service
CentOS6.x
service php-fpm start
重启Apache服务:
systemctl restart httpd
CentOS6.x:
service httpd restart
将php-fpm加入开机启动:
chkconfig php-fpm on
- 完成,新建一个PHP探针检测下,最好重启下服务器,确保Apache、php、mysql的服务都能够随机启动
Thank you for your article.Thanks Again. Great.
Normally I do not read article on blogs, however I wish to say that this write-up very forced me to take a look at and do so! Your writing style has been amazed me. Thank you, quite great post.
Dxbrnh – silagra pills in india Mreexa dvbwxt
Really enjoyed this article post.Much thanks again. Want more.
I really liked this post i read your blog very often, and you’re always coming out with some great stuff. I shared this on my fb, and my followers really liked it.
Well I definitely enjoyed reading it. This article provided by you is very useful for correct planning.
I appreciate you sharing this article.Thanks Again. Fantastic.Loading…
Awesome blog article.Thanks Again. Awesome.
There is certainly a great deal to find out about this subject. I like all the points you’ve made.
In addition to favorites, underdogs, and potentialreturns for right wagers, odds also inform us the likelihood of an occasion taking place.
best research tadalafil 2017 zhengzhou debao tadalafil
Thanks again for the blog post.
Thank you ever so for you post.
Thanks-a-mundo for the blog article.Thanks Again. Much obliged.
There’s definately a great deal to learn about this subject. I really like all of the points you’ve made.
Major thankies for the blog.Much thanks again. Fantastic.
I savour, result in I found just what I used to be taking a lookfor. You have ended my four day lengthy hunt! God Blessyou man. Have a great day. Bye
Peculiar article, totally what I needed. klГҐda pГҐ brГ¶stet cancer
Appreciate it for helping out, great info. “Nobody can be exactly like me. Sometimes even I have trouble doing it.” by Tallulah Bankhead.
Heya i’m for the first time here. I came across this board and I to find It really useful & it helped me out a lot. I am hoping to provide one thing back and aid others such as you helped me.
Wow, great blog. Much obliged.
wow, awesome post.Really looking forward to read more. Much obliged.
Remarkable! Its actually awesome article, I have got much clear idea concerning from this piece of writing.
Im obliged for the blog post.Really thank you!
Really nice style and superb content , absolutely nothing else we want : D.
Agen Sbobet Terpercaya permainan yang saat ini semakin jumlah disukai juga digemari yakni permainan judi. Salah alasan yang menjadikan permainan judi ini banyak diminati diantaranya karena mudah dimainkan dan dilakukan.
Thanks for sharing, this is a fantastic blog post.Thanks Again. Want more.
This is a great tip especially to those new to the blogosphere. Short but very accurate infoÖ Thanks for sharing this one. A must read post!
Aw, this was a very good post. Taking the time and actual effort to generate a great article… but what can I say… I hesitate a lot and don’t manage to get anything done.
Enjoyed every bit of your article post.Thanks Again. Awesome.
Hi! Do you use Twitter? I’d like to follow you if that would be okay.I’m absolutely enjoying your blog and look forward to new posts.