lamp編譯部署
lamp.zip 準備工作 yum groupinstall “Development Tools” -y mkdir -pv /usr/local/src/lamp tar -xvf lamp.tar -C /usr/local/src/lamp/ cd /usr/local/src/lamp/ 一、安裝apr tar fvxj apr-1.4.6.tar.bz2 cd apr-1.4.6/ ./configure --prefix=/usr/local/apr make && make install 二、安裝apr-util tar fvxj apr-util-1.5.1.tar.bz2 cd apr-util-1.5.1/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ make && make install 三、安裝Apache 停掉Apache服務:service httpd stop yum install zlib-devel openssl-devel pcre-devel -y tar fvxz httpd-2.4.3.tar.gz cd httpd-2.4.3/ ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-ab --disable-userdir --with-mpm=prefork --enable-nonportable-atomics --disable-ipv6 --with-sendfile make && make install /usr/local/apache2/bin/apachectl -k restart //開始Apache服務 ps -aux | grep apache //檢視Apache執行 killall httpd //關閉Apache服務 四、安裝Mysql rpm -ivh cmake-2.6.4-7.el5.i386.rpm groupadd mysql //新增組 useradd -g mysql mysql //新增使用者 yum remove mysql-server mysql mysql-devel -y //解除安裝之前版本 yum install ncurses-devel -y mkdir -pv /usr/local/mysql/data //遞迴顯示建立目錄 tar fvxz mysql-5.5.29.tar.gz cd mysql-5.5.29 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_INNODBBASE_STORAGE_ENGINE=1 -DENABLE_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DWITH_EMBEDED_SERVER=0 make && make install cd /usr/local/mysql cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf vim /etc/my.cnf [mysqld] //此位置下添入下行 skip-name-resolve = 1 cp support-files/mysql.server /etc/init.d/mysqlsource chmod 755 /etc/init.d/mysqlsource chown -R mysql.mysql /usr/local/mysql/ sh scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ //初始化資料庫,並指定庫路徑和資料路徑 做軟連線 ln -s /usr/local/mysql/bin/* /usr/bin/ ln -s /usr/local/mysql/lib/* /usr/lib/ ln -s /usr/local/mysql/libexec/* /usr/local/libexec/ ln -s /usr/local/mysql/share/man/man1/* /usr/share/man/man1/ ln -s /usr/local/mysql/share/man/man8/* /usr/share/man/man8/ 五、安裝相關軟體包 tar fvxz libiconv-1.14.tar.gz cd libiconv-1.14/ ./configure --prefix=/usr/local/ --with-apr=/usr/local/apr make && make install tar fvxz libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8/ ./configure && make && make install cd libltdl/ ./configure --enable-ltdl-install && make && make install tar fvxz mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9/ ./configure && make && make install ln -s /usr/local/lib/* /usr/lib/ ln -s /usr/local/bin/libmcrypt-config /usr/bin/ tar fvxz mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ ./configure && make && make install 六、安裝配置PHP yum install libxml2-devel libpng-devel bzip2-devel curl-devel libjpeg-devel freetype-develnet-snmp-devel -y tar fvxj php-5.4.11.tar.bz2 cd php-5.4.11/ ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdomysql=/usr/local/mysql --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=apache --with-fpm-group=apache --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --disable-phar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --with-snmp --disable-ipv6 --disable-rpath --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs make ZEND_EXTRA_LIBS=’-liconv’ make install cp php.ini-production /usr/local/php/etc/php.ini vim /usr/local/apache2/conf/httpd.conf /AddType //搜尋關鍵字 AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php //新增行 /IfModule dir_module //搜尋關鍵字 DirectoryIndex index.php //修改行 vim /usr/local/php/etc/php.ini short_open_tag = On //修改行 cd /usr/local/apache2/htdocs/ rm -f index.html vim index.php Hello World 七、檢視Apache服務,並重新啟動 ps -aux | grep httpd killall httpd /usr/local/apache2/bin/apachectl -k restart 八、論壇檔案的修改 uzip emlog_5.3.1.zip mv emlog_5.3.1/emlog/src/* /usr/local/apache2/htdocs/ //移動論壇檔案 cd /usr/local/apache2/htdocs chmod -R 777 * //修改目錄下所有檔案的許可權 mysql create database emlog; Quit 九、啟動Apache && Mysql服務 && 訪問配置 /usr/local/apache2/bin/apachectl -k restart //啟動Apache服務 /etc/init.d/mysqlsource start //啟動Mysql 服務