Centos7下安裝xampp5 (工具在文章底部提供)

由於Centos7,新安裝配置後,並沒有相應的一些常用命令軟件包(tar zxvf,ifconfig , wget) 等,則首先需要安裝一些常用的命令:

1:安裝常用軟件包:

    1-1:tar 命令:yum install -y tar

    1-2:wget命令:yum install -y wget

    1-2:ifconfig命令:

                            yum install net-tools

                             yum provides ifconfig

                             yum whatprovides ifconfig

    1-3:安裝uzip:yum install -y unzip zip(現在暫時用不到,後期會用先配置好)

2:基本常用軟件配置好後,執行ifconfig 查看IP地址或者ping www.baidu.com,查看網絡是否ping通,方便下一步下載軟件

3:查看電腦環境:

$ uname -r
3.10.0-327.28.3.el7.x86_64
$ cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

4:下載安裝xampp-linux-x64-5.5.38-3-installer.run

$ wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.5.38/xampp-linux-x64-5.5.38-3-installer.run
$ chmod +x xampp-linux-x64-5.5.38-3-installer.run
$ ./xampp-linux-x64-5.5.38-3-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.

5:安裝完成後,追加環境變量(可執行文件,庫文件和頭文件)

$ vi /etc/profile
export PATH=$PATH:/opt/lampp/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lampp/lib
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/lampp/include
$ source /etc/profile

6:啓動LAMP(出現以下,則成功啓動Success!)

$ /opt/lampp/lampp start
Starting XAMPP for Linux 5.5.38-3...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

Ps:lampp命令支持stop,status,start,restart等命令

7:設置xampp開機自動啓動

$ ln -s /opt/lampp/lampp /etc/init.d/lampp
$ chkconfig --add lampp

8:xampp常用組件的配置

# HTTPD主配置文件;
/opt/lampp/etc/httpd.conf
 
# PHP主配置文件;
/opt/lampp/etc/php.ini
 
# MariaDB主配置文件;
/opt/lampp/etc/my.cnf
 
# MariaDB數據目錄;
/opt/lampp/var/mysql
 
# 所有日誌目錄;
/opt/lampp/logs/

OK!至此安裝完成,瀏覽器輸入IP/dashboard 或者(localhost/dashboard ),訪問即可,如果像重裝,只需刪除 /opt/lampp即可、


Ps:如果不能訪問,則還需修改Centos的防火牆 以及 xampp的配置文件

直接修改 httpd-xampp.conf 的配置文件(注意自己的所在路徑)

vi /opt/lampp/etc/extra/httpd-xampp.conf

將如下代碼中  將Require Local 修改替換爲 Require all granted

# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
    Require all granted
</Directory>

<Directory "/opt/lampp/phpsqliteadmin">
    AllowOverride AuthConfig Limit
    Require all granted
</Directory>
意思就是將接受本地請求授權爲接受所有請求 

此時xampp和PHPmyadmin頁面就都可以自由的從外網訪問了!

還沒有完成:還需設置Centos的防火牆:

查看已經開放的端口:
firewall-cmd --list-ports
開啓端口

firewall-cmd --zone=public --add-port=80/tcp --permanent   #設置這一句重啓防火牆即可 開放80端口給外界訪問,一定要重啓防火牆生效
命令含義:

–zone #作用域

–add-port=80/tcp #添加端口,格式爲:端口/通訊協議

–permanent #永久生效,沒有此參數重啓後失效

重啓防火牆
firewall-cmd --reload #重啓firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
firewall-cmd --state #查看默認防火牆狀態(關閉後顯示notrunning,開啓後顯示running)

附件下載:CentOS7x8664DVD1511.iso  提取碼:8ub2

                 xampp-linux-x64-5.5.38-3-installer.run  提取碼:iudo

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