在liunx安装并配置xampp

在liunx安装xampp

一、下载xmapp:

wget wget https://nchc.dl.sourceforge.net/project/xampp/XAMPP%20Linux/7.3.11/xampp-linux-x64-7.3.11-0-installer.run

二、以root用户对xampp-linux-x64-7.3.11-0-installer.run赋权并执行

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

三、执行安装命令:

   [root@localhost wordpress]# ./xampp-linux-x64-7.3.11-0-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.
   
   [root@localhost wordpress]# 

注意:如果不是root会提示如下信息

   [wordpress@localhost ~]$ ./xampp-linux-x64-7.3.11-0-installer.run 
   Error: There has been an error.
   This installer requires root privileges. Please become superuser before 
   executing the installer
   Press [Enter] to continue:  

至此安装成功。

配置xampp服务

查看xampp服务的命令选项
   [root@localhost wordpress]# /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
   
   [root@localhost wordpress]# 
   
启动xampp服务
   [root@localhost wordpress]# /opt/lampp/lampp start
   Starting XAMPP for Linux 7.3.11-0...
   XAMPP: Starting Apache...fail.
   XAMPP:  Another web server is already running.
   XAMPP: Starting MySQL...ok.
   XAMPP: Starting ProFTPD...ok.
   [root@localhost wordpress]# 
   

Apache端口服务启动失败,执行下面命令发现80端口被占用:

   [root@localhost wordpress]# netstat -anp | grep 80
   tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3280/master         
   tcp6       0      0 :::80                   :::*                    LISTEN      12680/httpd       
调整端口

一、编辑文档: vi /opt/lampp/etc/httpd.conf把内容Listen 80改为Listen 8080

二、编辑文档: vi /opt/lampp/lampp把内容testport 80改为`testport 8080

三、重启服务:

   [root@localhost ~]# /opt/lampp/lampp restart
   Restarting XAMPP for Linux 7.3.11-0...
   XAMPP: Stopping Apache...ok.
   XAMPP: Stopping MySQL...ok.
   XAMPP: Stopping ProFTPD...ok.
   XAMPP: Starting Apache...ok.
   XAMPP: Starting MySQL...ok.
   XAMPP: Starting ProFTPD...ok.
   [root@localhost ~]# 
   

四、如果服务端口正常,但页面无法访问,检查防火墙是否关闭,下面是centos 7.4操作:

   [root@localhost ~]# systemctl status firewalld
   [root@localhost ~]# systemctl stop firewalld
   [root@localhost ~]# systemctl disable firewalld
   Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
   Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
   [root@localhost ~]# systemctl disable firewalld
   

设置随系统启动

   [root@localhost ~]# ln -s /opt/lampp/lampp  /etc/rc.d/rc3.d/S99lampp
   [root@localhost ~]# ln -s /opt/lampp/lampp  /etc/rc.d/rc4.d/S99lampp
   [root@localhost ~]# ln -s /opt/lampp/lampp  /etc/rc.d/rc5.d/S99lampp

设置密码

用户名 密码 描述
pmp root MySQL/phpMyAdmin 用户 pma设置密码
root root Mysql的root密码
daemon root FTP用户daemon密码

操作记录如下:

[root@localhost ~]# /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] y
XAMPP:  Turned off.
XAMPP: Stopping MySQL...ok.
XAMPP: Starting MySQL...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.
[root@localhost ~]# 

设置xampp运行远程访问

编辑文件:

[root@localhost ~]# vi /opt/lampp/etc/extra/httpd-xampp.conf 

Require local调整为 Require all granted

重启服务:

[root@localhost ~]# /opt/lampp/lampp restart
Restarting XAMPP for Linux 7.3.11-0...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
[root@localhost ~]# 

在这里插入图片描述

发布了592 篇原创文章 · 获赞 221 · 访问量 130万+

猜你喜欢

转载自blog.csdn.net/henni_719/article/details/103142044