2016/05/23
by xbw/
///环境 centOS 6.5
首先去xampp官网找一下xampp for linux 的下载链接,
最近地址更换,2016/11/22
xampp-linux-x64-5.6.21-0-installer.run
64位的 5.6.21版本,在linux 端输入
cd /opt ,我们把他下载到opt文件夹下,
输入
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run
等待下载
[root@iZ28lh28mjgZ opt]# wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run
--2016-05-23 23:25:25-- https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run
Resolving sourceforge.net... 216.34.181.60
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run/ [following]
--2016-05-23 23:25:29-- https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run/
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run/download [following]
--2016-05-23 23:25:31-- https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run/download
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run?r=&ts=1464017133&use_mirror=jaist [following]
--2016-05-23 23:25:34-- http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run?r=&ts=1464017133&use_mirror=jaist
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://jaist.dl.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run [following]
--2016-05-23 23:25:35-- http://jaist.dl.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.21/xampp-linux-x64-5.6.21-0-installer.run
Resolving jaist.dl.sourceforge.net... 150.65.7.130, 2001:df0:2ed:feed::feed
Connecting to jaist.dl.sourceforge.net|150.65.7.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 135161506 (129M) [application/x-makeself]
Saving to: “xampp-linux-x64-5.6.21-0-installer.run”
100%[======================================>] 135,161,506 10.1M/s in 17s
2016-05-23 23:25:52 (7.78 MB/s) - “xampp-linux-x64-5.6.21-0-installer.run” saved [135161506/135161506]
下载完成后
输入ls查看文件夹下的内容;
[root@iZ28lh28mjgZ opt]# ls
rh xampp-linux-x64-5.6.21-0-installer.run
[root@iZ28lh28mjgZ opt]# chmod 755 xampp-linux-x64-5.6.21-0-installer.run
[root@iZ28lh28mjgZ opt]# sh ./xampp-linux-x64-5.6.21-0-installer.run
./xampp-linux-x64-5.6.21-0-installer.run: ./xampp-linux-x64-5.6.21-0-installer.run: cannot execute binary file
[root@iZ28lh28mjgZ opt]# sudo ./xampp-linux-x64-5.6.21-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.
一路y就安装好了,
接下来就是启动了,
[root@iZ28lh28mjgZ ~]# /opt/lampp/lampp start
Starting XAMPP for Linux 5.6.21-0...
XAMPP: Starting Apache...fail.
XAMPP: Another web server is already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
我们看到apache start fail了,估计是80端口被占用了,我们查一下
[root@iZ28lh28mjgZ ~]# netstat -anp | grep 80 | grep LISTEN
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3613/(squid)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3613/(squid)
查了80端口,被pid为3613的进程给占用了,虽然不知道是什么东西,但是果断杀掉了。
kill 3613后就好了
[root@iZ28lh28mjgZ ~]# kill 3613
[root@iZ28lh28mjgZ ~]# /opt/lampp/lampp start
Starting XAMPP for Linux 5.6.21-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...already running.
XAMPP: Starting ProFTPD...already running.
[root@iZ28lh28mjgZ ~]# /opt/lampp/lampp start
Starting XAMPP for Linux 5.6.21-0...
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...already running.
XAMPP: Starting ProFTPD...already running.
已经运行了。
增加开机自启
#ln -s /opt/lampp/xampp /etc/rc.d/init.d/xampp
#chkconfig --add xampp
#chkconfig xampp on
直接使用mysql命令的方法
简单的方法是可以直接将/opt/lampp/bin/目录添加到环境变量中,这样就可以直接使用mysql和mysqldump命令了。
打开 ~/.bashrc 文件
在最后一行加入
# PATH
export PATH=/opt/lampp/bin:$PATH
保存退出执行该文件中的命令
source ~/.bashrc