CentOS安装配置.docxVIP

  • 3
  • 0
  • 约4.72千字
  • 约 8页
  • 2018-01-02 发布于河南
  • 举报
CentOS安装配置

CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)一、配置防火墙,开启80端口、3306端口CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctl stop firewalld.service#停止firewallsystemctl disable firewalld.service#禁止firewall开机启动2、安装iptables防火墙yum install iptables-services #安装vi /etc/sysconfig/iptables#编辑防火墙配置文件# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibitedCOMMIT:wq! #保存退出systemctl restart iptables.service #最后重启防火墙使配置生效systemctl enable iptables.service#设置防火墙开机启动二、关闭SELINUX(SElinux为每一个用户,程序,进程,还有文件定义了访问还有传输的权限。)vi /etc/selinux/config#SELINUX=enforcing #注释掉#SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加:wq! #保存退出setenforce 0 #不用重启,使配置立即生效安装:一、安装Apacheyum install httpd#根据提示,输入Y安装即可成功安装systemctl start httpd.service#启动apachesystemctl stop httpd.service#停止apachesystemctl restart httpd.service#重启apachesystemctl enable httpd.service#设置apache开机启动在客户端浏览器中打开服务器IP地址,会出现下面的界面,说明apache安装成功二、安装MariaDBCentOS 7.0中,已经使用MariaDB替代了MySQL数据库1、安装MariaDByum installmariadbmariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成systemctl start mariadb.service#启动MariaDBsystemctl stop mariadb.service#停止MariaDBsystemctl restart mariadb.service#重启MariaDBsystemctl enable mariadb.service#设置开机启动cp /usr/share/mysql/f /etc/f #拷贝配置文件(注意:如果/etc目录下面默认有一个f,直接覆盖即可)2、为root账户设置密码mysql_secure_installation首先是设置密码,会提示先输入密码Enter current password for root (enter for none):–初次运行直接回车设置密码Set root password? [Y/n] – 是否设置root用户密码,输入y并回车或直接回车New password: – 设置root用户的密码Re-enter new password: – 再输入一次你设置的密码其他配置Remove anony

文档评论(0)

1亿VIP精品文档

相关文档