码迷,mamicode.com
首页 > 数据库 > 详细

Centos6.5 下安装配置Apache+PHP+Mysql环境

时间:2016-08-27 23:31:48      阅读:304      评论:0      收藏:0      [点我收藏+]

标签:

1.准备工作

# yum -y update && yum -y install vim make cmake gcc gcc-c++ bison bison-devel ncurses ncurses-devel autoconf automake wget unzip lrzsz zlib libgcrypt* libtool*

  

2.安装apache2.2

# wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.31.tar.gz
# tar zxf httpd-2.2.31.tar.gz
# cd httpd-2.2.31
# ./configure --prefix=/usr/local/apache2.2 --enable-modules=all --enable-mods-shared=all --enable-so
# make && make install

  

3.php依赖软件安装(省略了tar zxf , cd 命令)

3.1 安装 libxml2  

# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gz
# ./configure --prefix=/usr/local/libxml2 && make && make install 

  

      3.2 安装 libjpeg 

# wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static && make && make install

 

 3.3 安装 libpng

# wget http://ncu.dl.sourceforge.net/project/libpng/libpng14/older-releases/1.4.3/libpng-1.4.3.tar.gz
# ./configure&& make && make install

 

 3.4 安装 freetype

# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
# ./configure --prefix=/usr/local/freetype && make && make install

  

   3.5 安装 libgd

# wget https://github.com/libgd/libgd/archive/GD_2_0_33.tar.gz
# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-png=/usr/local --with-zlib --with-freetype=/usr/local/freetype && make && make install

  

4.安装php

# wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
# ./configure --prefix=/usr/local/php5328 --with-config-file-path=/usr/local/php5328/lib/php.ini --with-apxs2=/usr/local/apache2.2/bin/apxs --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd --with-zlib --with-libxml-dir=/usr/local/libxml2 --with-jpeg-dir=/usr/local/jpeg --with-png-dir --enable-mbstring=all --enable-mbregex --enable-shared

# make && make install
# cp php.ini-development /usr/local/php5328/lib/php.ini
# vim /usr/local/apache2.2/conf/httpd.conf
  1.在最后一个LoadModule下添加 AddType application/x-httpd-php .php .phtml
  
  2.找到
  <IfModule dir_module>
	DirectoryIndex index.html
  </IfModule>
  在index.html 后面添加 index.php

  

5.通过编译源码的方式安装mysql 

# groupadd mysql
# useradd -r -g mysql mysql
# mkdir -p /usr/local/mysql /usr/local/mysql/data /usr/local/mysql/logs /usr/local/mysql/tmp
# rm -f /etc/my.cnf
# vim /etc/profile
  添加2行
  PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
  export PATH

# source /etc/profile
# wget http://downloads.mysql.com/archives/get/file/mysql-5.6.16.tar.gz
# tar zxf mysql-5.6.16.tar.gz
# cd mysql-5.6.16
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 -DSYSCONFDIR=/etc

# make && make install 
# chown -Rf mysql:mysql /usr/local/mysql
# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# rm -f my.cnf

 

编辑/etc/my.cnf

# vim /etc/my.cnf

[client]
port = 3306
socket = /usr/local/mysql/mysql.sock

[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
skip-external-locking
skip-name-resolve
user = mysql
port = 3306
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
tmpdir = /usr/local/mysql/tmp
socket = /usr/local/mysql/mysql.sock
log-error = /usr/local/mysql/logs/mysql_error.log
pid-file = /usr/local/mysql/mysql.pid
open_files_limit = 10240
back_log = 600
max_connections=500
max_connect_errors = 6000
wait_timeout=605800
#open_tables = 600
#table_cache = 650
#opened_tables = 630
max_allowed_packet = 32M
sort_buffer_size = 4M
join_buffer_size = 4M
thread_cache_size = 300
query_cache_type = 1
query_cache_size = 256M
query_cache_limit = 2M
query_cache_min_res_unit = 16k
tmp_table_size = 256M
max_heap_table_size = 256M
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
lower_case_table_names=1
default-storage-engine = INNODB
innodb_buffer_pool_size = 2G
innodb_log_buffer_size = 32M
innodb_log_file_size = 128M
innodb_flush_method = O_DIRECT
#####################
thread_concurrency = 32
long_query_time= 2
slow-query-log = on
slow-query-log-file = /usr/local/mysql/logs/mysql-slow.log
[mysqldump]
quick
max_allowed_packet = 32M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

配置mysql

# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
# service mysql start 
# chkconfig mysql on
# /usr/local/mysql/bin/mysql_secure_installation
将root用户密码修改为root

# mysql -uroot -proot
  >use mysql;
  >GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;
  >flush privileges;
  >exit;

  

  

 

Centos6.5 下安装配置Apache+PHP+Mysql环境

标签:

原文地址:http://www.cnblogs.com/mataszhang/p/5814035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!