评论

收藏

[MySQL] Centos 6.4用源代码安装LAMP环境

数据库 数据库 发布于:2021-07-04 10:40 | 阅读数:231 | 评论:0

      Apache是世界使用排名第一的Web服务器软件,其安全性和稳定性颇受业界认可,功能十分强大,是基于模块化的服务,可以动态加载模块,处理动态和静态页面都很好的效果.
  
  1.下载和安装apache软件
  [root@node2 ~]# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.10.tar.gz
  [root@node2 ~]# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.1.tar.gz
  [root@node2 ~]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
  [root@node2 ~]# groupadd -g 503 apache
  [root@node2 ~]# useradd -u 503 -r -s /sbin/nologin -g 503 apache
  [root@node2 ~]# yum install pcre* -y
  [root@node2 ~]# tar xvf apr-1.5.1.tar.gz
  [root@node2 ~]# cd apr-1.5.1
[root@node2 apr-1.5.1]# ./configure --prefix=/usr/local/apr-1.5.1

  [root@node2 apr-1.5.1]# make && make install
  [root@node2 apr-1.5.1]# cd ..
  [root@node2 ~]# tar xvf apr-util-1.5.4.tar.gz
  [root@node2 apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-uttil --with-apr=/usr/local/apr-1.5.1/
  [root@node2 apr-util-1.5.4]# make && make install
  [root@node2 apr-1.5.1]# cd ..
  [root@node2 ~]# tar xvf httpd-2.4.10.tar.gz
  [root@node2 ~]# cd httpd-2.4.10
  [root@node2 httpd-2.4.10]# ./configure  --prefix=/usr/local/apache-2.4.10 --enable-cache --enable-cache-disk --enable-so   --enable-http   --enable-proxy   --enable-info   --enable-rewrite --with-apr=/usr/local/apr-1.5.1/  --with-apr-util=/usr/local/apr-uttil/ --with-pcre
  [root@node2 httpd-2.4.10]# make && make install
  [root@node2 httpd-2.4.10]# cd /usr/local/apache-2.4.10/
  [root@node2 apache-2.4.10]# vim conf/httpd.conf
  ServerName 127.0.0.1
  [root@node2 apache-2.4.10]# /usr/local/apache-2.4.10/bin/apachectl -k restart
httpd not running, trying to start
[root@node2 apache-2.4.10]# netstat -antup | grep 80   
tcp        0      0 :::80                       :::*                        LISTEN      821/httpd              
[root@node2 apache-2.4.10]# vim /etc/sysconfig/iptables

  -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
  [root@node2 apache-2.4.10]# /etc/init.d/iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@node2 apache-2.4.10]#

  
  2.测试访问页面
   DSC0000.jpg
  
  3.安装mysql数据库
  [root@node2 ~]# yum install cmake ncurses-devel -y
  [root@node2 ~]# groupadd -g 502 mysql
[root@node2 ~]# useradd  -r -u 502 -s /sbin/nologin -g 502  mysql
[root@node2 ~]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.22.tar.gz

  [root@node2 ~]# tar xvf mysql-5.6.22.tar.gz
  [root@node2 ~]# cd mysql-5.6.22
  [root@node2 mysql-5.6.22]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.22
  -DMYSQL_DATADIR=/usr/local/mysql-5.6.22/data  
  -DDEFAULT_CHARSET=utf8  
  -DDEFAULT_COLLATION=utf8_general_ci   
  -DMYSQL_USER=mysql
  [root@node2 mysql-5.6.22]# make && make install
  [root@node2 mysql-5.6.22]# echo $?
0
[root@node2 mysql-5.6.22]# cd /usr/local/mysql-5.6.22/
[root@node2 mysql-5.6.22]# cp -a support-files/mysql.server  /etc/init.d/mysqld
[root@node2 mysql-5.6.22]# chkconfig  --add mysqld
[root@node2 mysql-5.6.22]# chkconfig  mysqld on
[root@node2 mysql-5.6.22]# vim /etc/my.cnf
  datadir=/usr/local/mysql-5.6.22/data
basedir=/usr/local/mysql-5.6.22
socket=/tmp/mysql.sock
  [root@node2 mysql-5.6.22]# ./scripts/mysql_install_db  --basedir=/usr/local/mysql-5.6.22/
  --datadir=/usr/local/mysql-5.6.22/data/ --defaults-file=/etc/my.cnf  --user=mysql
  [root@node2 mysql-5.6.22]# /etc/init.d/mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL...... SUCCESS!
[root@node2 mysql-5.6.22]# vim ~/.bash_profile
  PATH=$PATH:$HOME/bin:/usr/local/mysql-5.6.22/bin
  [root@node2 mysql-5.6.22]# . ~/.bash_profile
  [root@node2 mysql-5.6.22]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22 Source distribution
  Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.22    |
+-----------+
1 row in set (0.00 sec)
  mysql>
  4.安装php软件
  [root@node2 ~]# wget http://mirrors.sohu.com/php/php-5.5.20.tar.gz
  [root@node2 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
  [root@node2 ~]# tar xvf libmcrypt-2.5.7.tar.gz
  [root@node2 libmcrypt-2.5.7]# ./configure --prefix=/usr/local/libmcrypt
  [root@node2 libmcrypt-2.5.7]# make && make install
  [root@node2 libmcrypt-2.5.7]# cd ..
  [root@node2 ~]# yum install libjpeg* libpng* freetype* libcurl-devel  libvpx-devel libxml2-devel libXpm-devel openldap-devel
  [root@node2 ~]# tar xvf php-5.5.20.tar.gz
  [root@node2 ~]# cd php-5.5.20
  [root@node2 php-5.5.20]# ./configure  --prefix=/usr/local/php-5.4.28 --with-apxs2=/usr/local/apache-2.4.10/bin/apxs --with-libxml-dir --with-zlib --with-curl --with-gd  --with-vpx-dir  --with-jpeg-dir  --with-png-dir  --with-zlib-dir  --with-xpm-dir  --with-iconv   --with-ldap --with-mcrypt=/usr/local/libmcrypt/  --with-mysql=/usr/local/mysql-5.6.22/ --with-mysqli=/usr/local/mysql-5.6.22/bin/mysql_config --with-pdo-mysql  --with-freetype-dir
  [root@node2 php-5.5.20]# make && make install
  [root@node2 php-5.5.20]# echo $?
0
[root@node2 php-5.5.20]# cp -a php.ini-development  /usr/local/php-5.4.28/lib/php.ini
  [root@node2 php-5.5.20]# vim /usr/local/php-5.4.28/lib/php.ini
  date.timezone = Asia/ShangHai
  [root@node2 php-5.5.20]#
  5.apache和php结合
  [root@node2 php-5.5.20]# cd /usr/local/apache-2.4.10/
[root@node2 apache-2.4.10]# vim conf/httpd.conf
  ServerName 127.0.0.1
  User apache
Group apache
  AddType application/x-httpd-php .php
AddType application/x-httpd-php .phps
  DirectoryIndex index.php index.html
  [root@node2 apache-2.4.10]# vim htdocs/index.php
  <?php
phpinfo();
?>
  [root@node2 apache-2.4.10]# /usr/local/apache-2.4.10/bin/apachectl -k restart
[root@node2 apache-2.4.10]# netstat -antup | grep 80      
tcp        0      0 :::80                       :::*                        LISTEN      821/httpd
  [root@node2 apache-2.4.10]#         

  6.测试是否正常
DSC0001.jpg

  
  
7.安装php加速器(zend guard loader)

  
关注下面的标签,发现更多相似文章