linux yum 安装程序,Linux yum安装

一.安装Apache软件

步骤:

1.安装 yum install httpd

2.启动,关闭 重启等命令

systemctl start httpd.service(启动)

systemctl restart httpd.service(重启)

systemctl stop httpd.service

systemctl enable httpd.service(开机即启动)

systemctl status httpd.service(查看运行状态)

之后开放80端口 设置防火墙

firewall-cmd --zone=public --add-port=80/tcp --permanent

重新启动防火墙

systemctl restart firewalld.service

然后在浏览器中输入192.168.1.111:80就可以访问apache服务器了(192.168.1.111是服务器ip)

3.杀死进程

查看指定的进程 ps -ef|grep httpd 看是否已经存在进程,若存在,手工kill掉 kill -9 pid

4.开放80端口的

5.查看相关文件的位置

Apache软件的主配置文件为/etc/httpd/conf/httpd.conf

网页文档是需要放置在,/var/www/html目录下

可以通过命令find / -name www 来搜索放置项目的位置

通过命令 find / -name httpd.conf来查找文件所在的位置

二.安装 Php7

开启php错误提示信息 http://www.zuimoban.com/jiaocheng/linux/7591.html

1.安装epel-release

通过命令:yum -y install epel-release

2.安装PHP7

终端再次运行如下命令:

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

成功获取PHP7的yum源,然后再执行:yum install php70w

3.验证安装

终端命令:php -v,显示当前PHP版本,信息如下:

安装其他插件(选装)

php70w

php70w-fpm (nginx)

php70w-gd

php70w-mysql

php70w-pdo

三.安装mysql

1.下载YUM库

wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

2.安装YUM库

yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

3.安装数据库

yum install -y mysql-community-server

之后开放3306端口 设置防火墙

firewall-cmd --zone=public --add-port=3306/tcp --permanent

重新启动防火墙

systemctl restart firewalld.service

4.启动MySQL服务

systemctl start mysqld.service

三.安装nginx

1.使用yum安装nginx需要包括Nginx的库,安装Nginx的库

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.使用下面命令安装nginx yum install nginx

3.启动Nginx

systemctl start nginx.service

systemctl restart nginx.service

4.安装好之后可以通过which nginx和whereis nginx来查看nginx安装的位置

5.配置文件是/etc/nginx/conf.d/default.conf

6.页面存放位置 /usr/share/nginx/html

7.添加/etc/nginx/conf.d/default.conf配置文件的内容为以下:

location ~ \.php$ {

root /usr/share/nginx/html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;

include fastcgi_params;

}

8.安装php-fpm

9.yum install php70w-fpm

10.php-fpm的配置文件在 /etc/php-fpm.d/www.conf

11.启动php-fpm

systemctl start php-fpm.service

systemctl restart php-fpm.service

Nginx+php+fastcgi的原理与关系

http://www.cnblogs.com/mangguoxiansheng/p/5967745.html

12.通过进程查看服务是否开启

查看进程 ps -ef|grep nginx php-fpm kill -9 pid

http://www.centoscn.com/CentOS/Intermediate/2013/0817/1334.html

13.开启php提示错误

首先要编辑PHP配置文件:

vi /etc/php.ini

error_reporting = E_ERROR

display_errors = On

编辑 php-fpm.conf文件,如果php-fpm.conf中没有php_flag[display_errors] 请查找和这个文件相关的其他的conf文件 进行修改

把php_flag[display_errors]设为on:

vi www.conf

php_flag[display_errors] = on

如果不知道php-fpm.conf放到哪里了 可以find / -name php-fpm.conf 查找

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值