最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

在liunx安装xampp_设置xampp运行远程访问

XAMPP教程 admin 360浏览 0评论

在liunx安装xampp

一、下载xmapp:

  1. 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赋权并执行

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

三、执行安装命令:

  1. [root@localhost wordpress]# ./xampp-linux-x64-7.3.11-0-installer.run
  2. ----------------------------------------------------------------------------
  3. Welcome to the XAMPP Setup Wizard.
  4. ----------------------------------------------------------------------------
  5. Select the components you want to install; clear the components you do not want
  6. to install. Click Next when you are ready to continue.
  7. XAMPP Core Files : Y (Cannot be edited)
  8. XAMPP Developer Files [Y/n] :y
  9. Is the selection above correct? [Y/n]: y
  10. ----------------------------------------------------------------------------
  11. Installation Directory
  12. XAMPP will be installed to /opt/lampp
  13. Press [Enter] to continue:
  14. ----------------------------------------------------------------------------
  15. Setup is now ready to begin installing XAMPP on your computer.
  16. Do you want to continue? [Y/n]: y
  17. ----------------------------------------------------------------------------
  18. Please wait while Setup installs XAMPP on your computer.
  19. Installing
  20. 0% ______________ 50% ______________ 100%
  21. #########################################
  22. ----------------------------------------------------------------------------
  23. Setup has finished installing XAMPP on your computer.
  24. [root@localhost wordpress]#

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

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

至此安装成功。

配置xampp服务

查看xampp服务的命令选项
  1. [root@localhost wordpress]# /opt/lampp/lampp -h
  2. Usage: lampp <action>
  3. start Start XAMPP (Apache, MySQL and eventually others)
  4. startapache Start only Apache
  5. startmysql Start only MySQL
  6. startftp Start only ProFTPD
  7. stop Stop XAMPP (Apache, MySQL and eventually others)
  8. stopapache Stop only Apache
  9. stopmysql Stop only MySQL
  10. stopftp Stop only ProFTPD
  11. reload Reload XAMPP (Apache, MySQL and eventually others)
  12. reloadapache Reload only Apache
  13. reloadmysql Reload only MySQL
  14. reloadftp Reload only ProFTPD
  15. restart Stop and start XAMPP
  16. security Check XAMPP's security
  17. enablessl Enable SSL support for Apache
  18. disablessl Disable SSL support for Apache
  19. backup Make backup file of your XAMPP config, log and data files
  20. oci8 Enable the oci8 extenssion
  21. panel Starts graphical XAMPP control panel
  22. [root@localhost wordpress]#
启动xampp服务
  1. [root@localhost wordpress]# /opt/lampp/lampp start
  2. Starting XAMPP for Linux 7.3.11-0...
  3. XAMPP: Starting Apache...fail.
  4. XAMPP: Another web server is already running.
  5. XAMPP: Starting MySQL...ok.
  6. XAMPP: Starting ProFTPD...ok.
  7. [root@localhost wordpress]#

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

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

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

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

三、重启服务:

  1. [root@localhost ~]# /opt/lampp/lampp restart
  2. Restarting XAMPP for Linux 7.3.11-0...
  3. XAMPP: Stopping Apache...ok.
  4. XAMPP: Stopping MySQL...ok.
  5. XAMPP: Stopping ProFTPD...ok.
  6. XAMPP: Starting Apache...ok.
  7. XAMPP: Starting MySQL...ok.
  8. XAMPP: Starting ProFTPD...ok.
  9. [root@localhost ~]#

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

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

设置随系统启动

  1. [root@localhost ~]# ln -s /opt/lampp/lampp /etc/rc.d/rc3.d/S99lampp
  2. [root@localhost ~]# ln -s /opt/lampp/lampp /etc/rc.d/rc4.d/S99lampp
  3. [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密码

操作记录如下:

  1. [root@localhost ~]# /opt/lampp/lampp security
  2. XAMPP: Quick security check...
  3. XAMPP: MySQL is accessable via network.
  4. XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] y
  5. XAMPP: Turned off.
  6. XAMPP: Stopping MySQL...ok.
  7. XAMPP: Starting MySQL...ok.
  8. XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
  9. XAMPP: Do you want to set a password? [yes] yes
  10. XAMPP: Password:
  11. XAMPP: Password (again):
  12. XAMPP: Setting new MySQL pma password.
  13. XAMPP: Setting phpMyAdmin's pma password to the new one.
  14. XAMPP: MySQL has no root passwort set!!!
  15. XAMPP: Do you want to set a password? [yes] yes
  16. XAMPP: Write the password somewhere down to make sure you won't forget it!!!
  17. XAMPP: Password:
  18. XAMPP: Password (again):
  19. XAMPP: Setting new MySQL root password.
  20. XAMPP: Change phpMyAdmin's authentication method.
  21. XAMPP: The FTP password for user 'daemon' is still set to 'xampp'.
  22. XAMPP: Do you want to change the password? [yes] yes
  23. XAMPP: Password:
  24. XAMPP: Password (again):
  25. XAMPP: Reload ProFTPD...ok.
  26. XAMPP: Done.
  27. [root@localhost ~]#

设置xampp运行远程访问

编辑文件:

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

Require local调整为 Require all granted

重启服务:

  1. [root@localhost ~]# /opt/lampp/lampp restart
  2. Restarting XAMPP for Linux 7.3.11-0...
  3. XAMPP: Stopping Apache...ok.
  4. XAMPP: Stopping MySQL...ok.
  5. XAMPP: Stopping ProFTPD...ok.
  6. XAMPP: Starting Apache...ok.
  7. XAMPP: Starting MySQL...ok.
  8. XAMPP: Starting ProFTPD...ok.
  9. [root@localhost ~]#

转载请注明:XAMPP中文组官网 » 在liunx安装xampp_设置xampp运行远程访问