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

admin6年前IT技术1587


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)

进行测试  

 

相关文章

树莓派安装软件

 apt-get install ...

解决方案2
打开的本地组策略

Win10远程连接的凭据不工作的解决方法

 把远程桌面工具的本地资源的打印机与剪贴板的勾勾取消解决方案2打开的本地组策略在右侧打开的窗口中双击“网络访问:本地账户的共享和安全模型”一项在打开的属性窗口中,我们...

dell G15游侠重装系统

https://www.dell.com/support/kbdoc/zh-cn/000176966/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%88%B4%E5%B0%94%E8%...

让MobaXterm能自动显示服务器的cpu与内存使用情况

 Settings→SSH→勾选Remote-monitoring...

webview 不能启用的原因

1.报错是乱码没有设置,不知道是什么原因造成的,点击这个 “放大镜” 或 “双击Shift” 打开这个对话框,并...

Centos7系统pip的安装

介绍pippip 是一个Python包安装与管理工具。yum方式安装pipyum install python-pip -y升级pippip install&n...

发表评论    

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