apache, php, mysql 安裝過程命令記錄

s1mba發表於2015-09-28

一、安裝apache httpd-2.0.64

 

1. ./configure --prefix=/usr/local/apache2

 

2. make

3. make install;
4. 配置/usr/local/apache2/conf/httpd.conf
5. 繫結內網:Listen 本機ip :80

 

 

6. 設定根目錄/usr/local/apache2,靜態頁面目錄/data/simba/apache/htdocs/web 和

cgi-bin 目錄/data/simba/apache/cgi-bin/

 

 

 

 

7. 設定開機啟動

echo '/usr/local/apache2/bin/apachectl start' >> /etc/rc.d/rc.local

cp -r /usr/local/apache2/bin/apachectl /etc/init.d/apache-httpd
chmod +x /etc/init.d/apache-httpd ;
/etc/init.d/apache-httpd start //全部模組安裝完配置好再啟動

 

// service apache-httpd restart

 

 

二、安裝php  php-5.5.5


1. 安裝libxml2(libxml2-2.7.2); 直接./configure make && make install
 

2. 安裝php
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
--with-config-file-path=/usr/local/lib --enable-soap
 

3. make && make install
 

4. cp /home/php-5.5.5/php.ini-production /usr/local/lib/php.ini
 

5. 裝php soap 模組  
cd /home/php-5.5.5/ext/soap #執行phpize 生成configure
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --enable-soap
make && make install
編譯後的soap.so 檔案儲存在
/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/
查詢/usr/local/lib/php.ini 中的extension_dir = "./"
修改為extension_dir =
"/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/"
增加以下行:extension = "soap.so"
 

6. 生成mod_rewrite.so

cd /home/httpd-2.0.64/modules/mappers/
/usr/local/apache2/bin/apxs -c mod_rewrite.c
/usr/local/apache2/bin/apxs -i -a -n mod_rewrite mod_rewrite.la

 

7. 修改http.conf 配置檔案,加入php 解析和mod_rewrite.so 模組
AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps
LoadModule php5_module modules/libphp5.so
LoadModule rewrite_module modules/mod_rewrite.so
 

8. php 裝mysql 模組

(需要先安裝mysql,路徑/usr/local/mysql/) // 與裝soap 模組類似
cd /home/php-5.5.5/ext/mysql #執行phpize 生成configure
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --with-mysql=/usr/local/mysql/
make && make install
編譯後的mysql.so 檔案儲存在
/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/
查詢/usr/local/lib/php.ini 中的extension_dir = "./"
修改為extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/"
增加以下行:extension = "mysql.so"

 

三、Mysql 安裝 mysql-5.0.22


1) 安裝Mysql
// 編譯安裝
./configure --prefix=/usr/local/mysql

make && make install
// 設定配置檔案的監聽ip 和data 目錄
groupadd mysql
useradd -g mysql mysql
mkdir /data/mysql_db
chown -R mysql:mysql /data/mysql_db
cp support-files/my-medium.cnf /etc/my.cnf
更改my.cnf bind-address=本機ip datadir=/data/mysql_db
// 配置許可權表
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/data/mysql_db
// 設定開啟自啟動
cp -r support-files/mysql.server /etc/init.d/mysqld ; chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
/etc/init.d/mysqld start // sh bin/mysqld_safe &  // service mysqld restart
export PATH=/usr/local/mysql/bin:$PATH
// 配置客戶端訪問,可不設定root 密碼
/usr/local/mysql/bin/mysqladmin -u root password root@test
mysql -A -uroot -proot@test

// 新增使用者,給予許可權
create user simba identified by 'simba@test';
grant select,insert,update,delete, create, drop on *.* to simba@'%' identified by 'simba@test' ;

 

 

相關文章