linux下php、mysql、reids、gearman等基本环境搭建中遇到的问题总结

网卡配置

修改ONBOOT="no"中的no位yes,修改后为ONBOOT="yes"

添加下面配置项,其中的具体IP等配置需要根据实际情况修改

BOOTPROTO=static

IPADDR=192.168.1.113

NETMASK=255.255.255.0

GETEWAY=192.168.1.1

DNS1=192.168.0.1

1)使用终端输入 date 命令后出现乱码

进行下面操作

编辑/etc/sysconfig/i18n,修改为如下内容:

LANG="zh_CN.GB2312″

SUPPORTED="zh_CN.UTF-8:zh_CN:zh"

SYSFONT="latarcyrheb-sun16"

修改完成后,推出终端重新登录

2)没有wget (下载工具,系统必须可以接入网络)

yum install wget

3)没有make (安装程序,系统必须可以接入网络)

运行yum install make

4)安装上传下载工具(rz/sz)

通过wget http://freeware.sgi.com/source/rzsz/rzsz-3.48.tar.gz 下载

解压:tar zxvf rzsz-3.48.tar.gz

运行:make posix

运行make posix时报错

[root@localhost src]# make posix

cc -O -DPOSIX -DMD=2 rz.c -o rz

make: cc:命令未找到

make: *** [posix] 错误 127

原因是没有安装gcc,运行下面命令(我只运行了前两个就可以用了,第三个命令没有试) yum install g++* -y

yum install gcc* -y

yum install glibc* -y

gcc安装完成后继续运行make posix 应该就可以安装完成了

复制rz/sz到bin目录下,命令:cp rz sz /usr/bin/

5)安装mysql时运行

cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/webserver/mysql \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_SSL=bundled \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DENABLED_LOCAL_INFILE=1

命令时出现下方错误信息

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:82 (MESSAGE):

Curses library not found. Please install appropriate package,

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first):

cmake/readline.cmake:126 (FIND_CURSES)

cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:250 (MYSQL_CHECK_READLINE)

执行下面命令,

运行安装:yum install ncurses-devel

运行安装:yum install bison

删除文件:rm CMakeCache.txt

启动mysql是报错(mysql安装过程中不需要配置开机启动)

ln -s /var/lib/mysql /mysql .sock /tmp/mysql .sock (运行后无效果)

把/usr/local/webserver/mysql/support-files/目录下的my-huge.cnf配置文件复制到etc目录下

之后使用/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/bogon.pid启动或者使用/etc/init.d/mysqld start启动

安装php过程中

提示:configure: error: xml2-config not found. Please check your libxml2 installation. 运行:yum install libxml2

yum install libxml2 –devel -y

提示:configure: error: Cannot find OpenSSL's <evp.h>

运行:yum install openssl openssl-devel

提示:configure: error: Please reinstall the libcurl distribution -

easy.h should be in <curl-dir>/include/curl/

运行:yum install curl curl-devel

提示:configure: error: Cannot find ldap.h

运行:yum install openldap-devel

提示:configure: error: Cannot find ldap libraries in /usr/lib.

运行:cp -frp /usr/lib64/libldap* /usr/lib/

提示:configure: error: Directory /usr/local/webserver/freetds is not a FreeTDS installation directory

运行:在/usr/local/webserver/目录下安装一个freetds 下载地址:http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

$ tar zxvf freetds-stable.tgz(解压)

$ ./configure --prefix=/usr/local/webserver/freetds --with-tdsver=8.0 --enable-msdblib

$ make

$ make install

/usr/local/webserver/php/sbin/php-fpm启动php错误解决:

ALERT: [pool www] pm.min_spare_servers(0) must be a positive value

编辑php-fpm.conf找到pm.min_spare_servers 去除;号,注意非注释内容pm.min_spare_servers

ALERT: [pool www] pm.max_spare_servers(0) must be a positive value

编辑php-fpm.conf找到pm.max_spare_servers 去除;号,同样非注释内容pm.max_spare_servers

WARNING: [pool www] pm.start_servers is not set. It's been set to 20.

编辑php-fpm.conf找到pm.start_servers 去除;号,同样非注释内容pm.start_servers ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98)

# netstat -ntlpps -ef|grep php查看进程,有N多进程

nobody 26152 26151 0 15:45 ? 00:00:00 php-fpm: pool www

nobody 26153 26151 0 15:45 ? 00:00:00 php-fpm: pool www

nobody 26154 26151 0 15:45 ? 00:00:00 php-fpm: pool www

nobody 26155 26151 0 15:45 ? 00:00:00 php-fpm: pool www

...........................

#killall php-fpm 结束所有php-fpm进程

再启动php-fpm

#/usr/local/php/sbin/php-fpm

成功

运行:./configure --prefix=/usr/local/webserver/Gearmand

报错:configure: error: Unable to find libevent

安装:gearman-1.0.2

运行:./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-gearman=/usr/local/webserver/Gearmand

报错:configure: error: Please install libgearman

运行:yum install libgearman-devel.i686 libgearman.i686

报错:configure: error: cannot find Boost headers version >= 1.39.0

运行:将boost安装目录中 lib/ 下的所有内容copy到/usr/lib 和 /usr/lib64下,同时 将 boost安装目录中 include/boost 软链到 /usr/include 中:

cd /usr/local/boost-1.47.0/lib

cp -rf * /usr/lib/;

cp -rf * /usr/lib64/;

ln -s /usr/local/boost-1.47.0/include/boost /usr/include/boost

报错:configure: error: cannot find the flags to link with Boost program_options

运行:ln -s /usr/local/boost/include/boost/ /usr/local/include/boost

ln -s /usr/local/boost/lib/libboost_program_options.so /usr/lib/libboost_program_options.so

报错:configure: error: cannot find the flags to link with Boost thread

运行:./configure --prefix=/usr/local/webservice/gearman --with-boost=/usr/local/webservice/boost/

(给手动指定boost库地址)

重新configure 后,出现别的错误:fatal error: uuid/uuid.h: No such file or directory

这是因为没有uuid库和头文件,需要安装e2fsprogs,试过yum命令安装,问题没解决,需要从源码编译

wget http://downloads.sourceforge.net/e2fsprogs/e2fsprogs-1.41.14.tar.gz

tar xvzf e2fsprogs-1.41.14.tar.gz

进入e2fsprogs-1.41.14目录后执行

/configure --prefix=/usr/local/e2fsprogs

make

make install

然后把uuid目录拷过去

cp -r lib/uuid/ /usr/include/

再次configure ,错误消失,于是执行 make

又报错:

libgearman/.libs/libgearman.so: undefined reference to `uuid_generate'

libgearman/.libs/libgearman.so: undefined reference to `uuid_unparse' collect2: ld returned 1 exit status

问题在网上找到了解决方法,就是重新编译e2fsprogs并加入参数

cd e2fsprogs-1.41.14

./configure --enable-elf-shlibs

make

make install

cp -rf lib/libuuid.so* /usr/lib

查看Gearman所有软件包的安装情况

运行:ldd /usr/local/sbin/gearmand

相关推荐