多语言展示
当前在线:323今日阅读:176今日分享:34

利用lnmp平台搭建crm系统

利用平台搭建系统
工具/原料

centos6.5 两天台,一台负责mysql,一台nginx

方法/步骤
1

lnmp 搭建步骤Lnmp 是Linux 环境下,用nginx,MySQL,php 三种服务搭建的网站服务器架构Nginx安装之前需要安装编译环境和依赖包.Yun –y install gcc gcc-c++ pcre-devel openssl-develNginx默认的用户一般的www 检查www用户是否存在 cat  etc/passwd | gerp –I www如果没有 useradd –s /sbin/nologin –M www下载完成解压缩 tar –xvf nginx-1.8.0.tar.gz –C /usr/loca/到解压的目录下  ./configure – 后面根据需要写上相应的参数。192.168.1.210(这个根据自己的实际情况)服务器的 /usr/local/nginx-1.8.0/nginx-config.sh 里面写了常用的一些参数,可以直接 sh 运行Make && make install 编译安装

2

MySQL 安装MySQL安装之前需要创建用户和组Useradd  -s /sbin/nologin –M mysql安装编译安装需要的依赖包Yum  – y  install  cmake make gcc-c++ gcc bison-devel ncurses-devel解压源码包tar zxvf mysql-5.6.20.tar.gzCd到解压的MySQL源码包的路径MySQL高版本的安装需要cmake编译工具Cmake – 后面写上各种安装参数cmake -DCMAKE_INSTALL_PREFIX=/opt/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_SSL=system \-DWITH_EMBEDDED_SERVER=1 \-DENABLED_LOCAL_INFILE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1Make && make install编译安装完成之后初始化数据库Cd/usr/local/mysql./scripts/mysql_install_db --user=mysql创建数据库只配置文件Cd  mysql-5.6.20/support-files/Cp my-medium.conf /etc/my.cnf启用数据库服务/usr/local/mysql/bin/mysqld_safe   --user=mysql  & 启动的时候可能会卡在那所以推荐后台运行设置数据库管理员登陆密码/usr/local/mysql/bin/mysqladmin   -hlocalhost    -uroot     password     '123'登陆数据库/usr/local/mysql/bin/mysqladmin     -uroot -hlocalhost   -p123附: cmake安装时候可能会报错CMake Error at cmake/readlineNaNake:82 (MESSAGE):  Curses library not found.  Please install appropriate package,解决办法 yum –y install ncurses-devel ; rm –rf CMakeCache.txt(CMakeCache.txt要是找不到可以用 find -/  -name CMakeCache.txt)

3

Php源码安装Php安装之前先要安装各种扩展功能包基本都可以用yum安装。不过由于需要和悟空crm平台配合使用其中的curl功能扩展需要进行源码安装Yum  –y  install  mhash libiconv Libmcrypt libmcrypt libltdl源码安装curltar –xvf curl-7.42.1.gzcd curl-7.42.1./configureMake && make install配置编译时使用的动态库Vi  /etc/ld.so.confinclude   ld.so.conf.d/*.conf/usr/local/mysql/include/usr/local/mysql/lib配置编译安装需要的一些软链接ln -sv /usr/local/lib/libmcrypt.*     /usr/lib/ ln -sv /usr/local/lib/libmhash.*    /usr/lib/解压缩源码包 tar –xvf php-5.4.9.tar.gzCd php-5.4.9./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir   --with-jpeg-dir --with-png-dir     --with-zlib    --with-libxml-dir=/usr --enable-xml    --disable-rpath   --enable-bcmath --enable-shmop  --enable-sysvsem --enable-inline-optimization  --with-curl   --with-curlwrappers --enable-mbregex   --enable-fpm  --enable-mbstring    --with-mcrypt   --with-gd   --enable-gd-native-ttf --with-openssl   --with-mhash   --enable-pcntl --enable-sockets   --with-ldap   --with-ldap-sasl --with-xmlrpc    --enable-zip   --enable-soap鉴于选项过多输入的时候可能会出错个人建议写个简单的脚本编译并安装Make && make install编译过程中可能会出错configure: error: xml2-config not found. Please check your libxml2 installation.解决办法yum -y install libxml2-develconfigure: error: Please reinstall the libcurl distribution -    easy.h should be in /include/curl/解决办法yum -y install libcurl-develconfigure: error: jpeglib.h not found.解决办法yum -y install libjpeg-turbo-develconfigure: error: png.h not found.configure: error:   Cannot   find   ldap.h解决办法yum -y  install   openldap.i686    openldap-devel.i686configure: error: LDAP SASL check failed. Please check config.log for more information.解决办法yum -y install openldap-devel.x86_64configure: error: wrong mysql library version or lib not found. Check config.log for more information.解决办法 ./configure    后面的--with-mysqli=/usr/local/mysql/bin/mysql_config去掉。创建php程序的主配置文件 php.inicd   php-5.4.9cp php.ini-developent  /usr/local/php/etc/php.ini创建fast-cgi的主配置文件cd /usr/local/php/etc/ mv  php-fpm.conf.default    php-fpm.conf启动fast-cgi服务(作用管理php程序)cd   php-5.4.9/sapi/fpm/cp  init.d.php-fpm  /etc/init.d/php-fpmchmod +x   /etc/init.d/php-fpmchkconfig  --add php-fpmservice php-fpm restart

4

把nginx 跟 php 关联起来                                    让nginx把自己接收到的访问php文件的请求给本机的9000端口vim  //usr/local/nginx/conf/nginx.conf (去掉以下行的注释)location ~ \.php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;            include        fastcgi_params;        }:wq vim /usr/local/nginx/conf/fastcgi_params  (添加如下一行)astcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;:wq 重启nginx服务测试通过nginx服务器访问php代码文件vim /usr/local/nginx/html/test.php:wqelinks –dump http://localhost/test.phpvim cat /usr/local/nginx/html/test2.phpElinks –dump http://localhost/test2把php跟MySQL关联起来vi /usr/local/php/etc/php.iniasp_tags = Offasp_tags = On:wq/etc/init.d/php-fpm stop/etc/init.d/php-fpm start测试 php 能否连接mysql数据库?   vim /usr/local/nginx/html/linkdb.php:wq Elinks –dump http://localhost/linkdb.php 结果应该是lindb ok

5

安装crm安装之前需要修改nginx 和 php 进程的所有者和所有者对crm文件的写入权限。Vi  /usr/local/nginx/conf/nginx.conf把user 那行注释去掉nobody 换成 wwwVi /usr/local/php/etc/php.fpm.conf把user 跟 group 都改成 www Tar –xvf v0.5.1.tar –C /usr/loca/nginx/htmlChmod o+w  -R  v0.5.1 在浏览器上打开http://192.168.1.210/V0.5.0/index.php进行安装

注意事项

这个安装过程属于自己的案例,并不代表所有,有可能和大家的经验不同。

推荐信息