LAMP
2024-06-28 16:02:00
供稿:网友
准备工作:yun isntall -y gcc gcc-c++ cmake bison python-devel ncurses-devel Apache的安装1.cp -r /lamp/aPR-1.4.6 /lamp/httpd-2.4.7/srclib/apr cp -r /lamp/apr--util-1.4.6 /lamp/httpd-2.4.7/srclib/apr-util2.cd pcre-8.34 ./configure && make && make install3.cd httpd-2.4.7 ./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc/ --with-include-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared make make install4.(7) 把httpd添加到系统服务中a) cp /usr/local/Apache2/bin/apachectl /etc/init.d/b) mv /etc/init.d/apachectl /etc/init.d/httpdc) vim /etc/init.d/httpd 在第一行#!/bin/sh下增加两行文字:1. # chkconfig: 35 70 302. # description: Apached) chkconfig --add httpde) chkconfig --level 35 httpd onf) vim /etc/profilei. export PAHT="/usr/local/apache/bin:$PATH"g) source /etc/profileh) service httpd start(8) 报错AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this messageapache 启动出现这种错误的解决方法:将 apache 的配置文件httpd.conf中的 ServerName 改成可用域名或如下配置ServerName localhost:80MySQL的安装1.安装ncurses的安装cd /lamp/ncurses-5.9./configure -with-shared --without-debug --without-ada --enable-overwritemake && make install 2.mysql的安装添加用户和用户组:groupadd mysql useradd -r -g mysql mysqlcmake预编译: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_USER=mysql -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1make && make install初始化数据库:cd /usr/local/mysql && scrpts/mysql_install_db --user=mysql修改权限:chown -Rf mysql:mysql /usr/local/mysql将mysql添加到系统服务中,开机启动:cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql && chkconfig --add mysql && chkconfig --level 2345 mysqld on添加PATH:vim /etc/profile 在文件最后添加export PATH="/usr/local/mysql/bin:$PATH" source /etc/profilemysql的启动:service mysql start修改密码:/usr/local/mysql/bin/mysqladmin -u root passWord root php的安装libxml2的安装:./configure --prefix=/usr/local/libxml2 && make && make installlibmcrypt的安装./configure --prefix=/usr/local/libmcrypt/ && make && make installlibltdl的安装./configure --enable-ltdl-install && make && make installmhash的安装./configure && make && make installmcrypt的安装LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib ./configure --with-libmcrypt-prefix=/usr/local/libmcrypt && make && make installzlib的安装./configure && make && make installlibpng的安装./configure --prefix=/usr/local/libpng && make && make installjpeg的安装mkdir -p /usr/local/jpeg7/bin/ /usr/local/jpeg7/lib/ /usr/local/jpeg7/include/ /usr/local/jpeg7/man/man1/ && ./configure --prefix=/usr/local/jpeg7/ --enable-shared --enable-static && make && make install freetype的安装./configure --prefix=/usr/local/freetype/ && make && make install gd的安装./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg7/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/ && make && make installphp的安装:./configure --prefix=/usr/local/php --with-config-file-path/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg7/ --with-png-dir=/usr/local/libpng/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/usr/local/mysql --without-pear && make && make install生成php.ini:mkdir /usr/local/php/etc/ cp /lamp/php-5.6/php.ini-production /usr/local/php/etc/php.ini编辑/usr/local/apache2/etc/http.confAddType application/x-httpd-PHP .phpLoadModule php5_module modules/libphp5.so<IfModule mod_php5.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>测试phpvim /usr/local/apache2/htdoc/index.php<?phpphpinfo();?>memcache的安装/usr/local/php/bin/phpize && ./configure --with-php-config=/usr/local/php/bin/php-config && make && make installmcrypt的安装/usr/local/php/bin/phpize && ./configure --with-php-config=/usr/local/php/bin/php-config --with-mcrypt=/usr/local/libmcrypt/ && make && make install修改php.ini在vim中输入set nu命令 在732行左右找到extension_dir="./",把它修改为memcache扩展的安装位置:extension_dir="/usr/local/php/lib/php/extension/no-debug-zts-20130605",并把前面的";"去掉。并在下面添加:extension="memcache.so";extension="mcrypt.so"; 重启apache。安装memcache源代码把yum源配置成http://mirrors.163.com/centos/6/os/x86_64/,安装libevent* yum install -y libevent-devel libevent-header libevent-doc./configure --prefix=/usr/local/memcache && make && make install添加用户:useradd -r memcache启动:/usr/local/memcache/bin/memcached -u memcache &