linux下的apache2+mysql5+php4+gd2原始碼完整安裝詳解
1.安裝mysql
小五註釋:mysql的安裝包實在是太多了,我在學習的時候,遇到最大的問題就是安裝mysql的問題,後來才發現,原來是自己選擇安裝包不對,非常鬱悶,為了避免其他朋友也遇到同樣的問題,所以,我把本文所涉及的mysql安裝包放到skydrive網盤上,這樣,你就不會下載錯了,希望對需要的朋友能有所幫組,下載地址
下載速度可能慢一些,但是絕對好用
shell> groupadd -g 500 mysql
shell> useradd -u500 -gmysql -M mysql
shell> tar -xzf mysql.**.tar.gz
shell> cd mysql.**
shell> ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/data –with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
shell> make
shell> make install
shell> cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //開機啟動mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe –user=mysql &
注意直接執行後會出現下面錯誤:
Starting mysqld daemon with databases from /usr/local/mysql/data STOPPING server from pid file /usr/local/mysql/data/localhost.localdomain.pid 070514 19:15:13 mysqld ended
需執行 shell> chown -R mysql.mysql data
修改root密碼:
use mysql
update user set Password=password(“123456″) where User=”root”;
delete from user where User=””;
2.apache安裝
shell> tar -xzf httpd-2.2.4.tar.gz
shell> cd httpd-2.2.4
shell> ./configure –prefix=/usr/local/apache2 –enable-rewrite=shared –enable-speling=shared –enable-module=so
shell> make
shell> make install
3.iconv安裝
shell> ./configure –prefix=/usr/local/iconv
shell> make
shell> make install
4.gd部分安裝
zlib包
shell> ./configure –prefix=/usr/local/zlib
shell> make check
shell> make install
libpng包(支援PNG)
shell> ./configure –prefix=/usr/local/libpng
shell> make
shell> make install
jpeg-6b包(支援jpg格式)
shell> ./configure –prefix=/usr/local/jpeg-6b –enable-share –enable-static
shell> make test
shell> make
shell> make install
shell> make install-lib
freetype包(字型支援)
shell> ./configure –prefix=/usr/local/freetype
shell> make
shell> make install
最後安裝gd包
shell> ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png=/usr/local/libpng –with-freetype=/usr/local/freetype
shell> make
shell> make install
make時會出現
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/tmp/gd-2.0.26gif`
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gd-2.0.26gif`
make: *** [all] Error 2
需要複製/usr/local/libpng/include/目錄下的cp /usr/local/libpng/include/pngconf.h /home/jong/tmp/gd-2.0.34
cp /usr/local/libpng/include/png.h /home/jong/tmp/gd-2.0.34
5.安裝php
shell> ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-gd=/usr/local/gd2 –with-jpeg-dir=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype –enable-trace-vars -with-mysql=/usr/local/mysql -with-iconv=/usr/local/iconv –enable-mbstring=all –with-curl –enable-track-vars –with-DBA –enable-mbstr-enc-trans –enable-mbregex –with-config-file-path=/usr/local/php –with-xml –with-gettext
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php/php.ini
編輯apache配置檔
shell> cd /usr/local/apache2/conf
shell> vi httpd.conf
在LoadModule php4_module modules/libphp4.so
新增AddType application/x-httpd-php .php
OK,基本的安裝已經完成,如果重新起動APACHE出現:/usr/local/apache2/bin/apachectl start Syntax error . line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解決:
編輯/etc/selinux/config,找到這段:
# This file controls the state of SELinux . the system.
# SELINUX= can take .e of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing
把 SELINUX=enforcing 註釋掉:#SELINUX=enforcing ,然後新加一行為:
SELINUX=disabled
儲存,關閉。
編輯/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux . the system.
# SELINUX= can take .e of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing
如果SELINUX已經是 SELINUX=disabled,那麼就不用改了,否則就把SELINUX=enforcing 註釋掉,新加一行:
SELINUX=disabled
儲存,退出。
如果你碰到其他類似提示:
cannot restore segment prot after reloc: Permission denied
哪應該是SELinux的問題,可以考慮把它關閉。
shell> groupadd -g 500 mysql
shell> useradd -u500 -gmysql -M mysql
shell> tar -xzf mysql.**.tar.gz
shell> cd mysql.**
shell> ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/data –with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
shell> make
shell> make install
shell> cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //開機啟動mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe –user=mysql &
注意直接執行後會出現下面錯誤:
Starting mysqld daemon with databases from /usr/local/mysql/data STOPPING server from pid file /usr/local/mysql/data/localhost.localdomain.pid 070514 19:15:13 mysqld ended
需執行 shell> chown -R mysql.mysql data
修改root密碼:
use mysql
update user set Password=password(“123456″) where User=”root”;
delete from user where User=””;
2.apache安裝
shell> tar -xzf httpd-2.2.4.tar.gz
shell> cd httpd-2.2.4
shell> ./configure –prefix=/usr/local/apache2 –enable-rewrite=shared –enable-speling=shared –enable-module=so
shell> make
shell> make install
3.iconv安裝
shell> ./configure –prefix=/usr/local/iconv
shell> make
shell> make install
4.gd部分安裝
zlib包
shell> ./configure –prefix=/usr/local/zlib
shell> make check
shell> make install
libpng包(支援PNG)
shell> ./configure –prefix=/usr/local/libpng
shell> make
shell> make install
jpeg-6b包(支援jpg格式)
shell> ./configure –prefix=/usr/local/jpeg-6b –enable-share –enable-static
shell> make test
shell> make
shell> make install
shell> make install-lib
freetype包(字型支援)
shell> ./configure –prefix=/usr/local/freetype
shell> make
shell> make install
最後安裝gd包
shell> ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png=/usr/local/libpng –with-freetype=/usr/local/freetype
shell> make
shell> make install
make時會出現
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/tmp/gd-2.0.26gif`
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gd-2.0.26gif`
make: *** [all] Error 2
需要複製/usr/local/libpng/include/目錄下的cp /usr/local/libpng/include/pngconf.h /home/jong/tmp/gd-2.0.34
cp /usr/local/libpng/include/png.h /home/jong/tmp/gd-2.0.34
5.安裝php
shell> ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-gd=/usr/local/gd2 –with-jpeg-dir=/usr/local/jpeg-6b –with-zlib-dir=/usr/local/zlib –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype –enable-trace-vars -with-mysql=/usr/local/mysql -with-iconv=/usr/local/iconv –enable-mbstring=all –with-curl –enable-track-vars –with-DBA –enable-mbstr-enc-trans –enable-mbregex –with-config-file-path=/usr/local/php –with-xml –with-gettext
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php/php.ini
編輯apache配置檔
shell> cd /usr/local/apache2/conf
shell> vi httpd.conf
在LoadModule php4_module modules/libphp4.so
新增AddType application/x-httpd-php .php
OK,基本的安裝已經完成,如果重新起動APACHE出現:/usr/local/apache2/bin/apachectl start Syntax error . line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解決:
編輯/etc/selinux/config,找到這段:
# This file controls the state of SELinux . the system.
# SELINUX= can take .e of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing
把 SELINUX=enforcing 註釋掉:#SELINUX=enforcing ,然後新加一行為:
SELINUX=disabled
儲存,關閉。
編輯/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux . the system.
# SELINUX= can take .e of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing
如果SELINUX已經是 SELINUX=disabled,那麼就不用改了,否則就把SELINUX=enforcing 註釋掉,新加一行:
SELINUX=disabled
儲存,退出。
如果你碰到其他類似提示:
cannot restore segment prot after reloc: Permission denied
哪應該是SELinux的問題,可以考慮把它關閉。
本文轉自 Jhuster 51CTO部落格,原文連結:http://blog.51cto.com/xwnet/124588,如需轉載請自行聯絡原作者
相關文章
- Linux 下MySQL 5.6.12原始碼安裝完整版LinuxMySql原始碼
- Linux下PostgreSQL原始碼安裝LinuxSQL原始碼
- linux下LAMP原始碼安裝部署LinuxLAMP原始碼
- linux下從原始碼安裝gitLinux原始碼Git
- nginx原始碼編譯安裝(詳解)Nginx原始碼編譯
- 詳解LAMP原始碼編譯安裝LAMP原始碼編譯
- Linux下Nodejs安裝詳解LinuxNodeJS
- mysql在linux下的完整安裝(轉)MySqlLinux
- linux下通過原始碼安裝gitLinux原始碼Git
- Linux下MySQL5.6原始碼安裝LinuxMySql原始碼
- 如何在Debian或Ubuntu上安裝完整的Linux核心原始碼UbuntuLinux原始碼
- Linux下通過原始碼編譯安裝程式Linux原始碼編譯
- linux下mysql5.1.73原始碼安裝筆記LinuxMySql原始碼筆記
- Linux下安裝hive 詳解及HiveSQL執行LinuxHiveSQL
- linux下easy_install的安裝與使用詳解Linux
- 如何獲取微信的版本號詳解【附完整原始碼】原始碼
- 詳解HashMap原始碼解析(下)HashMap原始碼
- Linux環境下, 原始碼編譯安裝詳解 (編譯CMake 3.15 和 gcc 5.3.0 為例)Linux原始碼編譯GC
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- Linux下原始碼編譯方式安裝MySQL5.5Linux原始碼編譯MySql
- 【轉載】Linux下徹底解除安裝mysql詳解LinuxMySql
- Linux下安裝Hadoop 詳解及WordCount執行LinuxHadoop
- linux-原始碼的編譯安裝和解除安裝Linux原始碼編譯
- Termux安裝完整版Linux(Ubuntu)詳細步驟LinuxUbuntu
- Linux 原始碼方式安裝zipLinux原始碼
- 【PG安裝】postgresql10 for linux 原始碼安裝SQLLinux原始碼
- linux安裝python3(原始碼安裝)LinuxPython原始碼
- Linux系統安裝詳解Linux
- Linux 下安裝subversion 詳細指南Linux
- CentOS6系統原始碼安裝LNMP環境詳解CentOS原始碼LNMP
- Linux下安裝oracle11g和錯誤詳解LinuxOracle
- linux mysql 安裝步驟- 原始碼安裝5.7.17 版本LinuxMySql原始碼
- mysql-5.1.68-linux原始碼安裝MySqlLinux原始碼
- linux中原始碼編譯安裝Linux原始碼編譯
- MySQL5.6 linux原始碼安裝MySqlLinux原始碼
- Linux安裝JDK完整步驟LinuxJDK
- RedHat5下安裝Mysql詳解RedhatMySql
- centos下nosql資料庫的安裝詳解CentOSSQL資料庫