我的LAMP源码编译安装linux+Apache+mysql+php
httpd-2.2.17.tar.gz
mysql-5.1.51.tar.gz
php-5.2.17.tar.gz
mysql的安裝
#安裝需要的庫
yum -y install ncurses ncurses-devel
#創建MySQL用戶及用戶組
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
cp /home/root/mysql-5.1.41.tar.gz /usr/local/src
cd /usr/local/src
tar zxvf mysql-5.1.41.tar.gz
chown -R mysql:mysql mysql-5.1.41
cd mysql-5.1.41
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/data/mysql.sock \
--with-plugins=innobase,partition,myisam,heap \
--enable-assembler \
--with-charset=utf8 \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-static=yes \
--with-big-tables
make
make install
-------------------------
#根據應用程序的負載選擇對應的配置文件
mkdir /usr/local/mysql/etc
cp /usr/local/mysql/share/mysql/my-medium.cnf /usr/local/mysql/etc/my.cnf
vi /usr/local/mysql/etc/my.cnf
#在[mysqld]中添加:
pid-file = /usr/local/mysql/etc/mysql.pid
datadir = /usr/local/mysql/data
#設置pid位置及數據存放位
chown -R mysql:mysql /usr/local/mysql
--------------------------
#安裝系統表
/usr/local/mysql/bin/mysql_install_db \
--basedir=/usr/local/mysql \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--skip-external-locking \
--user=mysql
#啟動MySQL
/usr/local/mysql/bin/mysqld_safe \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--user=mysql &
--------------------------
#將MySQL添加到系統服務
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld
Apache的安裝
#安裝需要的庫
yum -y install zlib-devel
cp /home/root/httpd-2.2.17.tar.gz /usr/local/src
cd /usr/local/src
tar xzvf httpd-2.2.17.tar.gz
./configure --prefix=/usr/local/apache2 --enable-so --enable-threads--with-mpm=worker --enable-cache --enable-rewrite=shared -enable-deflate=shared--enable-expires=shared
make
make install
-----------------------------
#啟動apache
/usr/local/apache2/bin/apachectl start
#若出現notice如httpd: Could notreliably determine the server's fully qualified domain name, using 127.0.0.1for ServerName
vi /usr/local/apache2/conf/httpd.conf
修改ServerName那行為:ServerNamelocalhost:80
/usr/local/apache2/bin/apachectl restart
php的安裝
?#先安裝需要的庫
?#yum -y install libxml2
?#yum -y install libxml2-devel
?#yum -y install gd
?#yum -y install gd-devel
?#yum -y install curl curl-devel
?#yum -y install libjpeg libjpeg-devellibpng libpng-devel
?#yum -y install freetypefreetype-devel
?#yum -y install openldap
?#yum -y install openldap-devel
?#
?#cp /home/root/php-5.2.17.tar.gz/usr/local/src
?#cd /usr/local/src
?#tar xzvf php-5.2.17.tar.gz
?#
?#./configure --prefix=/usr/local/php5\
?#--with-mysql=/usr/local/mysql \
?#--with-apxs2=/usr/local/apache2/bin/apxs\
?#--with-libxml-dir=/usr/local/lib\
?#--with-gd \
?#--with-jpeg-dir=/usr/local/jpeg6\
?#--with-zlib \
?#--with-curl \
?#--with-ldap \
?#--with-gettext \
?#--with-iconv \
?#--enable-mbstring \
?#--enable-soap \
?#--with-png-dir=/usr/local/libpng2\
?#--with-freetype-dir=/usr/local/freetype\
?#--with-xmlrpc \
?#--with-config-file-path=/usr/local/php5/etc
?#
?#make
?#make install
?#
?#cp /usr/local/src/php.ini-dist/usr/local/php5/etc/php.ini
?
#配置
#vi /usr/local/apache2/conf/httpd.conf
#DirectoryIndex index.html后增加index.php
#DirectoryIndex index.html index.php
#
##<IfModule mime_module>中增加:
#AddType application/x-httpd-php .php .phtml
#AddType application/x-httpd-php-source .phps
#
#/usr/local/apache2/bin/apachectl restart
##若遇到錯誤如:/usr/local/apache2/modules/libphp5.so: cannotrestore segment prot after reloc: Permission denied
##解決辦法:
#setenforce 0
#chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t/usr/local/apache2/modules/libphp5.so
#/usr/local/apache2/bin/apachectl restart
#setenforce 1
#/usr/local/apache2/bin/apachectl restart
?
總結
以上是生活随笔為你收集整理的我的LAMP源码编译安装linux+Apache+mysql+php的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java对象析构_c++之对象构造顺序和
- 下一篇: mysql 优化rand_mysql优化