设为首页 收藏本站
查看: 2211|回复: 0

[经验分享] CentOS 5.x + Apache 2.x + PHP 5.3.x + GD2 + Xcache + vsftpd + MySQL 安装日志

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-11-19 09:29:49 | 显示全部楼层 |阅读模式
#==============================================================================
#=== web server 自动安装脚本
#=== 2010年12月7日
#=== Yecms
#=== 此脚本在 CentOS 5.5 x32 上测试通过
#==============================================================================
#===安装需要的软件
#==============================================================================
yum install vsftpd gcc g-c++ gcc-c++ libtool /
openssl-devel  ncurses-devel pam-devel python-devel libxml2-devel -y

#==============================================================================
#===下载所需的软件, 假设下载的目录为 /down/websoft/
#==============================================================================
softpath="/down/websoft/"
mkdir ${softpath} -p
cd ${softpath}
#=== Apache 2.2.16
#=== URL: http://labs.renren.com/apache-mirror/httpd/
wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.16.tar.gz
#=== PHP 5.3.3
#=== URL: http://cn2.php.net/get/php-5.3.3.tar.gz/from/a/mirror
wget http://cn2.php.net/get/php-5.3.3.tar.gz/from/cn.php.net/mirror
#=== libxml2-2.7.7
#=== URL: ftp://xmlsoft.org/libxml2/
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz
#=== libxslt 1.1.22
#=== URL: http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/
wget http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.22.tar.gz
#=== MCrypt
#=== URL: http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/
wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
#=== libmcrypt
#=== URL: http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/
wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
#=== mhash
#=== URL: http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/
wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
#=== libiconv
#=== URL:  http://ftp.gnu.org/pub/gnu/libiconv/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#=== curl
#=== URL: http://curl.haxx.se/download.html
wget http://curl.haxx.se/download/curl-7.21.0.tar.gz
#=== zlib
#=== URL: http://zlib.net/
wget http://zlib.net/zlib-1.2.5.tar.gz
#=== freetype
#=== URL: http://nchc.dl.sourceforge.net/project/freetype/freetype2/
wget http://nchc.dl.sourceforge.net/project/freetype/freetype2/2.4.1/freetype-2.4.1.tar.gz
#=== fontconfig
#=== URL: http://www.fontconfig.org/release/
wget http://www.fontconfig.org/release/fontconfig-2.8.0.tar.gz
#=== GD2
#=== URL: http://www.libgd.org/releases/
wget http://www.libgd.org/releases/gd-2.0.36RC1.tar.gz
#=== libpng
#=== URL: http://nchc.dl.sourceforge.net/project/libpng/00-libpng-stable/1.2.42/
wget http://nchc.dl.sourceforge.net/project/libpng/00-libpng-stable/1.2.42/libpng-1.2.42.tar.gz
#==== Devl URL: http://nchc.dl.sourceforge.net/project/libpng/02-libpng-devel/
#wget http://nchc.dl.sourceforge.net/project/libpng/02-libpng-devel/1.5.0beta16/libpng-1.5.0beta16.tar.gz
#=== libjpeg v6b
#=== URL: http://nchc.dl.sourceforge.net/project/libjpeg/libjpeg/6b/
wget http://nchc.dl.sourceforge.net/project/libjpeg/libjpeg/6b/jpegsrc.v6b.tar.gz
#=== libgif
#=== URL: http://sourceforge.net/projects/giflib/files/
wget http://sourceforge.net/projects/giflib/files/giflib%204.x/giflib-4.1.6/giflib-4.1.6.tar.gz/download
#=== MySQL
#=== URL: http://www.mysql.com/downloads/mysql/#downloads
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.49.tar.gz/from/http://mysql.ntu.edu.tw/
#=== PAM-Mysql
#=== URL: http://pam-mysql.sourceforge.net/
wget http://prdownloads.sourceforge.net/pam-mysql/pam_mysql-0.7RC1.tar.gz
#=== cronolog
#=== URL: http://cronolog.org/
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
#=== Xcache
#=== URL: http://xcache.lighttpd.net/
wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install zlib
#==============================================================================
# Make dir
#--------
mkdir /usr/local/zlib -p
cd ${softpath}
tar zxvf zlib-1.2.5.tar.gz
cd ${softpath}/zlib-1.2.5
./configure --prefix=/usr/local/zlib
make && make install
echo "/usr/local/zlib/lib" >> /etc/ld.so.conf
ldconfig
chcon -t textrel_shlib_t /usr/local/zlib/lib/libz.so*

#==============================================================================



#==============================================================================
#==============================================================================
#=== Install freetype2
#==============================================================================
# Make dir
#--------
mkdir /usr/local/freetype2 -p
cd ${softpath}
tar zxvf freetype-2.4.1.tar.gz
cd ${softpath}/freetype-2.4.1
./configure --prefix=/usr/local/freetype2
make && make install
echo "/usr/local/freetype2/lib"  >> /etc/ld.so.conf
ldconfig
#==============================================================================

#==============================================================================
#==============================================================================
#=== Install jpeg
#==============================================================================
# Make dir
#--------
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/man/man1/ -p
cd ${softpath}
tar zxvf ${softpath}/jpegsrc.v6b.tar.gz
cd ${softpath}/jpeg-6b
#需要安装 libtool, 如果没有安装,可以通过  yum install libtool -y 来安装
#把已经安装好的 libtool 配置覆盖掉jqeg 下的配置
/cp -f /usr/share/libtool/config.sub ./
/cp -f /usr/share/libtool/config.guess ./
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
make
make install-lib
make install
echo "/usr/local/jpeg6/lib" >> /etc/ld.so.conf
ldconfig
#libtool --finish /usr/local/jpeg6/lib
#==============================================================================

#==============================================================================
#==============================================================================
#=== Insatall libpng
#==============================================================================
# Make dir
#--------
mkdir /usr/local/libpng2
cd ${softpath}
tar zxvf ${softpath}/libpng-1.2.42.tar.gz
cd ${softpath}/libpng-1.2.42/
#添加环境变量
export LDFLAGS=-L/usr/local/zlib/lib
export CFLAGS=-I/usr/local/zlib/include
./configure --prefix=/usr/local/libpng2
make
make install
echo "/usr/local/libpng2/lib" >> /etc/ld.so.conf
ldconfig
#==============================================================================

#==============================================================================
#==============================================================================
#=== Install libiconv
#==============================================================================
# Make dir
#--------
mkdir /usr/local/libiconv
cd ${softpath}
tar zxvf ${softpath}/libiconv-1.13.1.tar.gz
cd ${softpath}/libiconv-1.13.1
./configure --prefix=/usr/local/libiconv
make
make install
echo "/usr/local/libiconv/lib" >> /etc/ld.so.conf
ldconfig
#==============================================================================

#==============================================================================
#==============================================================================
#=== Install libxml
#==============================================================================
# Make dir
#--------
#
# 你可能需要安装 python-devel
#
mkdir /usr/local/libxml2
cd ${softpath}
tar zxvf ${softpath}/libxml2-2.7.7.tar.gz
cd ${softpath}/libxml2-2.7.7
./configure --prefix=/usr/local/libxml2  --with-python
make
make install
# 这里的路径,要看 python 安装的版本是 2.6,还是 2.4
# 查看 python 的版本   python -V
LD_LIBRARY_PATH=/usr/local/lib
LD_LIBRARY_PATH=/usr/local/libxml2/lib
LD_LIBRARY_PATH=/usr/lib/python2.4/site-packages
echo "/usr/local/libxml2/lib" >> /etc/ld.so.conf
echo "/usr/lib/python2.4/site-packages" >> /etc/ld.so.conf
ldconfig
#===========================================================================

#==============================================================================
#==============================================================================
#=== Install libxslt
#==============================================================================
# Make dir
#--------
mkdir /usr/local/libxslt
cd ${softpath}
tar zxvf ${softpath}libxslt-1.1.22.tar.gz
cd ${softpath}libxslt-1.1.22
./configure --prefix=/usr/local/libxslt   /
--with-libxml-prefix=/usr/local/libxml2/
make
make install
echo "/usr/local/libxslt/lib" >> /etc/ld.so.conf
# 这里的路径,要看 python 安装的版本是 2.6,还是 2.4
echo "/usr/local/libxslt/lib/python2.4/site-packages" >> /etc/ld.so.conf
ldconfig
#==============================================================================

#==============================================================================
#==============================================================================
#=== Install fontconfig
#==============================================================================
mkdir /usr/local/fontconfig
cd ${softpath}
tar zxvf ${softpath}fontconfig-2.8.0.tar.gz
cd ${softpath}fontconfig-2.8.0/
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
cp -r /usr/local/libxml2/include/libxml2/libxml/ /usr/include/
./configure --prefix=/usr/local/fontconfig  /
--with-freetype-config=/usr/local/freetype2/bin/freetype-config

make
make install
echo "/usr/local/fontconfig/lib" >> /etc/ld.so.conf
ldconfig
#==============================================================================

#==============================================================================
#==============================================================================
#=== Install gd
#==============================================================================
mkdir /usr/local/gd2
cd ${softpath}
tar zxvf ${softpath}gd-2.0.36RC1.tar.gz
cd ${softpath}gd-2.0.36RC1
cp /usr/local/libpng2/include/pngconf.h ${softpath}gd-2.0.36RC1
./configure --prefix=/usr/local/gd2     /
--with-zlib=/usr/local/zlib             /
--with-jpeg=/usr/local/jpeg6            /
--with-freetype=/usr/local/freetype2    /
--with-xml=/usr/local/libxml2           /
--with-png=/usr/local/libpng2           /
--with-fontconfig=/usr/local/fontconfig /
--with-slt=/usr/local/libxslt
make
make install
echo "/usr/local/gd2/lib" >> /etc/ld.so.conf
ldconfig
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install libmcrypt
#==============================================================================
mkdir /usr/local/libmcrypt
cd ${softpath}/
tar zxvf ${softpath}/libmcrypt-2.5.8.tar.gz
cd ${softpath}/libmcrypt-2.5.8/libltdl
./configure  --enable-ltdl-install
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
cd ${softpath}/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make
make install

ln -s /usr/local/libmcrypt/lib/libmcrypt.la         /usr/lib/libmcrypt.la
ln -s /usr/local/libmcrypt/lib/libmcrypt.so         /usr/lib/libmcrypt.so
ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4       /usr/lib/libmcrypt.so.4
ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4.4.8   /usr/lib/libmcrypt.so.4.4.8
cp /usr/local/libmcrypt/bin/libmcrypt-config /usr/bin/libmcrypt-config
cp /usr/local/libmcrypt/lib/libmcrypt.* /usr/lib
echo "/usr/local/libmcrypt/lib" >>  /etc/ld.so.conf
ldconfig
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install mhash 如果自定义目录,mcrypt 可能无法找到 mhash, 建议还是不要修改目录.
#==============================================================================
cd ${softpath}/
tar zxvf ${softpath}/mhash-0.9.9.9.tar.gz
cd ${softpath}/mhash-0.9.9.9
./configure
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf

ln -s /usr/local/lib/libmhash.a        /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la       /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so       /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2     /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ldconfig
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install mcrypt 唉.经常找不到 libmhash
#==============================================================================
mkdir /usr/local/mcrypt
cd ${softpath}/
tar zxvf ${softpath}/mcrypt-2.6.8.tar.gz
cd ${softpath}/mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/lib                  /
./configure --prefix=/usr/local/mcrypt          /
--with-libmcrypt-prefix=/usr/local/libmcrypt    /
--with-libiconv-prefix=/usr/local/libiconv
make
make install
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install apache
#==============================================================================
#
# apache 的头标识,可以在 include/ap_release.h 中修改
#

mkdir -p /web/apache/
mkdir -p /web/logs/
mkdir -p /web/wwwroot/
cd ${softpath}/
tar zxvf ${softpath}/httpd-2.2.16.tar.gz
cd ${softpath}/httpd-2.2.16
./configure --prefix=/web/apache --enable-modules=so        /
--enable-rewrite --enable-mods-shared=all                   /
--enable-cache --enable-disk-cache --enable-mem-cache       /
--enable-file-cache                                         /
--with-mpm=worker --enable-ssl                              /
--enable-suexec   --with-suexec-caller=daemon               /
--with-z=/usr/local/zlib

#
# 如果提示 configure: error: ...No recognized SSL/TLS toolkit detected
# 是因为没有安装  openssl-devel
# 用 yum install openssl-devel -y  安装就可以了
#

make
make install
echo "/web/apache/lib" >> /etc/ld.so.conf
ldconfig
cp ${softpath}/httpd-2.2.16/support/apachectl /etc/rc.d/init.d/httpd
#vim /etc/rc.d/init.d/httpd
#   添加:
# Startup script for the Apache Web Server
# chkconfig: 2345 85 15
# description: Apache is a World Wide Web server .It is used to server
# HTML files and CGI.
# processname: httpd
# pidfile: /web/apache/log/httpd.pid
# config: /web/apache/conf/httpd.conf
#===============================

chkconfig --add httpd
chmod 755 /etc/rc.d/init.d/httpd
chkconfig --level 345 httpd on
#如果是SElinux启用,允许加载下面文件:
chcon -t textrel_shlib_t /web/apache/modules/*.so

groupadd  apache
useradd   apache -g apache -s /sbin/nologin
chown apache.apache /web/wwwroot/ -R
chmod 777 /web/wwwroot/ -R
echo &quot;<?php phpinfo(); ?>&quot; > /web/wwwroot/phpinfo.php
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install mysql
#==============================================================================
#
# 如果安装了 ncurses-devel-xxx, 就不用加下面这句参数了
#--with-named-curses-libs=/usr/lib/libncursesw.so.5 /
#
# 安装 ncurses-devel, yum install ncurses-devel -y
#
cd ${softpath}/
mkdir /web/mysql/
tar zxvf ${softpath}/mysql-5.1.49.tar.gz
cd ${softpath}/mysql-5.1.49
./configure /
--prefix=/web/mysql --sysconfdir=/web/mysql    /
--without-debug     --enable-assembler         /
--with-mysqld-ldflags=-all-static              /
--with-client-ldflags=-all-static              /
--with-unix-socket-path=/tmp/mysql.sock        /
--with-mysqld-user=mysql                       /
--with-extra-charsets=utf8,gbk,gb2312          /
--with-innodb                                  /
--with-mysqld-user=mysql                       /
--with-charset=utf8 --with-collation=utf8_unicode_ci
make
make install
echo &quot;/web/mysql/lib/mysql&quot; >> /etc/ld.so.conf
echo &quot;/web/mysql/lib/mysql/plugin&quot; >> /etc/ld.so.conf
ldconfig
cp ${softpath}/mysql-5.1.49/support-files/my-medium.cnf /etc/my.cnf
cp ${softpath}/mysql-5.1.49/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
chmod 755 /etc/init.d/mysqld
groupadd  mysql
useradd   mysql -g mysql  -s /sbin/nologin
#修改 /etc/init.d/mysqld
#vim /etc/init.d/mysqld

cp -r ${softpath}/mysql-5.1.49/sql/share/english/ /web/mysql/share/
cp ${softpath}/mysql-5.1.49/scripts/fill_help_tables.sql /web/mysql/share/
cp ${softpath}/mysql-5.1.49/scripts/mysql_system_tables.sql /web/mysql/share/
cp ${softpath}/mysql-5.1.49/scripts/mysql_system_tables_data.sql /web/mysql/share/
mkdir /web/mysql/data/mysql/english/ -p
cp ${softpath}mysql-5.1.49/sql/share/english/errmsg.sys /web/mysql/data/mysql/english/
# 把原来的mysql 备份
# 如果已经安装了 mysql 客户端的话.
mv /usr/bin/mysql /usr/bin/mysql.bak
ln -s /web/mysql/bin/mysql /usr/bin/mysql
${softpath}/mysql-5.1.49/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/web/mysql --user=mysql

chown mysql.mysql -R /web/mysql/
# 启动mysql服务
service mysqld start

#在这里输入密码 (假设密码为123456,当然,这个密码是非常的不安全)
/web/mysql/bin/mysql_secure_installation
#
# 同时,在这里删除 anonymous(匿名用户),数据库 test(测试) 并且不允许 root 的远程登录
# 最后,再刷新权限表
#
chown mysql.mysql -R /web/mysql/
chmod 700 -R /web/mysql/
#/web/mysql/bin/mysqladmin -u root password 123456
#
# 输入密码
# 测试是否显示数据库
# show databases;
# 退出
# quit;
#
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install cURL
#==============================================================================
cd ${softpath}/
tar zxvf ${softpath}/curl-7.21.0.tar.gz
cd ${softpath}/curl-7.21.0
./configure
make
make install
ldconfig
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install php
#==============================================================================
# 需要安装 libxml2-devel

cd ${softpath}
mkdir /web/php/
tar zxvf ${softpath}/php-5.3.3.tar.gz
cd ${softpath}/php-5.3.3/

LD_LIBRARY_PATH=/usr/local/lib
LD_LIBRARY_PATH=/usr/local/libxml2/lib
LD_LIBRARY_PATH=/usr/lib/python2.4/site-packages
LD_LIBRARY_PATH=/usr/local/zlib/lib
LD_LIBRARY_PATH=/usr/local/zlib/include
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib
export LIBXML2_LIBS=-L/usr/local/libxml2/lib
export LIBXML2_CFLAGS=-I/usr/local/libxml2/lib/include
export LIBXML2_LIBS=-L/usr/local/gd2/lib
export LIBXML2_CFLAGS=-I/usr/local/gd2/lib/include
ldconfig

./configure  /
--prefix=/web/php                 --with-apxs2=/web/apache/bin/apxs     /
--with-gd=/usr/local/gd2                                                /
--with-jpeg-dir=/usr/local/jpeg6  --with-png-dir=/usr/local/libpng2     /
--enable-gd-native-ttf            --with-zlib-dir=/usr/local/zlib       /
--with-freetype-dir=/usr/local/freetype2                                /
--enable-zip                      --with-libxml-dir=/usr/local/libxml2  /
--with-mysql=/web/mysql           --with-curl                           /
--with-mcrypt=/usr/local/libmcrypt/                                     /
--enable-mbstring=all                                                   /
--with-mhash                      --enable-gd-native-ttf                /
--enable-ftp                      --disable-ipv6                        /
--with-iconv
make
make test
make install
# 复制 php.ini
cp ${softpath}/php-5.3.3/php.ini-development /web/php/lib/php.ini
#vim /web/apache/conf/httpd.conf
#查找<IfModule mime_module>
#在此范围添加 (差不多在 365 行)
# AddType application/x-httpd-php .php
#
# 修改: DirectoryIndex index.html (差不多在 224 行)
#   为: DirectoryIndex index.php index.htm index.html
#
#
# 修改: DocumentRoot &quot;/web/apache/htdocs&quot; (差不多在 162 行)
#   为: DocumentRoot &quot;/web/wwwroot&quot;
#
#
# 修改: <Directory &quot;/web/apache/htdocs&quot;> (差不多在 189 行)
#   为: <Directory &quot;/web/wwwroot&quot;>
#
# 禁止Apache 列出目录
# 修改 Options Indexes FollowSymLinks (差不多在 202 行)
#   去掉 Indexes即可
#
# 修改 apache 运行的用户
# 修改 User 和 Group 的值为 apache (差不多在 123 行)
#
# 修改 apache服务名称 的值为 ServerName * (差不多在 155 行)
#
# 添加 虚拟主机支持(vhosts)  (差不多在 448 行)
# NameVirtualHost *:80
#
# Include conf/vhosts/*.conf
#
#<VirtualHost *:80>
#  ServerName     *
#  ServerAlias    *
#  DocumentRoot   &quot;/web/wwwroot/null&quot;
#  ErrorDocument  404 &quot;/404.htm&quot;
#  php_admin_value open_basedir &quot;/web/wwwroot/null&quot;
#</VirtualHost>
#
# 为了让apache返回头部的信息尽可能少.可以添加 ServerTokens Prod
#
#
mkdir /web/apache/conf/vhosts/
mkdir /web/wwwroot/null/
chmod 777 /web/wwwroot/ -R
chown apache.apache /web/wwwroot/ -R

#如果是SElinux启用,允许加载下面文件:
chcon -t textrel_shlib_t /web/apache/modules/libphp5.so
#chcon -t textrel_shlib_t /web/apache/modules/*.so
# 需要修改PHP的时区.
# 可以修改 /web/php/lib/php.ini  的第 996 行左右 date.timezone = PRC
#
#
# 当然,Apache,PHP,Mysql 还有很多要配置要修改
# 比如,Apache 的 vhost 支持, 禁用文件列表等等
#
# 假如很不幸,你的主机是在天朝,
#     那么,由于某些不可理喻的&quot;龟腚&quot;.
#     您必需过滤掉所有的,未备案的,DNS又指向你服务器的域名!
#     (是不是看得很纠结? 我也有这种感觉.)
#
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install vsftpd
#==============================================================================
# Vsftpd 以安全著称. 我也感觉它挺安全的,
# 嗯,那么,直接用 yum 来安装吧. 省时省力.
yum install vsftpd -y
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install pam-mysql
#==============================================================================
# 需要用到 pam 的开发模块
# 如果没有安装, 用 yum install pam-devel -y 安装就可以了.
cd ${softpath}/
tar zxvf ${softpath}/pam_mysql-0.7RC1.tar.gz
cd ${softpath}/pam_mysql-0.7RC1
./configure --with-mysql=/web/mysql
make
make install
chcon -t textrel_shlib_t /lib/security/pam_mysql.so
echo &quot;/lib/security&quot; >> /etc/ld.so.conf
ldconfig
#==============================================================================
#==============================================================================
#==============================================================================
#=== 配置 vsftpd ,支持虚拟用户
#==============================================================================
# 修改 /etc/vsftpd.conf
#---------------------------------------------------------------------------
#  下面是 Vsftpd 配置文件
#---------------------------------------------------------------------------
#匿名用户登录:
anonymous_enable=NO
#匿名用户上传
anon_upload_enable=NO
#更改匿名用户上传文件属性
anon_umask=000
#匿名用户新建目录
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
#允许本地用户登陆
local_enable=YES
#本地用户文件上传后的属性
local_umask=0666
#可写文件(上传)
#全局配置可写
write_enable=YES
#当使用者转换目录,则会显示该目录下的.message信息
dirmessage_enable=NO
#限制用户在自己的主目录
chroot_local_user=YES
#是否更改上传文件属性
#chown_uploads=YES
#更改文件属主为apache
#chown_username=apache
#文件属性
file_open_mode=0770
#记录使用者所有上传下载信息
xferlog_enable=YES
#将上传下载信息记录到/www/logs/vsftpd.log中
xferlog_file=/www/log/vsftpd.log
#日志使用标准xferlog格式
#xferlog_std_format=YES
#客户端超过600S没有动作就自动被服务器踢出
idle_session_timeout=600
#数据传输时超过120S没有动作被服务器踢出
data_connection_timeout=120
#nopriv_user=ftpsecure
#async_abor_enable=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
#FTP欢迎信息
ftpd_banner=Welcome X.
#banned_email_file=/etc/vsftpd.banned_emails
#chroot_list_file=/etc/vsftpd.chroot_list
#ls_recurse_enable=YES
#监听
#listen_port=21
listen=YES
connect_from_port_20=YES
#使用虚拟用户
guest_enable=YES
#虚拟用户名
guest_username=apache
#pam认证文件
pam_service_name=vsftpd
#用户控制文件目录
user_config_dir=/etc/vsftpd/vuconf
#---------------------------------------------------------------------------
# Vsftpd 的配置文件结束
#---------------------------------------------------------------------------

mkdir /etc/vsftpd/vuconf

#---------------------------------------------------------------------------
# 虚拟用户的配置文件 /etc/vsftpd/vuconf/test
#---------------------------------------------------------------------------
#允许虚拟用户上传文件
write_enable=YES
anon_upload_enable=YES
#允许虚拟用户修改文件名和删除文件
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
#设置上传文件属性,由2组成,具体什么情况我也不是太清楚
#现在上传后是777
#当修改file_open_mode时,跟着这个属性走。(不动anon_umask时)
#暂时OK了!
anon_umask=0000
file_open_mode=0777
#这个好像没用
local_umask=0666
#虚拟用户登录路径
local_root=/web/wwwroot
#---------------------------------------------------------------------------
# 虚拟用户的配置文件结束
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# Pma 认证模板配置 /etc/pam.d/vsftpd
#---------------------------------------------------------------------------
#%PAM-1.0
#auth       required    /lib/security/pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
#auth       required    /lib/security/pam_unix.so shadow nullok
#auth       required    /lib/security/pam_shells.so
#account    required    /lib/security/pam_unix.so
#session    required    /lib/security/pam_unix.so
auth required /lib/security/pam_mysql.so user=vsftpd passwd=vsftpdpasswd host=127.0.0.1 db=vsftpd table=user usercolumn=user passwdcolumn=passwd crypt=0
account required /lib/security/pam_mysql.so user=vsftpd passwd=vsftpdpasswd host=127.0.0.1 db=vsftpd table=user usercolumn=user passedcolumn=passwd crypt=0
#---------------------------------------------------------------------------
# Pma 认证模板配置 结束
# crypt=0, 为不加密, crypt=1, 用Msyql自带的加密函数加密
#---------------------------------------------------------------------------
#
# 如果开启了 SELinux 的话.
# 需要设置一下. 不然会出错 530 错误
#
setsebool -P ftpd_disable_trans 1
chcon -t textrel_shlib_t /lib/security/pam_mysql.so

# 登录mysql
mysql -uroot -p
#---------------------------------------------------------------------------
# 下面SQL 是在 Mysql 中创建数据库等...
#---------------------------------------------------------------------------

-------------------------------------------------------------------------------
-- 创建数据库 `vsftpd`
--
CREATE DATABASE `vsftpd` ;
-------------------------------------------------------------------------------
-- 创建表 `user`
-- 包含两个字段: `user`(主键,唯一值), `passwd`,
--

use vsftpd;
CREATE TABLE IF NOT EXISTS `user`
(
`user` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`passwd` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-------------------------------------------------------------------------------
-- 插入新记录
-- 用户名: test, 密码: test
--
INSERT INTO `vsftpd`.`user`
(`user` ,`passwd`)
VALUES
('test', 'test');
-------------------------------------------------------------------------------
-- 创建Mysql数据库用户
-- vsftpd, 登录IP: 127.0.0.1, 密码:vsftpdpasswd
--
CREATE USER 'vsftpd'@'127.0.0.1' IDENTIFIED BY 'vsftpdpasswd';
GRANT USAGE ON * . * TO 'vsftpd'@'127.0.0.1' IDENTIFIED BY 'vsftpdpasswd' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON `vsftpd` . * TO 'vsftpd'@'127.0.0.1';
-------------------------------------------------------------------------------
#---------------------------------------------------------------------------
# SQL 结束 quit
#---------------------------------------------------------------------------

#同时,需要把 apache 用户的主目录设置为 /web/wwwroot
#==============================================================================
#==============================================================================
#==============================================================================
#=== Install cronolog 用来分割 Apache 日志
#==============================================================================
cd ${softpath}/
tar zxvf ${softpath}/cronolog-1.6.2.tar.gz
cd ${softpath}/cronolog-1.6.2
./configure
make
make install

#==============================================================================
#==============================================================================
#==============================================================================
#=== Install Xcache
#==============================================================================
cd ${softpath}/
tar zxvf ${softpath}/xcache-1.3.0.tar.gz

cd ${softpath}/xcache-1.3.0
/web/php/bin/phpize
./configure --with-php-config=/web/php/bin/php-config --enable-xcache --enable-xcache-optimizer

make
make test
make install
#/web/php/lib/php/extensions/no-debug-zts-20090626/

#编辑 php.ini
vim /web/php/lib/php.ini
#==============================================================================
#添加如下xcache配置信息
#---------------------------------------------------------------------------
[xcache-common]
zend_extension      = /web/php/lib/php/extensions/no-debug-zts-20090626/xcache.so
[xcache.admin]
xcache.admin.user   = &quot;admin&quot;
;密码是由md5计算出来的.
xcache.admin.pass   = &quot;21232f297a57a5a743894a0e4a801fc3&quot;
[xcache]
;缓存大小,视服务内存而定
xcache.size = 256M
xcache.shm_scheme   = &quot;mmap&quot;
; 建议设置为 cpu 数 (cat /proc/cpuinfo |grep -c processor)
xcache.count        = 2
xcache.slots        = 8K
; 缓存项目的 ttl(time to live), 0=永久
xcache.ttl          = 86400
; 扫描过期项目的时间间隔, 0=不扫描, 其他值以秒为单位
xcache.gc_interval  = 3600
xcache.mmap_path    = &quot;/tmp/xcache&quot;
xcache.cacher       = On
xcache.stat         = On
xcache.optimizer    = Off
[xcache.coverager]
xcache.coverager    = On
xcache.coveragedump_directory = &quot;&quot;
[xcache.var]
; 同上, 只是针对变量缓存设置
xcache.var_size  =  200M
xcache.var_count =  2
xcache.var_slots =  8K
xcache.var_ttl   =  1800
#==============================================================================
# 如果开启了 SELinux 的话.
#
chcon -t textrel_shlib_t /web/php/lib/php/extensions/no-debug-zts-20090626/xcache.so
# 拷贝xcache管理工具
cp -r ${softpath}/xcache-1.3.0/admin/ /web/wwwroot/xcachecp
# 重启 apache 服务
service httpd restart
#==============================================================================
#
#  Apache/Mysql等配置的调整和优化略过.
#
#==============================================================================
  转自: http://www.360doc.com/content/11/1225/15/4171006_174867947.shtml
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-141007-1-1.html 上篇帖子: c64xCache 下篇帖子: Freebsd下安装Xcache php加速器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表