在CentOS安裝XAMPP

在CentOS安裝XAMPP

之前曾分享安裝XAMPP在Windows系統上,今天來分享裝在Linux系統!
Linux又分好幾套,大眾的有:CentOS和Ubuntu這兩套,哪個比較適合當web server呢?可以看看這篇文章的比較。


一個Server穩定是首要的,所以我選擇CentOS!
下載最新版的CentOS7:https://www.centos.org/download/

安裝可參考:
http://linux.vbird.org/linux_basic/0157installcentos7.php
https://blog.gtwang.org/linux/centos-7-installation-tutorial/

安裝XRDP讓Windows用遠端桌面連線登入

Step 1. Install EPEL and nux Desktop repository rpms by automatic. (recommended)

1
# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

Step 2. The following command to install xrdp, and you will get the following output, make sure you are getting package from the newly created repository.

1
# yum -y install xrdp tigervnc-server

Step 3. Once it is installed, lets start the xrdp service.

1
# systemctl start xrdp.service

Step 4. The xrdp will listen on 3389, lets confirm this by issuing following command.

1
# netstat -antup | grep xrdp

Step 5. By default, services wont auto start after system reboot, issue the following command to enable the service at system start up.

1
# systemctl enable xrdp.service

Step 6. Next is to create iptables rule to allow rdp connection from the external machines, following command will add the exception for xrdp port (3389).

1
# firewall-cmd --permanent --zone=public --add-port=3389/tcp
1
# firewall-cmd --reload

Step 7. Now take rdp from any windows machine using Remote Desktop Connection, enter ip address of Linux server in computer field and click on connect.

接下來用putty遠端連線操作

開始安裝XAMPP

選擇你要安裝的XAMPP版本:https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/

1
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.30/xampp-linux-x64-5.6.30-0-installer.run
1
chmod 755 xampp-linux-x64-5.6.30-0-installer.run
1
sudo ./xampp-linux-x64-5.6.30-0-installer.run

在CentOS安裝XAMPP

XAMPP安裝完成後,可以在/opt/lampp下看到安裝的檔案

啟動XAMPP

1
sudo /opt/lampp/lampp start

停止XAMPP

1
sudo /opt/lampp/lampp stop

查看狀態

1
sudo /opt/lampp/lampp status

設定XAMPP開機自動啟動

vi /etc/rc.d/rc.local

touch /var/lock/subsys/local
/opt/lampp/lampp start

設定密碼

1
/opt/lampp/lampp security

XAMPP 頁面密碼
phpMyAdmin 帳號pma 的密碼
MySQL 帳號root 的密碼
FTP 帳號daemon 的密碼

設定防火牆

1
firewall-cmd --permanent --zone=public --add-port=80/tcp
1
firewall-cmd --permanent --zone=public --add-port=21/tcp
1
firewall-cmd --permanent --add-service=ftp
1
firewall-cmd --reload

設定Ftp,上傳檔案

可編輯/opt/lampp/etc/proftpd.conf

設定目錄或帳號

上傳wordpress檔案,我這邊路徑是/opt/lampp/htdocs/web/wordpress

設定網站目錄

編輯/opt/lampp/etc/httpd.conf
找到
#Include etc/extra/httpd-vhosts.conf
改成
Include etc/extra/httpd-vhosts.conf

編輯/opt/lampp/etc/extra/httpd-vhosts.conf

添加

<VirtualHost *:80>
    ServerAdmin admin@yourname.com
    DocumentRoot "/opt/lampp/htdocs"
    ServerName 127.0.0.1
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@yourname.com
DocumentRoot "/opt/lampp/htdocs/web/wordpress"
ServerName wordpress.yourname.com
ErrorLog "logs/wordpress.yourname.com-error_log"
CustomLog "logs/wordpress.yourname.com-access_log" common
</VirtualHost>

在CentOS安裝XAMPP

建立資料庫

開啟瀏覽器,htp://127.0.0.1/phpmyadmin,建立資料庫

建立WordPress

開啟瀏覽器,htp://wordpress.yourname.com

在CentOS安裝XAMPP


建立網站過程我遇到這個錯誤 this version of PCRE is compiled without UTF support at offset 0

查詢指令 /opt/lampp/bin/pcretest -C

PCRE version 8.37 2015-04-28
Compiled with
8-bit support
No UTF-8 support
No Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Parentheses nest limit = 250
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

顯示不支援UTF-8...

解決方式:

下載PCRE:https://sourceforge.net/projects/pcre/files/pcre/

解壓縮後,在pcre資料夾執行

sudo ./configure --prefix=/opt/lampp --enable-utf8 --enable-unicode-properties

sudo make

sudo make install

若在安裝過程中有出現錯誤,可能少了gcc和c++元件

yum install -y gcc gcc-c++

重啟XAMPP,安裝成功

PCRE version 8.40 2017-01-11
Compiled with
8-bit support
UTF-8 support
Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Parentheses nest limit = 250
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

 

參考:

https://www.openfoundry.org/tw/enterprise-application/9349-centos7

http://stackoverflow.com/questions/35801425/xampp-mysql-this-version-of-pcre-is-compiled-without-utf-support-at-offset-0

wordpress建站該選擇Linux主機還是Windows主機?
https://www.xgllseo.com/?p=2254

與大家分享...
在CentOS安裝XAMPP
Facebook
0在CentOS安裝XAMPP
Google+
0在CentOS安裝XAMPP
Pinterest
0在CentOS安裝XAMPP
email
0 回復

發表評論

想要留言嗎?
歡迎歡迎!

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *