热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Llinux系统配置NginxPHP(fastcgi)MySQLWEB服务环境

原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明。否则将追究法律责任。本文主要是配置nginx+php(fastcgi)ESX4虚拟机环境:Redhat5.4x32CPU:i5E23002.8G4核内存:2GB安装顺序:1、libiconv-1.14.tar.gz2、l
本文主要是配置nginx+php(fastcgi)   
ESX4虚拟机环境:

  Redhat 5.4 x32
  CPU: i5 E2300 2.8G 4核
  内存:2GB
  
安装顺序:
  1、libiconv-1.14.tar.gz
  2、libmcrypt-2.5.8.tar.gz
  3、mhash-0.9.9.9.tar.bz2
  4、mcrypt-2.6.8.tar.gz
  5、cmake-2.8.4.tar.gz
  6、mysql-5.5.13.tar.gzl
  7、php-5.3.6.tar.bz2 (pdo-mysql,php-pfm已经被加到里面去了)
  8、memcached-1.4.6.tar.gz
  9、eaccelerator-0.9.6.1.zip
  10、Imagemagick
  11、imagick-3.0.1.tgz
  12、pcre-8.02.tar.bz2
  13、nginx-1.0.5.tar.gz
  
假定所有包均已经下载:<这么多包,装起来头晕@_@!>
  一、安装所有包
  #install libiconv-1.1.4.tar.gz
  [root@svr1 lnmp]# mkdir /usr/src/lnmp
  [root@svr1 lnmp]# tar -xzf libiconv-1.14.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/libiconv-1.14/
  [root@svr1 libiconv-1.14]# mkdir /usr/local/lnmp
  [root@svr1 libiconv-1.14]# ./configure --prefix=/usr/local/lnmp/libiconv
  [root@svr1 libiconv-1.14]# make && make install
  #install libmcrypt-2.5.8.tar.gz
  [root@svr1 lnmp]# tar -xzf libmcrypt-2.5.8.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/libmcrypt-2.5.8/
  [root@svr1 libmcrypt-2.5.8]# ./configure
  [root@svr1 libmcrypt-2.5.8]# make && make install
  [root@svr1 libmcrypt-2.5.8]# cd libltdl/
  [root@svr1 libltdl]# ./configure --enable-ltdl-install
  #install mhash-0.9.9.9.tar.bz2
  [root@svr1 lnmp]# tar -xjf mhash-0.9.9.9.tar.bz2 -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/mhash-0.9.9.9/
  [root@svr1 mhash-0.9.9.9]# ./configure
  [root@svr1 mhash-0.9.9.9]# make && make install
  #install mcrypt
  [root@svr1 lnmp]#tar -xzf mcrypt-2.6.8.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]#cd /usr/src/lnmp/mcrypt-2.6.8/
  [root@svr1 mcrypt-2.6.8]# ./configure
  *** Could not run libmcrypt test program, checking why...
  *** The test program compiled, but did not run. This usually means
  *** that the run-time linker is not finding LIBMCRYPT or finding the wrong
  *** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
  *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
  *** to the installed location Also, make sure you have run ldconfig if that
  *** is required on your system
  ***
  *** If you have an old version installed, it is best to remove it, although
  *** you may also be able to get things to work by modifying LD_LIBRARY_PATH
  ***
  configure: error: *** libmcrypt was not found
  出现以上报错时,建立两个软连接就解决了。
  [root@svr1 mcrypt-2.6.8]# ln -s /usr/local/lib/libmcrypt* /usr/lib/
  [root@svr1 mcrypt-2.6.8]# ln -s /usr/local/lib/libmhash.* /usr/lib/
  [root@svr1 mcrypt-2.6.8]# /sbin/ldconfig
  [root@svr1 mcrypt-2.6.8]# make && make install
  #install cmake
  [root@svr1 lnmp]# tar -xzf cmake-2.8.4.tar.gz -C /usr/src/lnmp/
  [root@svr1 lnmp]# cd /usr/src/lnmp/cmake-2.8.4/
  [root@svr1 cmake-2.8.4]# ./configure
  [root@svr1 cmake-2.8.4]# make && make install
  mysql是我的弱项,相关编译方法参见http://heylinux.com/archives/993.html网友
  #install mysql
  [root@svr1 ~]# useradd mysql
  [root@svr1 ~]# mkdir -p /data/mysql
  [root@svr1 ~]# chown -R mysql.mysql /data/mysql
  [root@svr1 ~]# tar -xzf lnmp/mysql-5.5.13.tar.gz -C /usr/src/lnmp/
  [root@svr1 ~]# cd /usr/src/lnmp/mysql-5.5.13/
  [root@svr1 mysql-5.5.13]# cmake -DCMAKE_INSTALL_PREFIX=/data/mysql \
  -DSYSCOnFDIR=/opt/mysql/etc \
  -DMYSQL_DATADIR=/opt/mysql/data \
  -DMYSQL_TCP_PORT=3306 \
  -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
  -DMYSQL_USER=mysql \
  -DEXTRA_CHARSETS=all \
  -DWITH_READLINE=1 \
  -DWITH_SSL=system \
  -DWITH_EMBEDDED_SERVER=1 \
  -DENABLED_LOCAL_INFILE=1 \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DWITHOUT_PARTITION_STORAGE_ENGINE=1
  出现警告,可以忽略,对mysql没有影响。
  CMake Warning: The variable, 'MYSQL_USER', specified manually, was not used during the generation.
  CMake Warning: The variable, 'WITH_MEMORY_STORAGE_ENGINE', specified manually, was not used during the generation.
  [root@svr1 mysql-5.5.13]# make
  [root@svr1 mysql-5.5.13]# make install
  [root@svr1 mysql-5.5.13]# mkdir /usr/local/mysql/{etc,log}
  [root@svr1 mysql-5.5.13]# cp support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf
  [root@svr1 mysql-5.5.13]# chmod 755 scripts/mysql_install_db
  [root@svr1 mysql-5.5.13]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --
  datadir=/usr/local/mysql/data/
  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  To do so, start the server, then issue the following commands:
  /usr/local/mysql//bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql//bin/mysqladmin -u root -h svr1.labexam.com password 'new-password'
  Alternatively you can run:
  /usr/local/mysql//bin/mysql_secure_installation
  which will also give you the option of removing the test
  databases and anonymous user created by default. This is
  strongly recommended for production servers.
  See the manual for more instructions.
  You can start the MySQL daemon with:
  cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &
  You can test the MySQL daemon with mysql-test-run.pl
  cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl
  Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!
  #设置一个密码
  [root@svr1 etc]# /usr/local/mysql/bin/mysqladmin -u root password 'redhat'
  [root@svr1 etc]# /usr/local/mysql/bin/mysqld_safe &
  #启来了
  [root@svr1 etc]# lsof -i:3306
  COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
  mysqld 7123 mysql 10u IPv6 TCP *:mysql (LISTEN)
  #登录mysql
  [root@svr1 etc]# /usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
  Enter password: redhat
  Welcome to the MySQL monitor. Commands end with ; or \g.
  Your MySQL connection id is 4
  Server version: 5.5.13 Source distribution
  Copyright (c) 2000, 2010, 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> GRANT ALL PRIVILEGES ON *.* TO 'admin@localhost' IDENTIFIED BY 'redhat';
  Query OK, 0 rows affected (0.00 sec)
  添加admin用户并设置密码
  mysql> GRANT ALL PRIVILEGES ON *.* TO '' IDENTIFIED BY 'redhat';
  Query OK, 0 rows affected (0.00 sec)
  mysql> use mysql;
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  Database changed
  mysql> select Host,User,Password from user; #查看所有用户,密码情况
  +------------------+-----------------+------------ -------------------------------+
  | Host | User | Password |
  +------------------+-----------------+------------ -------------------------------+
  | localhost | root | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | svr1.labexam.com | root | |
  | 127.0.0.1 | root | |
  | ::1 | root | |
  | localhost | | |
  | svr1.labexam.com | | |
  | % | admin@localhost | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  +------------------+-----------------+------------ -------------------------------+
  8 rows in set (0.00 sec)
  mysql> delete from user where password=""; #删除所有空密码的用户
  Query OK, 5 rows affected (0.00 sec)
  mysql> flush privileges;
  Query OK, 0 rows affected (0.00 sec)
  mysql> select Host,User,Password from user; #确认删除情况
  +-----------+-----------------+------------------- ------------------------+
  | Host | User | Password |
  +-----------+-----------------+------------------- ------------------------+
  | localhost | root | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | admin@localhost | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  | % | | *84BB5DF4823DA319BBF86CA198E6EEE9 |
  +-----------+-----------------+------------------- ------------------------+
  3 rows in set (0.00 sec)
  mysql> exit
  #my.cnf文件暂未做任何修改。


推荐阅读
author-avatar
余小刚玩guitarvp_996
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有