一.下載安裝包php
wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.14/xampp-linux-x64-5.6.14-0-installer.run
二.賦予安裝包權限
chmod -R 755 xampp-linux-x64-5.6.14-installer.run
三.html
重啓網絡服務mysql
service network restartlinux
啓動xampp:web
# /opt/lampp/lampp start
重啓xampp:sql
# /opt/lampp/lampp restart
中止xampp:vim
# /opt/lampp/lampp stop
卸載xampp:安全
# /opt/lampp/lampp stop # rm -rf /opt/lampp
在默認的安裝過程當中,xampp全部均是沒有密碼的,爲了安全,咱們應該爲xampp設置密碼。該如何操做呢?網絡
# /opt/lampp/lampp security
設置xampp的密碼: XAMPP: Quick security check… XAMPP: Your XAMPP pages are NOT secured by a password. XAMPP: Do you want to set a password? [yes] yew XAMPP: Do you want to set a password? [yes] yes XAMPP: Password: XAMPP: Password (again):tcp
用戶名默認是:xampp
設置phpMyAdmin的密碼: XAMPP: The MySQL/phpMyAdmin user pma has no password set!!! XAMPP: Do you want to set a password? [yes] yes XAMPP: Password: XAMPP: Password (again): XAMPP: Setting new MySQL pma password. XAMPP: Setting phpMyAdmin’s pma password to the new one.
設置mysql的root帳戶: XAMPP: MySQL has no root passwort set!!! XAMPP: Do you want to set a password? [yes] yes XAMPP: Write the password somewhere down to make sure you won’t forget it!!! XAMPP: Password: XAMPP: Password (again): XAMPP: Setting new MySQL root password. XAMPP: Change phpMyAdmin’s authentication method.
安裝完成後,不少時候用locahost來訪問時,是沒有問題的,可是同一局域網裏其它主機用域名訪問時,經常不能訪問,這裏按照下列方法進行排除:
1.修改 /opt/lampp/etc/extra/httpd-vhost.conf 中配置 (須要在"/opt/lampp/htdocs中新增文件夾)
<VirtualHost *:80>
ServerAdmin www.test.com
DocumentRoot "/opt/lampp/htdocs/www.test.com"
ServerName www.test.com
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
2. 修改/opt/lampp/etc/httpd.conf
a.載入vhost配置 # Include /opt/lampp/etc/extra/httpd-vhost.conf 去掉#號
b.更改監聽端口 #Listen 12.34.56.78:80 去掉#號,改成本身的(局域網/外網)ip
3. xampp的配置文件:/opt/lampp/etc/extra/httpd-xampp.conf中將一下內容屏蔽 (require local 前加#,註釋掉)
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> #Require local ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
4. 若是按照以上修改後,仍是不能訪問,則多是防火牆把80端口給幹掉了,要麼把防火牆關閉,要麼配置一下80端口容許訪問。
CentOS 7.0默認使用的是firewall做爲防火牆,這裏改成iptables防火牆。
a、關閉firewall:
systemctl stop firewalld.service #中止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
b、安裝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-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最後重啓防火牆使配置生效
systemctl enable iptables.service #設置防火牆開機啓動
五.開機自啓 lampp
$ vim /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/opt/lampp/lampp restart
六.卸載xampp
中止 XAMPP,只需輸入以下命令:
/opt/lampp/lampp stop
您如今應該能看到:
Stopping LAMPP 1.7...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.
而後 XAMPP 的 Linux 版就中止運行了。 想卸載 XAMPP,只需輸入以下命令:
rm -rf /opt/lampp
卸載完成。:)
設置ftp密碼: XAMPP: The FTP password for user ‘daemon’ is still set to ‘xampp’. XAMPP: Do you want to change the password? [yes] yes XAMPP: Password: XAMPP: Password (again)