CentOS 7 安装XAMPP

来源:互联网 发布:淘宝双十一广告视频 编辑:程序博客网 时间:2024/05/16 05:45

以下步骤如果包含Linux命令,没有特别说明均在root下运行:

1、首先安装CentOS,下载ISO的网址如下,挑选最快的镜像站点下载:

http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso


2、我是在VMware Workstation 11下安装的,实体机没试过。一路按向导做来就行,我选的是GUI服务器,并点选了KDE。


3、装完重启,CentOS自动把VMware Tools也装上了,真省事。


4、下载XAMPP,网址如下:

https://downloadsapachefriends.global.ssl.fastly.net/xampp-files/5.6.3/xampp-linux-x64-5.6.3-0-installer.run?from_af=true


5、给安装文件加上可执行的属性:

chmod 777 xampp-linux-x64-5.6.3-0-installer.run

6、运行安装文件:

./xampp-linux-x64-5.6.3-0-installer.run


7、按照向导安装完成后,XAMPP默认会安装在/opt/lampp下,服务器的开启、关闭和重启命令如下:

/opt/lampp/xampp start #开启

/opt/lampp/xampp stop #关闭

/opt/lampp/xampp restart #重启


8、设置防火墙。因为目标是准备作为内部网论坛,也懒得设置防火墙规则了。Centos 7的默认防火墙改成了firewalld,而非iptables,设置如下:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service#禁止firewall开机启动


9、关闭SELinux:

编辑/etc/selinux/config,找到SELINUX 行修改成为:SELINUX=disabled:

# 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=disabled
 
# SELINUXTYPE= can take one of these two values: 
# targeted - Only targeted network daemons are protected. 
# strict - Full SELinux protection. 
SELINUXTYPE=targeted 


10、设置xampp开机自动运行

(1)增加/opt/lampp/xampp的运行权限:
chmod 777 /opt/lampp/xampp

(2)在/etc/init.d下添加一个xampp的符号链接:

ln -s /opt/lampp/xampp /etc/init.d/xampp 

(3)加入到开机自动运行:

chkconfig --add xampp

(4)服务控制:

service xampp start #启动

service xampp stop #停止

service xampp restart #重启

11、关于MySQL数据库启动失败

如果设置了开机自动运行XAMPP,但只有Apache httpd和 ProFTPD能启动,MySQL启动不成功,有可能是CentOS自带的MariaDB影响,打开桌面左上角的“应用程序”-》“系统工具”-》“软件”(我装了KDE),在Databases分支下,把包含MariaDB的软件包全部删除就行了。

0 0
原创粉丝点击