================================Start 利用CentOS Linux系统自带的yum命令安装、升级所需的程序库 Start================================
国内两个网站开通了开源软件的镜像站点,网址:
http://blog.s135.com/soft/linux/centos/5.2/CentOS-Base.repo
http://mirrors.163.com/
这里有下载好的yum源(14G),现在是放在wamp环境下,建立虚拟目录。
NameVirtualHost *:80
Alias /vivo/ "F:/Backup/CentosSetup"
<Directory "F:/Backup/CentosSetup">
Options Indexes
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot F:/Backup/CentosSetup
ServerPath F:/Backup/CentosSetup
ServerAlias mirror.vivo.com
ServerName mirror.vivo.com
</VirtualHost>
更新升级源
cd /etc/yum.repos.d/
更改 CentOS-Base.repo中的baseurl路径
baseurl=http://mirror.vivo.com/centos/$releasever/os/$basearch/
已经有改好的CentOS-Base.repo文件了
mv CentOS-Base.repo CentOS-Base.repo.bak
vi /etc/hosts
添加:192.168.1.100 mirror.vivo.com
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
================================End 利用CentOS Linux系统自带的yum命令安装、升级所需的程序库 End================================
================================Start 配置和安装 Start================================
cd /
mkdir lamp
#Apache2 Mysql wwwroot数据存放位置
cd lamp
mkdir setup
cd setup
#将LANMP包中的安装文件拷贝到 /lamp/setup下
================================End 配置和安装 End================================
================================Start 编译安装MySQL 5.1.55 Start================================
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar -zxvf mysql-5.1.55.tar.gz
cd mysql-5.1.55
./configure --prefix=/lamp/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
make
make install
chmod +w /lamp/mysql
chown -R mysql:mysql /lamp/mysql
cd ../
+------------------------------------+
1.创建MySQL数据库存放位置
+------------------------------------+
mkdir -p /lamp/mysql/3306/data
chown -R mysql:mysql /lamp/mysql/3306/data
+------------------------------------+
2.以MySQL用户帐号的身份建立数据表
+------------------------------------+
/lamp/mysql/bin/mysql_install_db --basedir=/lamp/mysql --datadir=/lamp/mysql/3306/data --user=mysql
+------------------------------------+
3.创建my.cnf配置文件
+------------------------------------+
vi /lamp/mysql/3306/my.cnf
my.cnf输入以下内容:
[client]
default-character-set = utf8
port = 3306
socket = /tmp/mysql.sock
[mysql]
prompt="(\u:blog.s135.com:)[\d]> "
no-auto-rehash
[mysqld]
default-character-set = utf8
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /lamp/mysql
datadir = /lamp/mysql/3306/data
open_files_limit = 10240
back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 300
thread_concurrency = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
default_table_type = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 1
log_long_format
log-bin = /lamp/mysql/3306/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
skip-name-resolve
master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
server-id = 1
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2048M
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[mysqldump]
quick
max_allowed_packet = 32M
+------------------------------------+
4.创建管理MySQL数据库的shell脚本
+------------------------------------+
vi /lamp/mysql/3306/mysql
输入以下内容(这里的用户名admin和密码123456接下来的步骤会创建):
#!/bin/sh
mysql_port=3306
mysql_username="admin"
mysql_password="123456"
function_start_mysql()
{
printf "Starting MySQL...\n"
/bin/sh /lamp/mysql/bin/mysqld_safe --defaults-file=/lamp/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null &
}
function_stop_mysql()
{
printf "Stoping MySQL...\n"
/lamp/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
}
function_restart_mysql()
{
printf "Restarting MySQL...\n"
function_stop_mysql
sleep 5
function_start_mysql
}
function_kill_mysql()
{
kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')
kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{printf $2}')
}
if [ "$1" = "start" ]; then
function_start_mysql
elif [ "$1" = "stop" ]; then
function_stop_mysql
elif [ "$1" = "restart" ]; then
function_restart_mysql
elif [ "$1" = "kill" ]; then
function_kill_mysql
else
printf "Usage: /lamp/mysql/${mysql_port}/mysql {start|stop|restart|kill}\n"
fi
+------------------------------------+
5.赋予shell脚本可执行权限
+------------------------------------+
chmod +x /lamp/mysql/3306/mysql
+------------------------------------+
6.启动MySQL
+------------------------------------+
/lamp/mysql/3306/mysql start
+------------------------------------+
7.通过命令行登录管理MySQL服务器(提示输入密码时直接回车)
+------------------------------------+
/lamp/mysql/bin/mysql -uroot -p -S /tmp/mysql.sock
默认密码:无
+------------------------------------+
8.创建一个具有root权限的用户(admin)和密码(123456)
+------------------------------------+
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '123456';
+------------------------------------+
9.停止MySQL
+------------------------------------+
/lamp/mysql/3306/mysql stop
================================End 编译安装MySQL 5.1.55 End================================
================================Start 安装Apache2 Start================================
+------------------------------------+
1.安装Apache2
+------------------------------------+
cd /lamp/setup
tar -zxvf httpd-2.2.15.tar.gz
cd httpd-2.2.15/
./configure --prefix=/lamp/apache2 --sysconfdir=/lamp/apache2/etc --enable-ssl --enable-modules --enable-mods-shared=most --enable-rewrite
make
make install
================================End 安装Apache2 End================================
================================Start 编译安装PHP Start================================
+------------------------------------+
1.编译安装PHP 5.2.10所需的支持库
+------------------------------------+
tar -zxvf libiconv-1.13.tar.gz
cd libiconv-1.13
./configure --prefix=/usr/local
make
make install
cd ../
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
#ldconfig是一个动态链接库管理命令,为了让动态链接库为系统所共享
tar -zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9
./configure
make
make install
cd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig
./configure
make
make install
+------------------------------------+
2.安装PHP5
+------------------------------------+
cd /lamp/setup
tar -zxvf php-5.2.10.tar.gz
cd php-5.2.10/
./configure --prefix=/lamp/php --with-config-file-path=/lamp/php/etc --with-apxs2=/lamp/apache2/bin/apxs --with-iconv=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --without-pear --without-sqlite --without-pdo-sqlite --with-mysql=/lamp/mysql/ --with-mysqli=/lamp/mysql/bin/mysql_config
make
make install
如果没有自动创建/lamp/php/etc文件,手动创建:mkdir /lamp/php/etc
cp php.ini-dist /lamp/php/etc/php.ini
+------------------------------------+
3.编辑httpd.conf
+------------------------------------+
vi /lamp/apache2/etc/httpd.conf
在<IfModule mime_module></IfModule>中加上:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
+------------------------------------+
4.编译安装PHP5扩展模块
+------------------------------------+
cd /lamp/setup
tar -jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
/lamp/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/lamp/php/bin/php-config
make
make install
cd ../
tar -zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/lamp/php/bin/phpize
./configure --with-php-config=/lamp/php/bin/php-config --with-pdo-mysql=/lamp/mysql
make
make install
cd ../
1).开源的图像处理软件
tar -zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2
./configure
make
make install
cd ../
2).imagick 的安装建立在ImageMagick基础上
tar -zxvf imagick-2.2.2.tgz
cd imagick-2.2.2
/lamp/php/bin/phpize
./configure --with-php-config=/lamp/php/bin/php-config
make
make install
cd ../
+------------------------------------+
5.编译php.ini
+------------------------------------+
vi /lamp/php/etc/php.ini
extension_dir = "./" 改为
extension_dir = "/lamp/php/lib/php/extensions/no-debug-non-zts-20060613/"
添加 extension="pdo_mysql.so"
+------------------------------------+
6.安装ZendOptimizer
+------------------------------------+
cd /lamp/setup
tar -zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
mkdir /lamp/php/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer
mv /lamp/setup/ZendOptimizer-3.3.9-linux-glibc23-i386/* /lamp/php/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer
cp /lamp/php/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer/data/5_1_x_comp/ZendOptimizer.so /lamp/php/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer
vi /lamp/php/etc/php.ini 最后添加
zend_optimizer.optimization_level=15
extension="ZendOptimizer/ZendOptimizer.so"
+------------------------------------+
7.重启Apache2
+------------------------------------+
/lamp/apache2/bin/apachectl restart
如果出现错误,可以关闭 SELinux
vi /etc/sysconfig/selinux
SELINUX=enforcing
改为:
#SELINUX=enforcing
SELINUX=disabled
然后:
setenforce 0
/lamp/apache2/bin/apachectl restart
+------------------------------------+
8.添加开机启动
+------------------------------------+
vi /etc/rc.local
rc.local中添加:
/lamp/mysql/3306/mysql start
/lamp/apache2/bin/apachectl start
================================End 编译安装PHP End================================
LAMP安装步骤
原创
©著作权归作者所有:来自51CTO博客作者iphper的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:LNMP安装步骤
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
OGG 监控AGENT 安装步骤
OGG OEM监控添加
oracle ogg 监控 -
LAMP中mysql的安装步骤
Linux中LAMP中的mysql安装
mysql 文件 数据库 -
LAMP环境配置安装注意安装步骤及说明事项
LAMP环境配置安装注意安装步骤及说明事项。附件:1. 访问ftp报错 解决:关闭s
LAMP PHP Apache MySQL Linux -
安装LAMP
使用RPM和源码部署LAMP
安装 LAMP