將安裝檔案上傳到linux的/OPT目錄中。
環境:REDHAT5.5
工具:httpd-2.2.17.tar.gz
mysql-5.0.22.tar.gz
php-5.2.17.tar.gz
phpMyAdmin-3.3.4-all-languages.tar.bz2
gd-2.0.32.tar.gz
freetype-2.1.10.tar.gz
libpng-1.2.14.tar.gz.TAR.GZ
libxml2-2.6.19.tar.gz.GZ
zlib-1.2.3.tar.gz
:http://www.everbox.com/f/p5knHnhIVuV1LWdskGeC8VmMfA
一.安裝apache
tar zxvf httpd-2.2.17.tar.gz 解壓
cd httpd-2.2.17 進入
編譯並安裝:
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs
Make
Make install
編譯安裝完成後修改設定檔
vi /usr/local/apache2/conf/httpd.conf
ServerName www.example.com:80 修改為:自己IP:80 我修改為:www.xiaodu.com
此處我以網域名稱訪問需要修改自己的hosts檔案!
添加192.168.1.2 www.xiaodu.com (我自己的實驗機器IP為192.168.1.2)
開啟服務:/usr/local/apache2/bin/apachectl start
查看服務:netstat -antpl | grep 80
訪問網頁,查看是否正常
OK,網頁正常訪問。
二.安裝mysql
解壓:tar zxvf mysql-5.0.22.tar.gz
1. 編譯並安裝:./configure --prefix=/usr/local/mysql
Make && make install
2. 添加使用者:useradd -M -s /sbin/nologin mysql
3. [root@RHCE mysql-5.0.22]# /usr/local/mysql/bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h RHCE password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@RHCE mysql-5.0.22]# cp support-files/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@RHCE mysql-5.0.22]# chown -R root:mysql /usr/local/mysql/
[root@RHCE mysql-5.0.22]# chown -R mysql /usr/local/mysql/var/
[root@RHCE mysql-5.0.22]# echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
[root@RHCE mysql-5.0.22]# ldconfig
[root@RHCE mysql-5.0.22]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@RHCE mysql-5.0.22]# cp support-files/mysql.server /etc/init.d/mysqld
cp: overwrite `/etc/init.d/mysqld'? y
[root@RHCE mysql-5.0.22]# chmod +x /etc/init.d/mysqld
添加啟動項:
[root@RHCE mysql-5.0.22]# chkconfig --add mysqld
[root@RHCE mysql-5.0.22]# chkconfig --level 35 mysqld on
設定mysql程式的執行路徑:
[root@RHCE mysql-5.0.22]# export PATH=$PATH:/usr/local/mysql/bin --(設定環境變數)
[root@RHCE mysql-5.0.22]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile ---(將環境變數添加到全域設定檔中)
查看MYSQL 是否安裝成功,進入看看:
[root@RHCE mysql-5.0.22]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.22-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql>
出現以上資訊表明安裝成功,可以正常進入使用!
修改mysql管理員密碼命令:
[root@RHCE mysql-5.0.22]# mysqladmin -u root password 'new_password'
三.編譯安裝php,並添加GD支援!
1. 添加GD支援組件
(1)tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
Make
Make install
(2)tar zxvf libpng-1.2.14.tar.gz.TAR.GZ
cd libpng-1.2.14
./configure
Make
Make install
(3)tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure
Make
Make install
(4) tar zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b/
./configure --enable-shared
Make
Make test
Make install
(5) tar zxvf libxml2-2.6.19.tar.gz.GZ
cd libxml2-2.6.19
./configure
Make
Make install
(6) tar zxvf gd-2.0.32.tar.gz
cd gd-2.0.32
./configure --with-png --with-freetype --with-jpeg
Make
Make install
2.安裝php
(1)Tar zxvf php-5.2.17.tar.gz
(2)Cd php-5.2.17
(3)./configure --prefix=/usr/local/php5 --with-apxs2=/opt/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-sockets --enable-mbstring --with-config-file-path=/usr/local/php5/lib --with-gd --with-zlib --with-png-dir=/usr/local/include/libpng12/ --with-libxml-dir=/usr/local/include/libxml2/libxml --with-jpeg-dir=/usr/local/include --with-freetype-dir=/usr/local/include/freetype2/freetype
當出現以下提示,並且沒有報錯資訊,表明成功:
+--------------------------------------------------------------------+
| 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.
(4)Make
Make install
[精彩] [GD]史上最簡單的讓PHP支援GD的方法,對菜鳥尤其適合
編輯apache 設定檔
vi /usr/local/apache2/conf/httpd.conf
修改檔案內容:添加紅色字型部分
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
3.測試php
vi /etc/usr/local/apache2/htdocs/info.php
新增內容:
<?php
echo phpinfo();
?>
重啟apache後,訪問www.xiaodu.com/info.php,出現此頁面表示安裝成功。
下面就可以安裝DZ論壇了。詳細教程請點擊此處去官網下載和查看安裝教程。
解壓phpmyadmin 到/usr/local/apache2/htdocs/
修改config.default.php 檔案
$cfg['blowfish_secret'] = ''; 設定一個秘密即可,用root使用者登入即可!
或者借鑒DZ官網教程。
本文出自 “技術成就一切” 部落格