//////////////////源碼編譯安裝mysql:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
安裝成功會看到類似
[1] 3879
[root--1014--/usr/local/mysql]Starting mysqld daemon with databases from /usr/local/mysql/var
這樣的提示資訊
也可以通過ps -A | grep mysql查看mysql是否已經後台運行判斷是否成功,當然在/usr/local/mysql/bin
目錄下鍵入mysql後進入
mysql> 也表示mysql成功安裝。
為了在shell下進行資料庫操作直接輸入命令就可以,不用進入/usr/local/mysql/bin/目錄,建議建立如下連結:
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
ln -s /usr/local/mysql/bin/mysql /usr/bin
另外,通過編譯源碼安裝的mysql每次電腦重啟後需要自己重新手動啟動mysql,為此有必要將mysql加入服務和
啟動項,如下:
mv share/mysql/mysql.server /etc/init.d/mysql
chmod 775 /etc/init.d/mysql
chkconfig --add mysql
(小注備忘:775表示rwx rwx r-x,因為r--4,w--2,x--1)
///////////////////源碼安裝apache
shell>./configure --prefix=/usr/local/apache
shell>make
shell>make install
//
ln -s /usr/local/apache/bin/apachectl /usr/bin/
啟動:
shell>apachectl start
測試:鍵入127.0.0.1能看到It Works表明apache安裝成功
//////////////////源碼安裝php
shell>./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
shell>make
shell>make install
shell>cp php.ini-dist /usr/local/lib/php.ini
php和apache的整合
開啟/usr/local/apache/conf/httpd.conf
對apache做如下配置
#佈建網站跟目錄
DocumentRoot "/home/httpd/html/" #自己設定
(注意:修改預設設定後,其下方的
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
中的“Deny from all”改為“Allow from all”,否則訪問測試頁面會出現forbidden錯誤
並且修改
<Directory "/xxx">中的“/xxx"修改為之前設定的DocumentRoot)
#設定是否允許索引目錄
Options FollowSymLinks MultiViews
#設定php檔案尾碼
AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps
#設定apache的預設檔案名稱次序
DirectoryIndex index.php index.shtml index.html index.htm
shell>apachectl restart
///////測試
寫個簡單的php檔案
http://127.0.0.1/xx.php
///////////////////////////////////////////////phpMyAdmin安裝
源碼解壓後直接放到DocumentRoot下
配置可能需要用到的命令
cd phpMyAdmin
mkdir config # create directory for saving
chmod o+rw config # give it world writable permissions
cp config.inc.php config/ # copy current configuration for editing
chmod o+w config/config.inc.php # give it world writable permissions
進入http://xxx/phpMyAdmin/scripts/setup.php可以可視化的進行配置
置過程中搞了很長時間還是每次進入http://xxx/phpMyAdmin時提示
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
錯誤,可以地址http://xxx/phpMyAdmin/index.php進入則正常,沒搞明白怎麼回事