lamp mysql5.5 LAMP平台全新编译安装
生活随笔
收集整理的這篇文章主要介紹了
lamp mysql5.5 LAMP平台全新编译安装
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?
?LAMP編譯安裝全過程??? PHP 下載 : http://www.php.net/downloads.php/ HTTPD下載: http://httpd.apache.org/download.cgi MYSQL下載:http://www.mysql.com/downloads/ Centos下載 : http://mirrors.163.com/centos 先安裝常用的依賴包: 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 一、編譯安裝apache (這里用的是2.4.1版本): [root@svnshangde home]# tar zxvf httpd-2.4.1.tar.gz -C /usr/src/ [root@svnshangde home]# cd /usr/src/httpd-2.4.1/ [root@svnshangdehttpd-2.4.1]#./configure--prefix=/usr/local/apache--enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/lib --enable-auth-digest --enable-cgi --enable-suexec --with-suexec-caller=daemon--with-suexec-docroot=/usr/local/apache/htdocs ? 1、報如下錯誤: Configuring Apache Portable Runtime library ... checking for APR... no configure: error: APR not found.?Please read the documentation. yum –y install?apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs (解決如上錯誤!) 2、又報錯: configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ yum –y install ?pcre pcre-devel (解決如上問題) 3、再次報錯: checking for APR version 1.3.0 or later... no configure: error: APR version 1.3.0 or later is required ?(apr-util 版本太低) yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs (刪除之前安裝的東東) 4、下載:(apr-1.4.5.tar.gz apr-util-1.3.12.tar.gz ) [root@yahoo home]# tar -zxf apr-1.4.5.tar.gz [root@yahoo apr-1.4.5]# ./configure --prefix=/usr/local/apr [root@yahoo apr-1.4.5]# make [root@yahoo apr-1.4.5]# make install [root@yahoo home]# tar -zxf apr-util-1.3.12.tar.gz [root@yahoo apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config [root@yahoo apr-util-1.3.12]# make[root@yahoo apr-util-1.3.12]# make install 5、再次安裝OK: [root@svnshangde apr-util-1.3.12]# cd /usr/src/httpd-2.4.1 [root@svnshangdehttpd-2.4.1]#./configure--prefix=/usr/local/apache--enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/lib --enable-auth-digest --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache/htdocs--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ (加上apr apr-util 的路徑) [root@svnshangdehttpd-2.4.1]# make && make install [root@svnshangde httpd-2.4.1]# vi /usr/local/apache/conf/httpd.conf ServerName localhost (不修改也行默認是#注釋的) [root@svnshangde httpd-2.4.1]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd? [root@svnshangde httpd-2.4.1]# vi /etc/init.d/httpd #!/bin/sh # chkconfig: 35 85 15 # description: zhi shi apache server! (加上chkconfig支持和注釋) [root@svnshangde httpd-2.4.1]# chkconfig --add httpd(添加chk 服務支持) [root@svnshangde httpd-2.4.1]# chkconfig httpd on?(開機將會運行無需再手動啟動) [root@svnshangde httpd-2.4.1]# service httpd start http://localhost IP/ (驗證) It works! 6、http壓力測試:系統(tǒng)自帶的ab 工具: 格式:ab [-q] –c 并發(fā)數(shù) –n 總請求書數(shù) [http://] 域名 [:端口]/路徑 修改最大請求數(shù): [root@svnshangde bin]# ulimit -a | grep "open files"?(查看、默認為1024) open files(-n) 1024 [root@svnshangde bin]# ulimit -n 10000?(修改為1萬) [root@svnshangde bin]# /usr/local/apache/bin/ab -q -c 2000 -n 6000 http://localhost/ 二、編譯配置mysql(這里是5.5版本): 1、安裝bison和cmake
提示:MySQL 5.5 版本的安裝需要這兩個軟件,bison我們可以用方便的yum直接安裝好,cmake則用編譯安裝的辦法。 [root@svnshangde home]# yum -y install bison [root@svnshangde home]# wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
[root@svnshangde home]# ?tar zxvf cmake-2.8.4.tar.gz -C /usr/src/
[root@svnshangde home]# cd /usr/src/cmake-2.8.4/
[root@svnshangde cmake-2.8.4]# ./configure –prefix=/usr/local/cmake
[root@svnshangde cmake-2.8.4]# gmake
[root@svnshangde cmake-2.8.4]# gmake install (CP cmake 到 /usr/bin 下) [root@svnshangde mysql-5.5.15]# cp /usr/local/bin/cmake /usr/bin 2、解壓安裝mysql: [root@svnshangde home]# tar zxvf mysql-5.5.15.tar.gz -C /usr/src/ [root@svnshangde bin]# cd /usr/src/mysql-5.5.15 3、(創(chuàng)建用戶) [root@svnshangde mysql-5.5.15]# useradd -M -s /sbin/nologin mysql 4、(在根目錄下創(chuàng)建mysql庫) [root@svnshangde mysql-5.5.15]# mkdir /data/mysql/? [root@svnshangde mysql-5.5.15]# chown -R mysql:mysql /data/mysql [root@svnshangde mysql-5.5.15]# chown –R root:mysql /usr/local/mysql 5、(編譯) [root@svnshangde mysql-5.5.15]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc/ 6、(安裝) [root@svnshangde mysql-5.5.15]# make && make install?????????? 7、(復制配置文件模板為配置文件) [root@svnshangde mysql-5.5.15]# cp support-files/my-medium.cnf /etc/my.cnf cp: overwrite `/etc/my.cnf'? y 8、(編輯my.cnf) [root@svnshangde mysql]# vi /etc/my.cnf? 9、(在 [mysqld] 段增加)
datadir = /data/mysql
wait-timeout = 30
max_connections = 512
max_connect_errors = 10000000
default-storage-engine = MyISAM
10、在 [mysqld] 段修改 max_allowed_packet = 16M 11、(啟動文件CP到service啟動支持) [root@svnshangde mysql-5.5.15]# cp support-files/mysql.server /etc/init.d/mysqld cp: overwrite `/etc/init.d/mysqld'? y 12、(編輯mysqld) [root@svnshangde mysql-5.5.15] vi /etc/init.d/mysqld 把basedir=編輯成basedir=/usr/local/mysql 把datadir=編輯成datadir=/data/mysql [root@svnshangde mysql-5.5.15]# chmod a+x /etc/init.d/mysqld [root@svnshangde mysql-5.5.15]# chkconfig --add mysqld [root@svnshangde mysql-5.5.15]# chkconfig --level 3 mysqld on [root@svnshangde mysql-5.5.15]# cd /usr/local/mysql/ [root@svnshangde mysql]# ./scripts/mysql_install_db --user=mysql [root@svnshangde ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql & [root@svnshangde mysql]# service mysqld start Starting MySQL[?OK?] 13、(寫入變量方便命令實用) [root@svnshangde ~]# export PATH=$PATH:/usr/local/mysql/bin/ [root@svnshangde ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile 14、(設置root密碼) [root@svnshangde ~]# mysqladmin -uroot password "123456" 15、(創(chuàng)建mysql用戶) mysql> ?GRANT ALL PRIVILEGES ON *.* TO yhby@'%' IDENTIFIED BY "123456"; Query OK, 0 rows affected (0.07 sec) 三、編譯安裝PHP(這里是5.4版本的): ? [root@svnshangde home]# tar zxvf php-5.4.0.tar.gz -C /usr/src/ [root@svnshangde php-5.4.0]# cd /usr/src/php-5.4.0/ 1、開始編譯: [root@svnshangde php-5.4.0]# ./configure --prefix=/usr/local/php --enable-mbstring --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php [root@svnshangde php-5.4.0]# make && make install [root@svnshangde php-5.4.0]# cp php.ini-production /usr/local/php/php.ini [root@svnshangde php-5.4.0]# vi /usr/local/apache/conf/httpd.conf LoadModule php5_modulemodules/libphp5.so (必須有 木有的話從新編譯PHP) 1-2、添加: AddType application/x-httpd-php .php DirectoryIndex index.html index.php 2、建立測試頁: [root@svnshangde php-5.4.0]# vi /usr/local/apache/htdocs/xxoo.php <?php phpinfo(); ?> 3、測試: http://localhost /xxoo.php 看到后ok
轉載于:https://blog.51cto.com/s2t148/799360
總結
以上是生活随笔為你收集整理的lamp mysql5.5 LAMP平台全新编译安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Eclipse c++ 中[Linker
- 下一篇: 网站页首可关闭广告条