在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 ~]# 

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章