LAMP小配置

学习LINUX也有些时间了,感觉学LINUX挺好玩的,配置了下LAMP,有写的不好的请大家多多指教。



下面是我的安装包
mysq-5.0.56.tar.gz    httpd-2.2.11.tar.gz   php-5.2.14.tar.gz    gd-2.1.0.35.tar.gz    jpegsrc.v6b.tar.gz   freetype-2.2.1.tar.gz
libpng-1.2.12.tar.gz   libmcrypt-2.57.tar.gz  zlib-1.2.3.tar.gz
用tar -zxvf都解压出来,然后进入相应的解压目录进行编译安装。

mysql的安装
./configure '--prefix=/usr/local/mysql' '--sysconfdir=/etc' '--enable-shared' '--enable-assembler' '--with-mysql-user=mysql' '--without-debug' '--enable-thread-safe-client' '--with-extra-charsets=all'
make
make install

cp my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db //初始化数据库
chown -R root.mysql /usr/local/mysql //把mysql及其目录下的所有东东的属主设置为root,属组为mysql
chown -R mysql.mysql /usr/local/mysql/var //把var及其目录下的所有东东的属主与属组都设置为mysql  
ln -s /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld //把mysql的启动服务连接到/etc/init.d下
service mysqld start //启动数据库服务 "

apache的安装
./ configure" "--prefix=/usr/local/apache" "--enable-so" "--enable-rewrite" "--enable-mods-shared=most" "--with-mpm=worker" "--enable-threads"
make
make install

ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd //把http的启动服务连接到/etc/init.d下
service httpd start //启动http服务  

freetype的安装  
./configure --prefix=/usr/local/freetype --enable-shared  
make 
make install

png 的安装  
./configure --prefix=/usr/local/libpng --enable-shared  
make 
make install

jpeg的安装  
mkdir -p /usr/local/jpeg/man/man1
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
./configure --prefix=/usr/local/jpeg --enable-shared  
make
make install

gd的安装    
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --enable-shared  
make 
make install

libmcrypt的安装   //装这个主要是因为用到phpmyadmin出现无法加载mcrypt外链面用的。
./configure --prefix=/usr/local/libmcrypt
make 
make install

zlib的安装
./configure --prefix=/usr/local/zlib
make 
make install

PHP的安装
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib/php --with-gd=/usr/local/gd --with-freetype-dir=/usr/local/freetype/ --with-jpeg-dir=/usr/local/jpeg/ --with-jpeg-dir=/usr/local/jpeg/ --with-png-dir=/usr/local/png/ --with-zlib-dir=/usr/local/zlib/ --enable-mbstring --with-mcrypt=/usr/local/libmcrypt --enable-safe-mode 
make
make install

cp php.ini-dist /usr/local/lib/php/php.ini     
//对httpd.conf文件的设置。  
LoadModule php5_module modules/libphp5.so  //一般会自动加载  
DirectoryIndex index.php   index.html  //添加主页,不然访问不了PHP
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
service httpd restart //重新启动http服务  

在根目录下建立index.php,输入
<?
phpinfo();
?>
打开网页测试




configure: error: No curses/termcap library found.....显示出错,把ncurses-devel包安装上  
configure:error: xml2-config not found. Please check your libxml2 installation.....显示出错, 把libxml2安装上  
[libphp5.la]error......显示出错,把libtool-ltdl,libtool-ltdl-devel安装上
如果编译参数正确,大部分的都出错都是在于软件包的安装不完成,不过具体的还是得看编译时的出错信息,或查看编译出错的日志文件,这样就能很快的定位问题的所在了。

你可能感兴趣的:(职场,lamp,休闲)