首页 运维 正文
CentOS下安装LAMP的方法

 2022-10-23    311  

CentOS安装LAMP的方法:

  ——————-编译前准备

CentOS下安装LAMP的方法

  安装编译器gcc

  最小化安装,没有安装编译器

  yum install gcc

  gcc-c++

  如果不安装,在编译mysql的时候会出现【exec: g++: not found】错误

  yum install gcc-c++

  ——————————–ncurses-5.6.tar.gz http://ftp.gnu.org/pub/gnu/ncurses/

  tarzxvfncurses-5.6.tar.gz 
  •   cdncurses-5.6
  •   ./configure--prefix=/usr--with-shared--without-debug
  •   make
  •   makeinstallclean
  •   ——————mysql-5.0.22.tar.gz http://download.mysql.cn/download_file/gz/5.0/mysql-5.0.22.tar.gz

      tar-zxvfmysql-5.0.22.tar.gz 
  •   cdmysql-5.0.22
  •   ./configure--with-mysqld-user=mysql--prefix=/usr/local/mysql5--with-extra-charset=all--without-isam--exec-prefix=/usr/local/mysql5
  •   make&&makeinstall
  •   初始化数据库:

      groupaddmysql 
  •   useradd-gmysqlmysql
  •   scripts/mysql_install_db
  •   cp/usr/local/mysql5/share/mysql/my-medium.cnf/usr/local/mysql5/var/my.cnf//手动创建/usr/local/mysql5/var目录
  •   cp/usr/local/mysql5/share/mysql/mysql.server/etc/init.d/mysqld
  •   chkconfig--addmysqld
  •   chkconfig--level2345mysqldon
  •   chownmysql:mysql-R/usr/local/mysql5/
  •   servicemysqldstart
  •   ln-s/usr/local/mysql5/bin/mysql/sbin/mysql
  •   ln-s/usr/local/mysql5/bin/mysqladmin/sbin/mysqladmin
  •   设定mysql密码

      mysqladmin-urootpassword"123456" 
  •   测试

      netstat-nplt|grepmysql 
  •   psaux|grepmysql
  •   ——————apache

      http://httpd.apache.org/download.cgi

      http://labs.xiaonei.com/apache-mirror/httpd/httpd-2.2.13.tar.gz

      tar zxvf httpd-2.2.13.tar.gz

      cd httpd-2.2.13

      ./configure--prefix=/usr/local/apache2--enable-so--enable-rewrite 
  •   make&&makeinstall
  •   /usr/local/apache2/bin/apachectlconfigtest
  •   /usr/local/apache2/bin/apachectlstart
  •   /usr/local/apache2/bin/apachectlstop
  •   修改默认启动页

      vi /usr/local/apache2/conf/httpd.conf

      DirectoryIndex index.html 改为

      DirectoryIndexindex.htmlindex.htmdefault.htmdefault.htmlindex.phpindex.php3index.jsp 
  •   #ServerNamewww.example.com:80改为
  •   ServerNamewww.example.com:80
  •   修改乱码

      步骤1:

      在httpd.conf中将Include conf/extra/httpd-autoindex这个模块的注释去掉

      @vi /usr/local/apache/conf/httpd.conf

      步骤2:

      在httpd-autoindex.conf中加入IndexOptions Charset=UTF-8

      @vi /usr/local/apache/conf/extra/httpd-autoindex.conf

      —————安装GD

      1:安装ZLIB2

      ######zlib#############

      tar zxvf zlib-1.2.3.tar.gz

      cd zlib-1.2.3

      ./configure 
  •   make
  •   makeinstallclean
  •   2:安装PNG

      ##########libpng###########

      tar zxvf libpng-1.2.26.tar.gz

      cd libpng-1.2.26

      cp scripts/makefile.linux ./makefile

      ./configure--prefix=/usr/local/libpng 
  •   make
  •   makeinstallclean
  •   3:安装freetype

      ##########freetype#########

      cd freetype-2.3.5

      ./configure 
  •   make
  •   makeinstall
  •   4:安装JPEG6

      #########jpeg###############

      tar zxvf jpegsrc.v6b.tar.gz

      cdjpeg-6b 
  •   mkdir-pv/usr/local/jpeg/{,bin,lib,include,man/man1,man1}
  •   ./configure--prefix=/usr/local/jpeg--enable-shared--enable-static
  •   make
  •   makeinstall
  •   5:安装GD

      ########GD###########

      tar zxvf gd-2.0.35.tar.gz

      cd gd-2.0.35

      ./configure--with-png--with-freetype--with-jpeg=/usr/local/jpeg/ 
  •   make
  •   makeinstall
  •   ——————php

      http://cn.php.net/distributions/php-5.2.11.tar.gz

      1:安装LIBXML2

      #####libxml2 #####

      tar zxvf libxml2-2.6.31.tar.gz

      cd libxml2-2.6.31

      ./configure--prefix=/usr/local/libxml2 
  •   make
  •   makeinstall
  •   cpxml2-config/usr/bin
  •   2::安装PHP5.2.5

      #########php##########

      tar zxvf php-5.2.5.tar.gz

      cd php-5.2.5

      ./configure--prefix=/usr/local/php5--with-mysql=/usr/local/mysql5--with-apxs2=/usr/local/apache2/bin/apxs--with-jpeg-dir=/usr/local/jpeg--with-freetype-dir=/usr/local/include/freetype2--with-zlib--with-png-dir=usr/local/libpng12--with-libxml-dir=/usr/local/libxml2--with-gd--enable-ftp--enable-sockets 
  •   make
  •   maketest
  •   makeinstall
  •   3:配置

      cp php.ini-dict /usr/local/php5/lib/php.ini

      编辑httpd.conf

      /usr/local/apache2/conf/httpd.conf

      加载php模块,去掉注释,我的版本是缺省就启用的。

      LoadModulephp5_modulemodules/libphp5.so 
  •   加上下面两行

      AddTypeapplication/x-httpd-php.php.phtml 
  •   AddTypeapplication/x-httpd-php-source.phps
  •   5.5 安装zend

      tar -zxvf ZendOptimizer-3.0.0-linux-glibc23- x86_64.tar.gz

      cd ZendOptimizer-3.0.0-linux-glibc23-x86_64

      ./install

      5.6 安装phpmyadmin

      cp -rf phpMyAdmin-v2.11.5.2 /usr/local/apache2/htdocs/phpmyadmin

      cd /usr/local/apache2/htdocs/phpmyadmin/

      cp config.sample.inc.php config.inc.php

      vi config.inc.php

      $cfg[‘blowfish_secret’] = ”改为

      $cfg[‘blowfish_secret’] = ‘dd’

      只要不为空就可以了,这样就可以登陆,如果还有问题,就修改一下语言就解决“配置文件现在需要绝密的短语密码(blowfish_secret)”这个错误了。

    原文链接:https://77isp.com/post/8346.html

    =========================================

    https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。