Centos6.5 下安裝配置Apache+PHP+Mysql環境

來源:互聯網
上載者:User

標籤:

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 = 3306socket = /usr/local/mysql/mysql.sock[mysqld]character-set-server = utf8collation-server = utf8_general_ciskip-external-lockingskip-name-resolveuser = mysqlport = 3306basedir = /usr/local/mysqldatadir = /usr/local/mysql/datatmpdir = /usr/local/mysql/tmpsocket = /usr/local/mysql/mysql.socklog-error = /usr/local/mysql/logs/mysql_error.logpid-file = /usr/local/mysql/mysql.pidopen_files_limit = 10240back_log = 600max_connections=500max_connect_errors = 6000wait_timeout=605800#open_tables = 600#table_cache = 650#opened_tables = 630max_allowed_packet = 32Msort_buffer_size = 4Mjoin_buffer_size = 4Mthread_cache_size = 300query_cache_type = 1query_cache_size = 256Mquery_cache_limit = 2Mquery_cache_min_res_unit = 16ktmp_table_size = 256Mmax_heap_table_size = 256Mkey_buffer_size = 256Mread_buffer_size = 1Mread_rnd_buffer_size = 16Mbulk_insert_buffer_size = 64Mlower_case_table_names=1default-storage-engine = INNODBinnodb_buffer_pool_size = 2Ginnodb_log_buffer_size = 32Minnodb_log_file_size = 128Minnodb_flush_method = O_DIRECT#####################thread_concurrency = 32long_query_time= 2slow-query-log = onslow-query-log-file = /usr/local/mysql/logs/mysql-slow.log[mysqldump]quickmax_allowed_packet = 32M[mysqld_safe]log-error=/var/log/mysqld.logpid-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環境

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.