#
LAMP=Linux+Apache+Mysql+Php
源码包构建LAMP
编译环境:yum groupinstall "Development Tools" "Development Libraries" "Legacy Software Development"
所需要的源码包mysql-5.1.45-linux-i686-glibc23.tar.gz(绿色软件),httpd-2.2.16.tar.bz2,php-5.3.5.tar.bz2
#
Mysql
tar zxvf mysql-5.1.45-linux-i686-glibc23.tar.gz -C /usr/local/
cd /usr/local
ln -sv mysql-5.1.45-linux-i686-glibc23 mysql
cd mysql
创建Mysql组、mysql用户
groupadd -g 306 -r mysql
useradd -g mysql -r -u 306 -s /sbin/nologin -M mysql
接下来改变文件的属主和属组
chown mysql:mysql ./*
对Mysql进行初始化 scripts/mysql_install_db --user=mysql
将会看到如下信息:
[root@station68 mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h node2.a.com password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
再次改变放该路径下文件的属主chown root ./*
chown mysql data/
cp support-files/my-large.cnf /etc/my.cnf(Mysql配置文件)
cp support-files/mysql.server /etc/init.d/mysqld
启动mysql
service mysqld start
测试连接/usr/local/mysql/bin/mysql
这样很不爽我们来改变他的路径,编辑/etc/profile文件加入这样一行
PATH=$PATH:/usr/local/mysql/bin
. /etc/profile(让系统读此文件)
#
我们知道系统检查的库文件路径默认为/lib,/usr/lib,/usr/local/lib
#
将mysql库文件和头文件连接到系统
接下来我们这样来做
库文件:vim /etc/ld.so.conf.d/mysql.conf
让内核重读库文件路径:ldconfig -v
加入这样一行就OK了:/usr/local/mysql/lib
下面连接头文件,我们这里做一个软连接ln -sv /usr/local/mysql/include /usr/include/mysql
检查一下是否连接完全:mysql
开机自动启动:chkconfig mysql on
OK,这里Mysql完成
#
Apache
解压tar jxvf httpd-2.2.16.tar.bz2 -C /usr/src/
cd /usr/src/httpd-2.2.16/
接下来编译:
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-track-vars --with-z
#rpm -qa |grep "zlib"
make
make install
编译完成启动服务: /usr/local/apache/bin/apachectl start
编辑/etc/profile
加入这样一行PATH=$PATH:/usr/local/apache/bin
. /etc/profile
测试:
OK
#Php
解压tar jxvf php-5.3.5.tar.bz2 -C /usr/src/
cd /usr/src/php-5.3.5/
接下来编译:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli={根据不同版本而定此处为mysqlnd[/usr/local/mysql/bin/mysql_config|mysqlnd]} --enable-mbstring=all
make
make install
编译完成后打开/etc/httpd/httpd.conf配置文件检查三处
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php (手动添加)
DirectoryIndex index.php index.html
DocumentRoot=/usr/local/apache/htdocs
OK
基本架构完成,以待后续
阅读(1209) | 评论(0) | 转发(0) |