Press "Enter" to skip to content

Linux下XAMPP的安装配置

XAMPP 是一个易于安装且包含 MySQL、PHP 和 Perl 的 Apache 发行版。XAMPP 的确非常容易安装和使用:只需下载,安装,启动即可。该软件以前被称作 LAMPP.

XAMPP 背后的理念,是为想进入 Apache 世界的开发者提供一套易于安装的发行版。为了方便开发者, XAMPP 被默认配置为所有功能全部开启。

从安全的角度看,默认配置并不理想,对生产环境也不够安全——请勿在此类环境中使用 XAMPP。

从 LAMPP 0.9.5 开始,您可以通过调用 /opt/lampp/lampp security 使 XAMPP 更安全。

安装步骤

一. 进入 Linux shell 并以系统管理员的身份登录:

su - root

二. 将文件下载到/opt目录:

cd /opt
wget wget https://downloadsapachefriends.global.ssl.fastly.net/5.6.37/xampp-linux-x64-5.6.37-0-installer.run

只允许使用上述命令安装 XAMPP。 使用此命令时,已存在的旧版 XAMPP 会被覆盖。XAMPP 被安装在/opt/lampp目录下。

三. 使用下面的命令开始运行 XAMPP:

chmod 755 xampp-linux-x64-5.6.37-0-installer.run
sudo ./xampp-linux-x64-5.6.37-0-installer.run
/opt/lampp/lampp start

您应该能在屏幕上看到类似下面的提示信息:

Starting XAMPP 5.6.37...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.
Ready. Apache and MySQL are running.

好了。Apache 和 MySQL 正在运行中。

四.测试安装是否成功,在浏览器里输入以下信息:

http://localhost
或者
http://IP

如果页面能正常打开,说明安装成功。

这样安装后,需要设置相应的权限和密码.

XAMPP 缺乏安全防护的列表:

MySQL 管理员(root)没有密码。
MySQL 可通过网络访问。
ProFTPD 使用“lampp”作为用户名“nobody”的密码。
PhpMyAdmin 可以通过网络访问。
示例程序可以通过网络访问。
MySQL 和 Apache 在同一个用户名(nobody)下运行。

五.输出入安全检查并配置相应密码.

/opt/lampp/lampp security

接下来会看到这些:

XAMPP: Quick security check...

XAMPP: MySQL is accessable via network.

XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes

XAMPP: Turned off.

XAMPP: Stopping MySQL...

XAMPP: Starting MySQL...

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 passworde somewhere down to make sure you won't forget it!!!

XAMPP: Password: ******

XAMPP: Password (again): ******

XAMPP: Setting new MySQL root password.

XAMPP: Setting phpMyAdmin's root password to the new one.

XAMPP: The FTP password for user 'nobody' is still set to 'lampp'.

XAMPP: Do you want to change the password? [yes] yes

XAMPP: Password: ******

XAMPP: Password (again): ******

XAMPP: Reload ProFTPD...

XAMPP: Done.

最后重启下xampp:

/opt/lampp/lampp restart 

六.当这样设置了密码后会保护xampp的演示页面(http://localhost/xampp/),用户名是lampp,这还给mysql的root用户设置了密码,默认密码为空,这样很不安全!

重要的文件和目录

-w829

七.停止 XAMPP

想停止 XAMPP,只需输入如下命令:

/opt/lampp/lampp stop

您现在应该能看到:

Stopping LAMPP 5.6.37...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.

然后 XAMPP 的 Linux 版就停止运行了。

八.卸载

想卸载 XAMPP(一定要先停止相关服务),只需输入如下命令:

/opt/lampp/lampp stop
rm -rf /opt/lampp

卸载完成。:)

九.将XAMPP调置为每次开机运行.

vi /etc/rc.d/rc.local

在最后面增加一行:

/opt/lampp/lampp start

附上:高级的启动与停止参数

/opt/lampp/lampp -h
Usage: lampp <action>

        start         Start XAMPP (Apache, MySQL and eventually others)
        startapache   Start only Apache
        startmysql    Start only MySQL
        startftp      Start only ProFTPD

        stop          Stop XAMPP (Apache, MySQL and eventually others)
        stopapache    Stop only Apache
        stopmysql     Stop only MySQL
        stopftp       Stop only ProFTPD

        reload        Reload XAMPP (Apache, MySQL and eventually others)
        reloadapache  Reload only Apache
        reloadmysql   Reload only MySQL
        reloadftp     Reload only ProFTPD

        restart       Stop and start XAMPP
        security      Check XAMPP's security

        enablessl     Enable SSL support for Apache
        disablessl    Disable SSL support for Apache

        backup        Make backup file of your XAMPP config, log and data files

        oci8          Enable the oci8 extenssion

        panel         Starts graphical XAMPP control panel

Be First to Comment

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注