XAMPP for Linux 的安裝及配置

1. 下載xampp並安裝php

下載地址:http://www.apachefriends.orgmysql

安裝linux

下載完成後,只要輸入下列命令:sql

(1).進入Linux命令模式,切換成爲系統管理者:數據庫

suapache

(2).將下載的壓縮檔解壓縮到 /opt下:安全

tar xvfz xampp-linux-1.5.3a.tar.gz -C /opt網絡

注意:請使用這些指令來安裝XAMPP,不要使用任何微軟操做系統底下的工具程序來解壓縮檔案, 它會使得程序沒法正確執行。ssh

注意2:這個指令會覆蓋掉舊有的XAMPP版本。ide

這樣就完成了。XAMPP如今已經安裝在 /opt/lampp 目錄下了。

啓動

要啓動XAMPP只要執行下列的指令:

/opt/lampp/lampp start

如今在你的畫面上,你會看到相似下方的這些訊息:

Starting XAMPP 1.5.3a...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.

Apache 和 MySQL 如今已經啓動了。


2. 從缺省PHP5切換到PHP 4.3.11

/opt/lampp/lampp php4


3. 修改httpd.conf

(可選,在我安裝的XAMPP裏,默認是沒有的。若是有須要,請手動添加)

AddDefaultCharset ISO-8859-1
到GB2312


4. 修正xampp的安全問題

設置LAMPP pages密碼,關閉MySQL網絡訪問,修改ftp用戶nobody的密碼。

/opt/lampp/lampp security

修改MySQL數據庫root用戶密碼

/opt/lampp/bin/mysqladmin -u root password "newpassword"


5.配置自動啓動和關閉xampp

找到這個文件 /etc/inittab (以CentOS爲例)

# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault: // 查看這個地方,知道runlevel是5

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5 // 對應這個文件夾
l6:6:wait:/etc/rc.d/rc 6

經過命令模式(終端)進入 /etc/rc.d/rc5.d 的目錄.

ln -s /opt/lampp/lampp S99lampp // 自動啓動XAMPP

ln -s /opt/lampp/lampp K01lampp // 中止自動啓動

若是你想分步啓動,能夠輸入命令:vi /etc/rc.d/rc.local


/opt/lampp/lampp startapcahe
/opt/lampp/lampp startmysql
/opt/lampp/lampp startssl
/opt/lampp/lampp startproftpd
/opt/lampp/lampp start 表示所有啓動

6.修改MySQL缺省字符集爲utf8,改my.cnf文件

[client]
default_character_set=utf8
[mysqld]
# default-character-set=utf8
character-set-server = utf8
collation-server = utf8_general_ci
[mysql]
default_character_set=utf8

經過上面的設置後,再show variables like "%char%"看看,是否正確。(這個地方不明白在那裏使用 show variables like "%char%")

另外:修改MySQL缺省字符集爲GBK,改my.cnf文件
代碼
[mysqld]
# default-character-set=gbk
character-set-server = gbk
collation-server = gbk_chinese_ci
[client]
default_character_set=gbk
[mysql]
default_character_set=gbk

7. 如何容許或者禁止root經過SSH登錄(Fun-FreeBSD)?

修改sshd_config配置文件,更改其中的條目PermitRootLogin no&line;yes 就能夠了。
(不知道在那裏修改)

八、 xampp 更新
下載更新包後解壓,終端機中輸入:xampp-upgrade/start

--------------------------------------------------------------------------------
附註:

程序在那裏?

在典型的Unix系統裏並無所謂的系統設定或管理接口,而僅有所謂的設定檔案,下表是包含在XAMPP中的相關軟件設定檔案概要。

重要檔案和目錄

/opt/lampp/bin/

XAMPP指令的家目錄。例如 /opt/lampp/bin/mysql 用來執行MySQL。

/opt/lampp/htdocs/

Apache 文件根目錄。

/opt/lampp/etc/httpd.conf

Apache設定檔案。

/opt/lampp/etc/my.cnf

MySQL設定檔案。

/opt/lampp/etc/php.ini

PHP設定檔案。

/opt/lampp/etc/proftpd.conf

ProFTPD設定檔案。(從 0.9.5版後纔有)

/opt/lampp/phpmyadmin/config.inc.php

phpMyAdmin設定檔案。

卸載Xampp
rm -rf /opt/lampp/lampp

備份

作爲系統安全保障的一部分,及時、全面的備份是一項必不可少的工做。數據庫以及各軟件的配置文件、日誌等,常常會使管理員暈頭轉向,一不當心就會漏掉一項。而XAMPP則讓這一工做變得很是簡單,輸入下面的命令就可一步完成:

/opt/lampp/lampp backup ****

命令後面跟着的是MySQL 的 root 用戶的密碼。命令執行後會看到下面的內容:

Backing up databases...

Backing up configuration, log and htdocs files...

Calculating checksums...

Building final backup file...

Backup finished.

Take care of /opt/lampp/backup/xampp-backup-19-02-06.sh

恢復

恢復之前的備份,只需以 root 用戶身份運行下面的命令:

# sh /opt/lampp/backup/xampp-backup-19-02-06.sh ****

命令後面跟着的是MySQL 的 root 用戶的密碼,這時用戶將看到以下信息:

Checking integrity of files...

Restoring configuration, log and htdocs files...

Checking versions...

Installed: XAMPP 1.5.1

Backup from: XAMPP 1.5.1

Restoring MySQL databases...

Restoring MySQL user databases...

Backup complete. Have fun!

You may need to restart XAMPP to complete the restore.

恢復完後,須要從新啓動XAMPP,才能使恢復的數據可用。

相關文章
相關標籤/搜索