分类
电脑技巧

UBUNTU下的LAMP详细配置

UBUNTU下的LAMP配置
安装系统

##### 安装编译环境 #####

sudo apt-get install build-essential

##### m4 #####

sudo dpkg –i m4*.deb

##### flex #####

sudo dpkg –i flex*.deb

##### zlib-devel #####

sudo apt-get install zlib1g-dev

##### libxml2 #####

sudo apt-get install libxml2 libxml2-dev

##### zlib #####

tar -zxvf zlib*.tar.gz
cd zlib*
./configure –prefix=/usr/local/zlib
make && sudo make install

##### OpenSSL #####

tar -zxvf openssl*.tar.gz
cd openssl*
./config –prefix=/usr/local/ssl -openssldir=/usr/local/ssl –shared zlib
make && sudo make install 

##### FreeType #####

tar -zxvf freetype*.tar.gz
cd freetype*
./configure –prefix=/usr/local/freetype
make && sudo make install

##### Jpeg #####

tar -zxvf jpeg*.tar.gz
cd jpeg*
sudo mkdir /usr/local/jpeg
sudo mkdir /usr/local/jpeg/bin
sudo mkdir /usr/local/jpeg/lib
sudo mkdir /usr/local/jpeg/include
sudo mkdir /usr/local/jpeg/man
sudo mkdir /usr/local/jpeg/man/man1
./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
make && sudo make install

##### LibPNG #####

tar -zxvf libpng*.tar.gz
cd libpng*
./configure –prefix=/usr/local/libpng
make && sudo make install

##### GD Library #####

tar -zxvf gd*.tar.gz
cd gd*
./configure –prefix=/usr/local/gd –with-jpeg=/usr/local/jpeg –with-freetype=/usr/local/freetype –with-png –with-zlib=/usr/local/zlib
make && sudo make install

##### curl #####

tar -zxvf curl*.tar.gz
cd curl*
sudo mkdir -p /usr/local/curl
./configure –prefix=/usr/local/curl –with-ssl
make && sudo make install

##### libmcrypt #####

tar -zxvf libmcrypt*.tar.gz
cd libmcrypt*
./configure –prefix=/usr/local/libmcrypt
make && sudo make install

##### mhash #####

tar -zxvf mhash*.tar.gz
cd mhash*
./configure –prefix=/usr/local/mhash
make && sudo make install

##### MySQL #####

tar -zxvf mysql*.tar.gz
sudo mv mysql*/ /usr/local/mysql
cd /usr/local/mysql
sudo groupadd mysql
sudo useradd -g mysql mysql
sudo scripts/mysql_install_db –user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo chgrp -R mysql .
sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
sudo support-files/mysql.server start
sudo bin/mysqladmin -u root password ‘mypassword’
sudo support-files/mysql.server stop
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
cd /etc/init.d
sudo update-rc.d mysql.server defaults

##### Apache #####

tar -zxvf httpd*.tar.gz
cd httpd*
./configure –prefix=/usr/local/apache –enable-so –with-mpm=worker –with-mysql=/usr/local/mysql –with-config-file-path=/usr/local/apache/conf –enable-module=rewrite –enable-vhost-alias –enable-http –enable-mime-magic –with-ssl=/usr/local/ssl –enable-ssl –enable-proxy–enable-track-vars –enable-deflate –enable-cache –enable-mem-cache –enable-disk-cache –enable-rewrite=shared –enable-status=shared –enable-file-cache –enable-cgi –enable-cgid –enable-track-vars –enable-expires=share
make && sudo make install
sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apache.server
cd /etc/init.d
sudo update-rc.d apache.server defaults

##### php #####

tar -zxvf php*.tar.gz
cd php*
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-config-file-path=/usr/local/apache/conf –enable-magic-quotes –with-openssl=/usr/local/ssl –with-zlib=/usr/local/zlib –with-zlib-dir=/usr/local/zlib –with-curl=/usr/local/curl –enable-ftp –with-openssl-dir=/usr/local/ssl –with-gd=/usr/local/gd –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype –enable-gd-native-ttf –enable-mbstring –with-mcrypt=/usr/local/libmcrypt –with-mhash=/usr/local/mhash –with-mysql=/usr/local/mysql –with-pdo-mysql=/usr/local/mysql –enable-soap –enable-sockets –enable-zip
make && sudo make install
sudo cp php.ini-dist /usr/local/apache/conf/php.ini

##### config #####
修改 php.ini 文件, 达到你自己的服务器要求. 修改后, 保存 OK
sudo vi /usr/local/apache/conf/httpd.conf
修改 apache 的配置文件. 让它支持 php
在 103 行默认安装PHP 后已经加入这一行:
LoadModule php5_module        modules/libphp5.so
没有多话自己加一下. 注意查看 apache 的 modlues 目录下是否有libphp5.so这个文件
在这行下面加入下面两行:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
然后在 216 行附近(因为前面加入了两行字. 大概就在这个位置.) 找到:
DirectoryIndex index.html 后面添加变成现在这样:
DirectoryIndex index.html index.htm index.php

分类
电脑技巧

UBUNTU下的LAMP配置

UBUNTU下的LAMP配置
安装系统

##### 安装编译环境 #####

sudo apt-get install build-essential

##### m4 #####

sudo dpkg –i m4*.deb

##### flex #####

sudo dpkg –i flex*.deb

##### zlib-devel #####

sudo apt-get install zlib1g-dev

##### libxml2 #####

sudo apt-get install libxml2 libxml2-dev

##### MySQL #####

tar -zxvf mysql*.tar.gz
sudo mv mysql*/ /usr/local/mysql
cd /usr/local/mysql
sudo groupadd mysql
sudo useradd -g mysql mysql
sudo scripts/mysql_install_db –user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo chgrp -R mysql .
sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
sudo support-files/mysql.server start
sudo bin/mysqladmin -u root password ‘mypassword’
sudo support-files/mysql.server stop
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
cd /etc/init.d
sudo update-rc.d mysql.server defaults

##### Apache #####

tar -zxvf httpd*.tar.gz
cd httpd*
./configure –prefix=/usr/local/apache –enable-mods-shared=all –enable-rewrite=shared –enable-so
make && sudo make install

##### zlib #####

tar -zxvf zlib*.tar.gz
cd zlib*
./configure –prefix=/usr/local/zlib
make && sudo make install

##### OpenSSL #####

tar -zxvf openssl*.tar.gz
cd openssl*
./config –prefix=/usr/local/ssl -openssldir=/usr/local/ssl –shared zlib
make && sudo make install

##### FreeType #####

tar -zxvf freetype*.tar.gz
cd freetype*
./configure –prefix=/usr/local/freetype
make && sudo make install

##### Jpeg #####

tar -zxvf jpeg*.tar.gz
cd jpeg*
sudo mkdir /usr/local/jpeg
sudo mkdir /usr/local/jpeg/bin
sudo mkdir /usr/local/jpeg/lib
sudo mkdir /usr/local/jpeg/include
sudo mkdir /usr/local/jpeg/man
sudo mkdir /usr/local/jpeg/man/man1
./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
make && sudo make install

##### LibPNG #####

tar -zxvf libpng*.tar.gz
cd libpng*
./configure –prefix=/usr/local/libpng
make && sudo make install

##### GD Library #####

tar -zxvf gd*.tar.gz
cd gd*
./configure –prefix=/usr/local/gd –with-jpeg=/usr/local/jpeg –with-freetype=/usr/local/freetype –with-png –with-zlib=/usr/local/zlib
make && sudo make install

##### curl #####

tar -zxvf curl*.tar.gz
cd curl*
sudo mkdir -p /usr/local/curl
./configure –prefix=/usr/local/curl –with-ssl
make && sudo make install

##### libmcrypt #####

tar -zxvf libmcrypt*.tar.gz
cd libmcrypt*
./configure –prefix=/usr/local/libmcrypt
make && sudo make install

##### mhash #####

tar -zxvf mhash*.tar.gz
cd mhash*
./configure –prefix=/usr/local/mhash
make && sudo make install

##### php #####

tar -zxvf php*.tar.gz
cd php*
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-config-file-path=/usr/local/apache/conf –enable-magic-quotes –with-openssl=/usr/local/ssl –with-zlib=/usr/local/zlib –with-zlib-dir=/usr/local/zlib –with-curl=/usr/local/curl –enable-ftp –with-openssl-dir=/usr/local/ssl –with-gd=/usr/local/gd –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype –enable-gd-native-ttf –enable-mbstring –with-mcrypt=/usr/local/libmcrypt –with-mhash=/usr/local/mhash –with-mysql=/usr/local/mysql –with-pdo-mysql=/usr/local/mysql –enable-soap –enable-sockets –enable-zip
make && sudo make install