您的位置 首页 php

Centos7系统yum安装Apache PHP MySQL环境

通常来讲安装和部署Linux的环境是一件让新手比较头疼的事情,网络上的一键的环境包也是有很多。本文主要讲一下用系统自带的yum源来部署。YUM源适配的版本都是固定的
apache-2.4 PHP-5.4 mariadb-15.1(与mysql5.5版本通用)。如果是服务器机器无网络离线安装,请先配置本地YUM源(联网的机器无需配置),具体本地YUM源配置教程参考本文附录。

第一步:安装apache

①登录ssh终端,输入安装脚本

 yum -y install httpd  

②启动apache并添加自启动

 systemctl start httpd
systemctl enable httpd  

③开放http防火墙端口80

 firewall-cmd --zone=public --add-port=80/tcp --permanent  
systemctl restart firewalld.service  

④检验安装是否成功

 curl localhost  

执行上面的脚本,如果有内容输出说明apache已经安装成功如图示

Centos7系统yum安装Apache PHP MySQL环境

也可以在PC浏览器上输入服务器的IP来检测,如果IP能打开下图一样的界面说明成功,两种方法都可以检测

Centos7系统yum安装Apache PHP MySQL环境

第二步:安装PHP

①登录ssh终端,运行下面的脚本

 yum -y install php php-mysql  

等待执行完成即可

②添加其它的PHP模块

一般我们使用PHP的时候还需要用到其它的模块,常用的比如有gd2,mbstring等,我们权 先查询yum源可用的模块

 yum list |grep php     

也可以用yum search php,然后根据自己的需求选择安装,这里我们安装gd库和mbstring

 yum -y install php-gd
yum -y install php-mbstring  

安装后重启一下apache服务

 systemctl restart httpd  

③修改php.ini

 vi /etc/php.ini
修改以下几个参数
short_open_tag = On
post_max_size = 300M
upload_max_filesize = 300M  

修改后重启一下apache服务

第三步:安装数据库mariadb

①执行安装脚本

 yum -y install mariadb mariadb-server  

②启动服务,并设置开机启动项

 systemctl start mariadb
systemctl enable mariadb  

③初始化数据库

 mysql_secure_installation
输入后会提示:Enter current password for root (enter for none):<–初次运行直接回车即可
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Remove anonymous users? [Y/n] <– 是否删除匿名用户,输入y回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,输入n回车
Remove test database and access to it? [Y/n] <– 是否删除test数据库,输入y回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,输入y回车  

执行完之后就完成了,就可以用新密码登录数据库了,我这设置的密码是123456

 mysql -uroot -p123456  

附录:离线本地YUM源挂载

到此安装就结束了,如果你是本地无网络的的机器,需要离线安装,则需要挂载本地软件仓库镜像包,可以去各大镜像网站上下载,大概有9.5G大小

①下载yum源镜像

进入镜像网站 找到最新centos7.9目录找到CentOS-7-x86_64-Everything-2009.iso

我把下载地址贴出来,如果失效请进镜像网站下载

Centos7系统yum安装Apache PHP MySQL环境

②挂载镜像

下载后上传到服务器,然后通过以下命令挂载

 mkdir /mnt/dvd
mount -o loop /root/CentOS-7-x86_64-Everything-2009.iso /mnt/dvd  

/root/CentOS-7-x86_64-Everything-2009.iso是你上传的镜像文件路径

③修改本地yum源配置

备份原yum源配置文件

 mkdir  /etc/yum.repos.d/bk
mv /etc/yum.repos.d/*  /etc/yum.repos.d/bk  

配置新的本地yum源

 vi  /etc/yum.repos.d/local.repo  

添加如下内容

 [local-media]
name=CentOS-$releasever-Media
baseurl=file:///mnt/dvd/
gpgcheck=0
enabled=1
gpgkey=file:///mnt/dvd/RPM-GPG-KEY-CentOS-7  

:wq保存

然后执行以下命令,清空以下缓存并创建新的缓存

 yum clean all
yum makecache  

本地yum源配置完毕

文章来源:智云一二三科技

文章标题:Centos7系统yum安装Apache PHP MySQL环境

文章地址:https://www.zhihuclub.com/80296.shtml

关于作者: 智云科技

热门文章

评论已关闭

40条评论

  1. I am pleased nding is that the impact of initial conditions on subsequent growth in sub-Saharan Africa is distinct

  2. Cialis may be administered over a relatively longer time period than that however, so this is of interest when your dosage is high or it may not be possible to obtain enough energy for the full dose of Cialis within the recommended dose

  3. Many potent ingredients when used in combination with other ingredients work wonderfully towards improving the desired performances

  4. Doctors prescribe the medication based on the individual cases of the patients and the best possible treatment for their sexual disorders He was in Yingdu City, when Gu Min ascended the throne, and 32 erectile dysfunction he saw his disciple in person

  5. The MAESTRAL study met its primary end- point and demonstrated the noninferiority of moxifloxacin to amoxicillin clavulanic acid in the treatment of exacerbations of moderate- to- severe COPD.

  6. Vasomotor symptoms are not life threatening but can greatly affect quality of life for many women, may transiently disrupt daily activities, and can impair sleep

  7. Very slowly add the olive oil, starting with a few drips and waiting for them to be incorporated before continuing Until now, tamoxifen has been the only drug approved to reduce the chances of breast cancer striking high risk women

  8. Specific somatic mutations are associated with clinical efficiency of treatment in breast cancer

  9. We herein report a case of successful treatment for inoperable recurrence of desmoid type fibromatosis with unilateral hydronephrosis by radiation therapy alone

  10. Thus, we conclude that decreased translation of ESR1 mRNA is not the major cause of the reduced ER О± protein levels we observed

  11. Monitor Closely 1 erythromycin base will increase the level or effect of diazepam intranasal by affecting hepatic intestinal enzyme CYP3A4 metabolism

  12. And again, always moisturize c Patients received 600 mg m cyclophosphamide and doxorubicin AC at doses of either 60 mg m, 75 mg m, or 90 mg m with prophylactic G CSF support and ciprofloxacin, every 3 weeks for 4 courses

  13. My mother died a lingering death thanks largely to complications connected with Type 2 diabetes

  14. Can pilots or future pilot wannabe s get LASIK surgery to improve their vision Zollinger Ellison syndrome in 2006 concepts from a clinical point of view

  15. Progestins Such as Megestrol Acetate Megesterol has a toxicity profile intermediate between tamoxifen and aminoglutethimide and is thus the drug of second choice, although responses to the three drugs are similar 3 cc kg hour 24 hours within 14 days of FST

  16. In 4 months IGF1 normalized again, the metastatic lesion in left lung reduced, and a 24 month follow up showed further reduction in the secondary tumor and a stabilized metastases 212

  17. Ten sexually functional women between the ages of 19 34 participated in a repeatedmeasures design study in which they engaged in two counterbalanced sessions where they viewed either a neutral film followed by an erotic film, or two consecutive neutral films Meston Gorzalka, 1995

  18. While I don t think many of us would do well on the twice daily, six day a week split that some of the top amateurs and pro s follow, steroids will allow you to hit a bodypart more frequently

  19. Because Erk1 2 and Akt activation has been linked to tamoxifen related anti estrogen resistance in breast cancer patients, these results indicate that П‰ 3FFA may interfere with the effects of tamoxifen in the prevention of breast cancer risk

  20. Electrolyte disorders following oral sodium phosphate administration for bowel cleansing in elderly patients

  21. Hence, testosterone therapy for women is gaining new ground in terms of finding a solution for women dealing with perimenopausal symptoms

  22. Regulatory Reconnaissance is our daily intelligence briefing for the regulatory affairs space, bringing you the top regulatory news stories from around the globe

  23. Nolvadex, or Tamoxifen Nitrate, is a SERM that is popularly used as an alternative to Clomid for post cycle therapy

  24. Obviously, not only the carboxy terminus 20 22 but also the amino terminus of the О± 1C proteins influences the current density of the expressed О± 1C channels other therapeutic agents include erectile dysfunction improvement agents, anti osteoporosis agents, anti obesity agents, cognition enhancers, anti urinary incontinence agents, anti benign prostate hypertrophy agents, such as becaplermin, donepezil HCl, L thryroxine, methoxsalen, verteporfin, physostigmine, pyridostigmine, raloxifene HCl, sibutramine HCl, sildenafil citrate, tacrine, tamsulosin HCl, and tolterodine

  25. Effect of endogenous kinins, prostanoids, and NO on kinin B 1 and B 2 receptor expression in the rabbit Ways to detect cancer cells that have escaped from their original tumor site have become more sensitive as our knowledge and detection methods of circulating cancer cells have improved

  26. Dry cakes, pastry, nuts, seeds, coconut, dried fruit, pineapple It is highly soluble in alcohol and lipids, and poorly soluble in water

  27. These authors contributed equally Francesco Davide Naso, Dalila Boi Retinoids inhibit breast cancer growth, and modulate signaling by HER2 and ER

  28. The initial CYP 450 catalysed metabolic step leads to the formation of 4 hydroxymetabolites, 4 hydroxycyclophosphamide OHCP or 4 hydroxyifosfamide OHIF, that equilibrate with their ring opened aldo tautomers, aldocyclophosphamide AldoCP or aldoifosfamide AldoIF Figures 14 and 15

网站地图