LINUX-centos7服务器环境安装的那些坑

admin6年前IT技术1599


LINUX-centos7服务器环境安装的那些坑
亲自测试能用的

第一步 安装php

一定要加上--skip-broken,否则根本无法安装,依赖的程序实在是太多了,我走过这个弯路;
 yum -y install php*   --skip-broken

第二步 安装apache

 yum install httpd

设置HTTPD自动启动
systemctl enable httpd.service

yum安装的httpd,在/etc/httpd/conf.d/目录下添加vhosts.conf后重启即可,vhosts.conf文件格式如下


<VirtualHost *:80> 
 ServerName www.test.com 
 DocumentRoot "/website/siteone" 
 DirectoryIndex index.html index.php 
 
 <Directory "/website/siteone"> 
  Options -Indexes +FollowSymlinks 
  AllowOverride All 
  Require all granted 
 </Directory> 
 
</VirtualHost>

启动 service httpd start

注意了下面的是关键
 关闭关闭SELINUX

因为他不干人事,导致你们到处配置出问题,会导致APACHE站点目录出现无权限访问的提示

vi /etc/selinux/config

 # This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
#     enforcing - SELinux security policy is enforced. 
#     permissive - SELinux prints warnings instead of enforcing. 
#     disabled - No SELinux policy is loaded. 
#SELINUX=enforcing 
SELINUX=disabled 
# SELINUXTYPE= can take one of three two values: 
#     targeted - Targeted processes are protected, 
#     minimum - Modification of targeted policy. Only selected processes are protected.  
#     mls - Multi Level Security protection. 
SELINUXTYPE=targeted  

:wq! #保存退出

setenforce 0 #使配置立即生效

第三步  安装MYSQL

千万不能简单的运行 yum install mysql,安装的根本不是mysql,而是变种的MariaDB

应该是rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

查看当前可用的mysql安装资源

yum repolist enabled | grep "mysql.*-community.*"

安装
 yum -y install mysql-community-server
设置将其开机启动
systemctl enable mysqld
启动
systemctl start mysqld
设置密码
mysql_secure_installation
进去MYSQL
mysql -uroot -p


mysql>use mysql;
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
      GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '962360' WITH GRANT OPTION; 

最后关闭防火墙
iptables -F

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

进行测试  

 

相关文章

在build 里点击clean project就可以解决路上问题

 es/color/material_on_surface_disabled.xml在build 里点击clean project就可以解决y问题...

vue2 学习笔记

页面写法与cli写法 函数方法 写法不一样 方法method不要写在date里路由表其实很容易,官方文档不是写给人看得 ,是装逼用的...

汇成免费订单系统V11.5

汇成免费订单系统V11.5***********************************声明:本系统永久免费!!!***********************************官方下载...

MYSQL替换第一个匹配的值

UPDATE zq_newsSET zq_content = CONCAT(    REPLACE (      &nb...

mysql数据库的还原与备份的注意事项

mysqldump -R -u root -p  *** > ***.sql   指定数据库的备份,包括存储过程.mysqldump  -u root -...

未命名

<?phpnamespace Article;class Comment { }namespace MessageBoard;class Comment { }//调用当前空间(MessageB...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。