最新消息:

手动安装LNMP环境

Linux admin 3853浏览 0评论

一些源码包地址

依赖包

  • gcc
  • gcc-c++
  • make
  • cmake
  • bison
  • autoconf
  • pcre-devel
  • openssl-devel
  • ncurses-devel
  • libxml2-devel

axel 的编译安装

<code>tar zxvf axel-2.4.tar.gz
cd axel-2.4
./configure
make
make install
</code>

tengine 的编译安装

创建用户组

<code>groupadd www
useradd -g www www
</code>

编译

<code>tar zxvf tengine-1.4.4.tar.gz
cd tengine-1.4.4
./configure --prefix=/uuland/server/nginx
make
make install
</code>

配置

修改conf/nginx.confuser后面改成www

管理

  • 启动 /uuland/server/nginx/sbin/nginx
  • 重载 /uuland/server/nginx/sbin/nginx -s reload
  • 退出 /uuland/server/nginx/sbin/nginx -s stop

mysql 的编译安装

创建用户组

<code>groupadd mysql
useradd -g mysql mysql
</code>

编译

<code>tar zxvf mariadb-5.5.30.tar.gz
cd mariadb-5.5.30
cmake -DCMAKE_INSTALL_PREFIX=/uuland/server/mysql -DMYSQL_DATADIR=/uuland/database -DEXTRA_CHARSET=all -DSYSCONFDIR=/uuland/server/mysql/etc
make
make install
</code>

配置

删除默认的配置

<code>unlink /etc/my.cnf
</code>

创建新配置

<code>cd /uuland/server/mysql
mkdir etc
cp support-files/my-small.cnf etc/my.cnf
</code>

编辑my.cnf,添加一行datadir=/uuland/database

初始化数据库

<code>./scripts/mysql_install_db --datadir=/uuland/database --user=mysql
</code>

管理

脚本

<code>mkdir sbin
cp support-files/mysql.server sbin/mysql
chmod +x sbin/mysql
</code>

命令

  • 启动 /uuland/server/mysql/sbin/mysql start
  • 停止 /uuland/server/mysql/sbin/mysql stop

php 的编译安装

编译

<code>tar zxvf php-5.4.13.tar.gz
cd php-5.4.13
./configure --prefix=/uuland/server/php --with-config-file-path=/uuland/server/php/etc --enable-fpm
make
make install
</code>

配置

<code>cp php.ini-development /uuland/server/php/etc/php.ini
cd /uuland/server/php
mv etc/php-fpm.conf.default etc/php-fpm.conf
</code>

修改php-fpm.conf

  • usergroup都设置成www
  • 删掉pid = run/php-fpm.pid前面的分号

管理

  • 启动 /uuland/server/php/sbin/php-fpm
  • 重载 kill -USR2 `cat /uuland/server/php/var/run/php-fpm.pid`
  • 停止 kill -QUIT `cat /uuland/server/php/var/run/php-fpm.pid`

PHP 扩展的安装

进入到EXT源码目录(如:/uuland/install/php-5.4.13/ext/mysqli

执行

<code>/uuland/server/php/bin/phpize
./configure --with-php-config=/uuland/server/php/bin/php-config
make
make install
</code>

TIPS

  • mysql.so编译安装时需要指定--with-mysql=/uuland/server/mysql参数
  • mysqli.so编译安装时需要指定--with-mysqli=/uuland/server/mysql/bin/mysql_config参数

安装完成后修改php.ini加载扩展即可

PureFTP 的编译安装

编译

<code>tar zxvf pure-ftpd-1.0.36.tar.gz
cd pure-ftpd-1.0.36
./configure --prefix=/uuland/server/ftp --with-mysql=/uuland/server/mysql
make
make install
</code>

如果提示

configure: error: Your MySQL client libraries aren’t properly installed

执行

<code>cp /uuland/server/mysql/lib/*.* /usr/lib/
</code>

(64位系统拷贝到/usr/lib64/下)

配置

<code>mkdir /uuland/server/ftp/etc
cp pureftpd-mysql.conf /uuland/server/ftp/etc/
cp configuration-file/pure-config.pl /uuland/server/ftp/sbin/
chmod +x /uuland/server/ftp/sbin/pure-config.pl
cp configuration-file/pure-ftpd.conf /uuland/server/ftp/etc/
cp contrib/redhat.init /uuland/server/ftp/sbin/service
chmod +x /uuland/server/ftp/sbin/service
</code>

然后

<code>cd /uuland/server/ftp
</code>

修改sbin/service

  • fullpathpureftpwho以及/etc/pure-ftpd.conf修改成自己的路径

修改etc/pure-ftpd.conf

  • MySQLConfigFile修改成/uuland/server/ftp/etc/pureftpd-mysql.conf
  • NoAnonymous修改成yes

修改etc/pureftpd-mysql.conf

  • 修改成自己的数据库信息

修改sbin/pure-config.pl

  • /usr/sbin/pure-ftpd后面添加一行/uuland/server/ftp/sbin/pure-ftpd

TIPS

mysql数据表

<code>CREATE TABLE IF NOT EXISTS `users` (
  `User` varchar(16) NOT NULL,
  `Password` varchar(64) NOT NULL,
  `Uid` int(11) NOT NULL DEFAULT '-1',
  `Gid` int(11) NOT NULL DEFAULT '-1',
  `Dir` varchar(128) NOT NULL,
  PRIMARY KEY (`User`)
) ENGINE=Aria DEFAULT CHARSET=utf8 COMMENT='FTP Users';
</code>

管理

  • 启动 /uuland/server/ftp/sbin/service start
  • 停止 /uuland/server/ftp/sbin/service stop

完成

下面这篇文章将介绍怎样依托于LNMP来构建一个支持多虚拟主机的PHP+MYSQL运行环境

转载请注明:爱开源 » 手动安装LNMP环境

您必须 登录 才能发表评论!