我的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
#
若出现noticehttpd: 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
 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

linuxlsq

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值