发布网友
共2个回答
热心网友
一、安装httpd。
yum install -y httpd
安装完成之后使用以下命令启动httpd服务:
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动 可以在浏览器中输入服务器所在的主机的IP即可看到apache的欢迎界面。要在另外一台主机上实现这种访问,需要关闭系统的防火墙。 在CentOS7中,修改防火墙的机制已经做了修改,在CentOS 6.x系统中可以使用以下命令:
service iptables stop
chkconfig iptables off // 开机禁止启动
而在CentOS7中只能使用以下命令,如果使用上面的命令并不会报任何错误,但是起不到关闭防火墙的效果:
systemctl stop firewalld.service
systemctl disable firewalld.service //禁止防火墙开机启动关闭SeLinux:
使用getenforce命令可以查看SeLinux的状态,SeLinux有三种状态,分别为enforcing、permissive和disabled。因为我们的服务器只在内部使用,所以这里我们选择完全关闭(disabled)。具体的做法为修改/etc/sysconfig/selinux文件,具体操作可以看里面的说明。
成功安装httpd(apache)的效果图为:
二、安装MySQL数据库。
MySQL数据库,新版本已经更名为Mariadb,所以这里需要安装Mariadb,可以使用下面的命令进行安装:
yum install -y mariadb
安装完成以后使用下面的命令开启数据库服务:
systemctl start mariadb.service #启动MariaDB
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重启MariaDB
systemctl enable mariadb.service #设置开机启动
三、安装PHP。
使用下面的命令可以安装PHP:
yum -y install php
使用下面的命令安装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
使用下面的命令重启Mariadb和httpd服务:
systemctl restart mariadb.service #重启MariaDB
systemctl restart httpd.service #重启apache
热心网友
安装httpd。
yum install -y httpd
安装完成之后使用以下命令启动httpd服务:
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动 可以在浏览器中输入服务器所在的主机的IP即可看到apache的欢迎界面。要在另外一台主机上实现这种访问,需要关闭系统的防火墙。 在CentOS7中,修改防火墙的机制已经做了修改,在CentOS 6.x系统中可以使用以下命令:
service iptables stop
chkconfig iptables off // 开机禁止启动
而在CentOS7中只能使用以下命令,如果使用上面的命令并不会报任何错误,但是起不到关闭防火墙的效果:
systemctl stop firewalld.service
systemctl disable firewalld.service //禁止防火墙开机启动关闭SeLinux:
使用getenforce命令可以查看SeLinux的状态,SeLinux有三种状态,分别为enforcing、permissive和disabled。因为我们的服务器只在内部使用,所以这里我们选择完全关闭(disabled)。具体的做法为修改/etc/sysconfig/selinux文件,具体操作可以看里面的说明。