XAMPP 1.8.3-5 for linux 安装包主要包含如下软件包
Apache 2.4.10
MySQL 5.6.20
PHP 5.5.15 & PEAR + SQLite 2.8.17/3.7.17 + multibyte (mbstring) support
Perl 5.16.3
ProFTPD 1.3.4c
phpMyAdmin 4.2.7.1
OpenSSL 1.0.1i
ProFTPD 1.3.4c
安装步骤: 安装XAMPP 1.8.3-5 on 64 bit Linux systems:
# mkdir /wangsl
# cd /wangsl
下载 xampp-linux-x64-1.8.3-5-installer.run
# wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.8.3/xampp-linux-x64-1.8.3-5-installer.run
# chmod +x xampp-linux-x64-1.8.3-5-installer.run
# ./xampp-linux-x64-1.8.3-5-installer.run
[root@localhost wangsl]# ./xampp-linux-x64-1.8.3-5-installer.run
运行后显示内容如下:
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] :y
Is the selection above correct? [Y/n]: y
----------------------------------------------------------------------------
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue:
----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.
Do you want to continue? [Y/n]: y
----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.
以上表示安装完成
卸载
想卸载 XAMPP,只需输入如下命令:
rm -rf /opt/lampp
想启用带 SSL 支持的 Apache,只需输入如下命令(以 root 身份):
/opt/lampp/lampp startssl
现在您可以通过 SSL 形式的 https://localhost 访问 Apache 服务器了。
停止防火墙
systemctl stop firewalld.servicesystemctl disable firewalld.service
测试输入网站地址浏览网站出现下面错误提示:
Access forbidden!
New XAMPP security concept:
Access to the requested object is only available from the local network.
This setting can be configured in the file "httpd-xampp.conf".
If you think this is a server error, please contact the webmaster.
Error 403
192.168.100.222Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3
以上问题出现修改 xampp的配置文件:/opt/lampp/etc/extra/httpd-xampp.conf中将一下内容屏蔽 #Require local
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
#Require local
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
重新启动 xampp
#/opt/lampp/lampp restart
关闭SELinux:
# 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
/opt/lampp/xampp security
安全设置
他会依次要求你
1、先输入xampp控制面板的密码(用户名是xampp 默认无需密码);
2、输入phpmyadmin的密码(用户名是pma 默认密码空)
3、输入mysql的密码(用户名是root 默认密码空)
4、输入ftp密码(用户名是daemon,默认密码是 xampp 默认端口21)
【中间输错了几次,所以让我重复输入,大家可以忽略】
/opt/lampp/xampp security
XAMPP: Quick security check...
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes]
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Password protection active. Please use 'xampp' as user name!
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP: Turned off.
XAMPP: Stopping MySQL...ok.
XAMPP: Starting MySQL.../opt/lampp/share/xampp/xampplib: line 22: netstat: command not found ok.
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.
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.
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):
XAMPP: Reload ProFTPD...ok.
XAMPP: Done.
依次完成上面的密码修改
网络访问用户名xampp 密码自己设置
phpmyadmin pma 密码 用户自己设置密码
MySQL root 密码默认是无,自己修改root密码
proftp 默认用户名和密码是 daemon 密码是xampp 修改自己的ftp密码
修改 XAMPP用户pma的密码设置 修改配置文件phpmyadmin 目录下的config.inc.php
$cfg['Servers'][$i]['controluser'] = 'pma';
# commented out by xampp security
$cfg['Servers'][$i]['controlpass'] = '密码';
重要的文件和目录
文件/目录 用途
/opt/lampp/bin/ XAMPP 命令库。例如 /opt/lampp/bin/mysql 可执行 MySQL 监视器。
/opt/lampp/htdocs/ Apache 文档根目录。
/opt/lampp/etc/httpd.conf Apache 配制文件。
/opt/lampp/etc/my.cnf MySQL 配制文件。
# commented in by xampp security
# skip-networking #如果这句打开的话3306 端口将无法访问;外网无法访问数据库。
/opt/lampp/etc/php.ini PHP 配制文件。
/opt/lampp/etc/proftpd.conf ProFTPD 配制文件。(从 0.9.5 版开始)
/opt/lampp/phpmyadmin/config.inc.php phpMyAdmin 配制文件。
停止 XAMPP
想停止 XAMPP,只需输入如下命令:
/opt/lampp/lampp stop
您现在应该能看到:
Restarting XAMPP for Linux 1.8.3-5...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
然后 XAMPP 的 Linux 版就停止运行了。
卸载
想卸载 XAMPP,只需输入如下命令:
rm -rf /opt/lampp
卸载完成。:)
备份
做为系统安全保障的一部分,及时、全面的备份是一项必不可少的工作。数据库以及各软件的配置文件、日志等,经常会使管理员晕头转向,一不小心就会漏掉一项。而XAMPP则让这一工作变得非常简单,输入下面的命令就可一步完成:
/opt/lampp/lampp backup ****
命令后面跟着的是MySQL 的 root 用户的密码。命令执行后会看到下面的内容:
Backing up databases...
Backing up configuration, log and htdocs files...
Calculating checksums...
Building final backup file...
Backup finished.
Take care of /opt/lampp/backup/xampp-backup-19-02-06.sh
恢复
恢复以前的备份,只需以 root 用户身份运行下面的命令:
sh /opt/lampp/backup/xampp-backup-19-02-06.sh ****
命令后面跟着的是MySQL 的 root 用户的密码,这时用户将看到如下信息:
Checking integrity of files...
Restoring configuration, log and htdocs files...
Checking versions...
Installed: XAMPP 1.8.3
Backup from: XAMPP 1.8.3
Restoring MySQL databases...
Restoring MySQL user databases...
Backup complete. Have fun!
You may need to restart XAMPP to complete the restore.
恢复完后,需要重新启动XAMPP,才能使恢复的数据可用。
设置xampp开机自动运行centos 7.0 以前版本
(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 #重启
设置xampp开机自动运行centos 7.0-7.2 版本,如下修改
Autostart on boot
In order to start Xampp at boot, service needs to be created, in the following file:
# vi /etc/systemd/system/xampp.service
Put these lines:
[Unit] Description=XAMPP [Service] Type=forking ExecStart=/opt/lampp/xampp start ExecReload=/opt/lampp/xampp restart ExecStop=/opt/lampp/xampp stop PrivateTmp=True [Install] WantedBy=multi-user.target
Enable autostart like this:
# systemctl enable xampp.service
禁止自动启动:
# systemctl disable xampp.service
Usage
Use the following commands to control XAMPP:# /opt/lampp/lampp start,stop,restart
设置xampp开机自动运行centos 7.2 版本
把启动程序的命令添加到/etc/rc.d/rc.local文件中,比如下面的是设置开机启动xampp 最后面增加一条红色的语句
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
#/opt/lampp/xampp start
~
再执行下面语句也能够执行开机自动启动程序
chmod +x /etc/rc.d/rc.local
systemctl enable rc-local.service
或者以下两条命令自动增加启动程序
echo "/opt/lampp/xampp start" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
安装net-tools 工具
yum install net-tools
关闭FTP服务 在xampp启动后,执行
/opt/lampp/xampp stopftp