/ 中存储网

Linux系统编译安装Apache+PHP+MySQL步骤

2014-01-11 08:31:01 来源:itjs.cn
为最近手头上正在做的一个项目编译服务器环境而写:

安装mysql

#cd /usr/local/src

#groupadd mysql

#useradd -g mysql mysql

#wget http://mysql.dataphone.se/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz

#tar zxvf mysql-5.0.67.tar.gz

#cd mysql-5.0.67

#./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-charset=gbk --bindir=/usr/local/bin --sbindir=/usr/local/sbin --enable-shared --enable-static

#make

#make install

#cd /usr/local/mysql

#mysql_install_db

#chown -R mysql:mysql *

#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql

#/etc/rc.d/mysql start (加入到/etc/rc.local)

安装apache

#useradd ossh

#cd /usr/local/src

#wget

#tar zxvf  httpd-2.2.9.tar.gz

#cd  httpd-2.2.9

#./configure --prefix=/usr/local/apache --enable-cgi --enable-ssl --enable-modules="most"

#make

#make install

#vi /usr/local/apache2/etc/httpd.conf

User daemon

Group daemon改为:

User ossh

Group ossh

打开Include conf/extra/httpd-vhosts.conf的注释

在#Include conf/extra/httpd-languages.conf行下面增加一行:

AddDefaultCharset GBK

#vi /usr/local/apache2/conf/extra/httpd-vhosts.conf 清空内容,加入下面的设置:

NameVirtualHost *:80

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "/home/ossh/slightphp/public/cdnms/htdocs"

ServerName localhost

ErrorLog "logs/slightphp-error_log"

CustomLog "logs/slightphp-access_log" common

<IfModule dir_module>

DirectoryIndex index.html index.php index.htm

</IfModule>

Alias /res "/home/ossh/slightphp/public/cdnms/resource"

Alias /client "/home/ossh/slightphp/resource"

ScriptAlias /cgi-bin "/home/ossh/slightphp/public/cdnms/cgi-bin

<Directory "/home/ossh/slightphp/">

Options Indexes FollowSymLinks

AllowOverride All

Order Allow,Deny

Allow from All

</Directory>

</VirtualHost>

#ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apachectl

#/etc/init.d/apachectl start (加入到/etc/rc.local)

安装php

#cd /usr/local/src

#tar zxvf php-5.2.6.tar.gz

#cd php-5.2.6

#./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-mbstring --without-pear --disable-cli --with-mysqli=/usr/local/bin/mysql_config --with-ldap --enable-pcntl

#make

#make install

#ln -s /usr/local/php/bin/php-cgi /usr/local/bin/php

#cp php.ini-recommended /usr/local/php/lib/php.ini

#mkdir -p /usr/lib/php/modules

#vi /usr/local/php/lib/php.ini

;error_reporting = E_ALL & ~E_NOTICE改成

error_reporting = E_ALL & ~E_NOTICE

error_reporting  =  E_ALL改成

;error_reporting  =  E_ALL

display_errors = Off改成

display_errors = On

short_open_tag = Off改成

short_open_tag = On

magic_quotes_gpc = Off改成

magic_quotes_gpc = On

post_max_size = 8M改成

post_max_size = 50M

upload_max_filesize = 2M改成

upload_max_filesize = 40M

;date.timezone =改成

date.timezone = Asia/Shanghai

extension_dir = "./"改成

extension_dir = "/usr/lib/php/modules/"