LNMP(源码编译安装)+testlink1.9.6

LNMP=Linux+nginx+mysql+php

安装环境:Centos6.5

所需软件包:nginx-1.8.0.tar.gz、mysql-5.6.26.tar.gz、php-5.6.13.tar.bz2、libmcrypt-2.5.8.tar.bz2、pcre-8.37.tar.bz2

百度网盘链接: https://pan.baidu.com/s/1kjlXJ1kiS7hoKzkqCF_4rg     密码: 8vjn

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

一、搭建LNMP环境

1.1 编译之前,先安装开发包组

1.1.1  # yum groupinstall "Development Tools" "Development Libraries" -y

1.1.2  # yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* -y

1.1.3  # tar xf pcre-8.37.tar.bz2 -C /usr/local/src/      //解压此安装包即可,不需要安装

1.1.4  # tar xvf nginx-1.8.0.tar.gz -C /usr/local/src/ ; cd /usr/local/src/nginx-1.8.0

1.2 开始编译:

1.2.1 #./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre=/usr/local/src/pcre-8.37/

1.2.2  # make -j 3 && make install       //根据自己机器配置可以,我机器是4核,所以可以用make -j 3(使用3核进行编译)

1.3 创建用户

  #useradd -M -u 8001 -s /sbin/nologin nginx

    1.3.1 修改配置文件

#vim /usr/local/nginx/config/nginx.conf

定位第2行:将  #user nobody;        去掉注释改为" user nginx; "

定位第14行:worker_connections  1024;     添加“ use epoll; ”

定位第67-73行:去掉注释并修改源:fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

                        改为:fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;

1.4 启动并测试Nginx是否正常

    1.4.1 启动nginx 

        #/usr/local/nginx/sbin/nginx

        #ps -ef|grep nginx        

            tcp        0      00.0.0.0:80                  0.0.0.0:*                   LISTEN      7083/nginx 

    1.4.2 测试nginx

http://10.10.20.18        //我环境的IP地址

    1.4.3 添加开机启动

    #echo "/usr/local/nginx/sbin/nginx &" >> /etc/rc.local

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

二、编译安装Mysql5.6.26

        注意:在编译之前请自行卸载系统内部mysql

LNMP(源码编译安装)+testlink1.9.6

2.1 解决依赖

    #yum install -y cmake ncurses-devel

2.2 解压并进入所在目录

    #tar xf mysql-5.6.26.tar.gz -C /usr/local/src/ ; cd /usr/local/src/mysql-5.6.26     //本环境默认都解压到:/usr/local/src

2.3 添加mysql用户   

    #useradd -M -s /sbin/nologin mysql

2.4 编译

    #cmake --DCMAKE_INSTALL_PREFIX=/usr/local/mysql  --DMYSQL_UNIX_ADDR=/tmp/mysql.sock --DDEFAULT_CHARSET=utf8 --DDEFAULT_COLLATION=utf8_general_ci --DWITH_EXTRA_CHARSETS=all --DWITH_MYISAM_STORAGE_ENGINE=1  --DWITH_INNOBASE_STORAGE_ENGINE=1  --DWITH_MEMORY_STORAGE_ENGINE=1 --DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1  --DMYSQL_DATADIR=/usr/local/mysql/data  --DMYSQL_USER=mysql

2.5 安装

    #make -j 3 && make install

2.6 授权

    #chown -R mysql:mysql /usr/local/mysql/

2.7 覆盖源配置文件

    #cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf                //配置文件

    #cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld          //启动文件

2.8 编辑启动配置文件

    #vim /etc/init.d/mysqd        //定位46、47行,并修改为:

LNMP(源码编译安装)+testlink1.9.6

2.9 添加开机启动

    #chkconfig mysqld on

2.10 初始化数据库

    #/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

2.11 做软链接,让系统可以直接调用

    #ln -s /usr/local/mysql/bin/* /bin/

2.12 启动mysql

    #servie mysqld  start

2.13 数据库初始化

    #mysql_secure_installation            //设置root密码

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

三、安装php-5.6.13

3.1 解决依赖

    #yum install php-pear -y

    #yum install -y libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype freetype-devel

3.2 解压并编译安装加密算法包 libmcrypt-2.5.8

    #tar xf libmcrypt-2.5.8.tar.bz2 -C /usr/local/src/ ; cd /usr/local/src/libmcrypt-2.5.8/            //解压

    #./configure --prefix=/usr/local/libmcrypt ; make ; make install                                        //编译

3.3 添加库文件路径

    #vim /etc/ld.so.conf                                        //修改为

LNMP(源码编译安装)+testlink1.9.6

    #ldconfig                                                        //重新加载使其生效

    #echo 'ldconfig' >> /etc/rc.local                    //添加开始自启动

3.4 解压

    #tar xf php-5.6.13.tar.bz2 -C /usr/local/src/ ; cd /usr/local/src/php-5.6.13

3.5 编译

    #./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-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 --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-mcrypt=/usr/local/libmcrypt/  --with-gettext

    #make -j 3 && make intall                            //安装

3.6 拷贝配置文件

    #cp /usr/local/src/php-5.6.13/php.ini-production /usr/local/php/php.ini   

    #cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

    #vim /usr/local/php/etc/php-fpm.conf                    //编辑配置文件,修改运行用户和组

     LNMP(源码编译安装)+testlink1.9.6

3.7 拷启动脚本并添加开机启动

    #cp /usr/local/src/php-5.6.13/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm            //启动脚本

    #chmod +x /etc/init.d/php-fpm                                                                            //添加授权

    #chkconfig php-fpm on                                                                                        //开机启动

3.8 运行php并测试

    #/etc/init.d/php-fpm start                                                                                    //启动php-fpm

    #echo "<?php phpinfo(); ?>" > /usr/local/nginx/html/index.php                           //编辑测试文件

浏览器访问:http://10.10.20.18/index.php

        LNMP(源码编译安装)+testlink1.9.6

到此LNMP环境搭建完成!

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

四、下载安装testlink

4.1 解压

    #tar xvf /opt/testlink-1.9.6.tar.gz -C /usr/local/nginx/html/                                                   //nginx默认网站目录

4.2授权

    #chmod -R 777 /usr/local/nginx/html/*                                                                                //授权testlink文件权限

4.3 安装testlink

浏览器打开:http://10.10.20.18/testlink                        //逐步根据提示进行安装即可,没难度

4.4 安装完后登陆界面

LNMP(源码编译安装)+testlink1.9.6