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

admin6年前IT技术1543


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)

进行测试  

 

相关文章

magento1-2的部分使用经验总结

完成magento 1.x 到2.x的版本测试与服务器速度测试得出结论magento慢的原因软件原因1.javascrip  html css 文件 没有合并与压缩 设置 Merge Jav...

信息

支付宝:帐号:zhoukouhu@126.com户名: 周扣虎支付宝收款主页:https://me.alipay.com/huicheng 招商银行帐号:6225 8821 1195 501...

centos7 配置秘钥登录

默认情况下, 我同时允许密码和秘钥登录, 所有不用改配置文件.第一步, 先 生成秘钥对, ssh-keygen, 一路回车即可.然后在 ~/.ssh 目录下会发现两个文件...

解决Centos7系统更新时报错:Could not resolve host: mirrorlist.centos.org; 未知的错误

1、背景        centos7系统在执行:sudo yum update,发生错误;1.1、错误描述       ...

MYSQL替换第一个匹配的值

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

KindEditor设置网址绝对路径

 KindEditor 4.1.2版本,在上传图片的时候 设置为绝对路径被这个问题困扰了很久,最终搞定,竟然是如此之简单。   方法如下:   1、打...

发表评论    

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