LAMP快速安裝
成都創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、安徽網(wǎng)絡(luò)推廣、微信小程序、安徽網(wǎng)絡(luò)營(yíng)銷、安徽企業(yè)策劃、安徽品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供安徽建站搭建服務(wù),24小時(shí)服務(wù)熱線:18982081108,官方網(wǎng)址:www.cdcxhl.com
1.版本介紹
linux:CentOS release 6.6 (Final)
apache: httpd-2.2.31
MySQL:mysql-5.5.48
php:php-5.3.27
2.apache安裝
yum install -y zlib zlib-devel openssl-devel mkdir /server/tools -p cd /server/tools/ wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz tar zxvf httpd-2.2.31.tar.gz cd httpd-2.2.31 ./configure \ --prefix=/application/apache2.2.31 \ --enable-deflate \ --enable-expires \ --enable-headers \ --enable-modules=most \ --enable-so \ --with-mem=worker \ --enable-rewrite make make install ln -s /application/apache2.2.31/ /application/apache sed -i 's@#ServerName www.example.com:80@ServerName 127.0.0.1:80@g' /application/apache/conf/httpd.conf /application/apache/bin/apachectl -t /application/apache/bin/apachectl start netstat -lntup|grep 80 lsof -i :80 ps -ef|grep httpd
3.安裝mysql-5.5.48
安裝依賴
yum install ncurses-devel libaio-devel -y cd /server/tools/ wget https://cmake.org/files/v2.8/cmake-2.8.8.tar.gz tar zxf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure gmake gmake install
安裝mysql
useradd mysql -s /sbin/nologin -M cd /server/tools/ wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.48.tar.gz tar zxvf mysql-5.5.48.tar.gz cd mysql-5.5.48 cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.48 \ -DMYSQL_DATADIR=/application/mysql-5.5.48/data \ -DMYSQL_UNIX_ADDR=/application/mysql-5.5.48/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITHOUT_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FAST_MUTEXES=1 \ -DWITH_ZLIB=bundled \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_READLINE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DWITH_DEBUG=0 make && make install ln -s /application/mysql-5.5.48/ /application/mysql
初始化數(shù)據(jù)庫(kù)
cd /server/tools/mysql-5.5.48/support-files/ /bin/cp my-small.cnf /etc/my.cnf chown -R mysql.mysql /application/mysql /application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql cd /server/tools/mysql-5.5.48/support-files/ cp mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on /application/mysql/bin/mysqld_safe & sleep 1 echo 'export PATH="$PATH:/application/mysql/bin/"'>> /etc/profile source /etc/profile mysqladmin -u root password '123456'
4.安裝PHP php-5.3.27
安裝依賴
yum install zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel -y yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel openssl-devel -y cd /server/tools/ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install cd wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo ls /etc/yum.repos.d/ yum install -y libmcrypt-devel yum install mhash mhash-devel mcrypt -y
安裝php-5.3.27
cd /server/tools/ wget http://cn2.php.net/distributions/php-5.3.27.tar.gz tar zxvf php-5.3.27.tar.gz cd php-5.3.27 ./configure \ --prefix=/application/php5.3.27 \ --with-apxs2=/application/apache/bin/apxs \ --with-mysql=/application/mysql \ --with-xmlrpc \ --with-openssl \ --with-zlib \ --with-mcrypt \ --with-mhash \ --with-mcrypt \ --with-mhash \ --with-freetype-dir \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-iconv-dir=/usr/local/libiconv \ --enable-short-tags \ --enable-sockets \ --enable-zend-multibyte \ --enable-soap \ --enable-mbstring \ --enable-static \ --enable-gd-native-ttf \ --with-curl \ --with-xsl \ --enable-ftp \ --with-libxml-dir make make install ln -s /application/php5.3.27 /application/php cp php.ini-production /application/php/lib/php.ini
5.LAMP整合
n 安裝完php后查看Apache配置文件,發(fā)現(xiàn)Apache已加載php模塊
[root@liwenbin etc]# grep libphp5 /application/apache/conf/httpd.conf LoadModule php5_module modules/libphp5.so
n 添加對(duì)php解析的支持內(nèi)容
vi /application/apache/conf/httpd.conf +310 AddType application/x-httpd-php .php .html AddType application/x-httpd-php-source .phps
n 修改Apache的運(yùn)行用戶
useradd -s /sbin/nologin -M apache vi /application/apache/conf/httpd.conf +67 User apache Group apache
n 修改首頁(yè)文件
DirectoryIndex index.php index.html
6.LAMP整合測(cè)試
n apache與php整合測(cè)試
vi /application/apache/html/blog/phpinfo.php
n Apache、mysql與php整合測(cè)試
vi /application/apache/html/blog/test_mysql.php