- 論壇徽章:
- 0
|
作者:silverwolf
本文參考tian1118,trotter的文章修改而成,使用的源碼包版本如下:
mysql-standard-4.0.25-pc-linux-gnu-i686.tar.gz
httpd-2.0.54.tar.gz
php-4.4.0.tar.gz
可到
www.mysql.com
,
www.apache.org
,
www.php.net
下載
一、安裝mysql
cp mysql-standard-4.0.25-pc-linux-gnu-i686.tar.gz /usr/local/
tar -zxvf mysql-standard-4.0.25-pc-linux-gnu-i686.tar.gz
cd mysql-standard-4.0.25-pc-linux-gnu-i686/
vi INSTALL-BINARY 獲得安裝信息
groupadd mysql
useradd -g mysql mysql
cd /usr/local/
mv mysql-standard-4.0.25-pc-linux-gnu-i686 mysql 安裝文檔該步驟為建立軟鏈接
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
./bin/mysqld_safe --user=mysql & 從后臺(tái)啟動(dòng)mysql,這時(shí)會(huì)看到
[1] 3879
[root--1014--/usr/local/mysql]Starting mysqld daemon with databases from /usr/local/mysql/data
證明已經(jīng)成功,可以用ps -aux │ grep mysql 可以看到。
測(cè)試:
/usr/local/mysql/bin/mysql
mysql>show database;
mysql>exit;
mysqladmin -uroot -p '你的舊密碼'(默認(rèn)為空) '你的新密碼'
二、安裝apache
tar -zxvf httpd-2.0.54.tar.gz
cd httpd-2.0.54
vi INSTALL 獲得一些安裝信息
mkdir /usr/local/apache2
./configure --perfix=/usr/local/apache2 --enable-module=so
make ; make install
cd /usr/local/apache2/bin
cd /usr/loca/apache2/conf/
查找#ServerName
www.example.com:80
改為ServerName 127.0.0.1:80
./apachectl start
httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
測(cè)試:打開瀏覽器,在地址欄輸入127.0.0.1或你的電腦名,如果可以看到漂亮的羽毛,證明apache安裝成功。
三、安裝php
tar -zxvf php-4.4.0.tar.gz
cd php-4.4.0
vi INSTALL 獲得一些安裝信息
mkdir /usr/local/php4
./configure --prefix=/usr/local/php4 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
如果出現(xiàn)如下證明快成功了。
+--------------------------------------------------------------------+
│ License: │
│ This software is subject to the PHP License, available in this │
│ distribution in the file LICENSE. By continuing this installation │
│ process, you are bound by the terms of this license agreement. │
│ If you do not agree with the terms of this license, you must abort │
│ the installation process at this point. │
+--------------------------------------------------------------------+
Thank you for using PHP.
make
make install
四、php與apache整合
vi /usr/local/apache2/conf/httpd.conf
找到DirectoryIndex改為如下:
DirectoryIndex index.html index.php index.htm index.html.var
找到
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在它后面添加,增加PHP支持模組
AddType application/x-httpd-php .php
/usr/local/apache2/bin/apachectl restart
測(cè)試:
vi /usr/local/apache2/htdocs/index.php
添加 ,保存退出
打開瀏覽器,輸入
http://127.0.0.1/index.php
如果可以看到關(guān)于php的信息,證明php安裝成功。
五、安裝phpBB
/usr/local/mysql/bin/mysql -u root -p '你的密碼'
mysql>create database myphpbb;
Query OK, 1 row affected (0.02 sec)
好了.記住你為phpbb起的數(shù)據(jù)庫名,以后要用的.myphpbb
到
www.phpbb.com
下載軟件包
lang_chinese_simplified.tar.gz phpbb的源碼包
phpBB-2.0.12.tar.gz 中文支持
subSilver_chinese_simplified.tar.gz 中文支持
cp phpBB-2.0.12.tar.gz /usr/local/apache2/htdocs
cd /usr/local/apache2/htdocs
tar -zxvf phpBB-2.0.12.tar.gz
tar -zxvf lang_chinese_simplified.tar.gz
tar -zxvf subSilver_chinese_simplified.tar.gz
cp -r lang_chinese_simplified/ ./phpBB2/language/
cp -r subSilver/ ./phpBB2/templates/
chmod 777 phpBB2/config.php
cd ../bin/
./apachectl start 啟動(dòng)apache
在瀏覽器中輸入
http://localhost/phpBB2/install/install.php
進(jìn)入phpbb的安裝界面.這里有許多需要填寫的信息。
我寫出自己填寫的信息以供參考.
預(yù)設(shè)論壇語言: Chinese
數(shù)據(jù)庫格式: MySQL4.x
請(qǐng)選擇安裝模式: 完整安裝
數(shù)據(jù)庫設(shè)定
數(shù)據(jù)庫服務(wù)器主機(jī)名稱: localhost
您的數(shù)據(jù)庫名稱: myphpbb
數(shù)據(jù)庫用戶帳號(hào): root
數(shù)據(jù)庫密碼: 你新設(shè)置的密碼(默認(rèn)為空)
數(shù)據(jù)庫的表格字首 (Prefix): phpbb_
系統(tǒng)管理員設(shè)定
論壇管理員電子郵件信箱: ***@***
域名:
服務(wù)端口: 80
腳本路徑: /phpBB2/
系統(tǒng)管理員帳號(hào)名稱: administrator
系統(tǒng)管理員密碼: ****
系統(tǒng)管理員密碼 [ 確認(rèn) ]: ****
這時(shí)安裝成功,系統(tǒng)會(huì)提示你在刪除phpBB2目錄中的install/ contrib/以保證安全
六、相關(guān)安全設(shè)定
(1).阻止你的系統(tǒng)響應(yīng)任何從外部/內(nèi)部來的ping請(qǐng)求
#vi /etc/rc.d/rc.local
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
(2).減少系統(tǒng)CPU占有量和由于誤操作導(dǎo)致系統(tǒng)重啟
#vi /etc/inittab
id:3:initdefault:
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now
保存并退出
(3). 刪除不必要的擁護(hù)和組
#userdel -r username
adm,lp,sync,shutdown,halt,mail,procmail,mailx,news,uucp,operator,games,gopher,ftp
#groupdel groupname
adm,lp,sync,shutdown,halt,mail,procmail,mailx,news,uucp,operator,games,gopher,ftp
(4). 創(chuàng)建ftp賬戶
#groupadd su
#useradd -g su -d /usr/local/apache/htdocs webserver
(5). 用chattr命令給下面的文件加上不可更改屬性。
[root@deep]# chattr +i /etc/passwd
[root@deep]# chattr +i /etc/shadow
[root@deep]# chattr +i /etc/group
[root@deep]# chattr +i /etc/gshadow
(6).禁止任何人(非法)通過su命令改變?yōu)閞oot用戶
#vi /etc/pam.d/su
auth sufficient /lib/security/pam_rootok.so debug
auth required /lib/security/pam_wheel.so group=sul
保存并退出
這樣之后,只有su組成員可以改變?yōu)閞oot用戶
(7).資源限制防止DoS類型攻擊
#vi /etc/security/limits.conf
在這個(gè)文件后加入下面
* hard core 0
* hard rss 5000
* hard nproc 20
保存并退出
#vi /etc/pam.d/login
在這個(gè)文件后加入下面
session required /lib/security/pam_limits.so
保存并退出
(8).修改Apache的版本
httpd.conf里面,修改配置項(xiàng).
ServerSignature Off
ServerTokens Prod
或者編譯前修改相關(guān)定義文件
include/ap_release.h
AP_SERVER_MAJORVERSION主版本號(hào)
AP_SERVER_MINORVERSION次版本號(hào)
AP_SERVER_PATCHLEVEL最次版本號(hào)
七、創(chuàng)建MySQL、Apache自啟動(dòng)
#vi /etc/rc.d/rc.local
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/apache/bin/apachectl start
本文來自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/60/showart_40151.html |
|