`

Fedora13 x86_64环境下搭建 nginx 0.8.x + PHP 5.3.3 (php-fpm) + MySQL 5.5.3-m3 服务器

阅读更多
最近,有些朋友一直在问怎么在Fedora13 x86_64环境下搭建 nginx 0.8.x + PHP 5.3.3 (php-fpm) + MySQL 5.5.3-3,编译过程总出错,不知道怎么办,这里分享一下我的经验,供需要的朋友交流经验。

一、获取相关开源程序:

yum -y install gcc gcc-c++ autoconf automake libtool
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers


二、下载程序源码包
mkdir -p /web/soft
cd /web/soft

wget http://nginx.org/download/nginx-0.8.52.tar.gz
wget http://cn.php.net/get/php-5.3.3.tar.bz2/from/this/mirror
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.3-m3.tar.gz/from/http://mysql.he.net/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0
wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0
wget http://pecl.php.net/get/memcache-2.2.5.tgz
wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
wget http://pecl.php.net/get/imagick-2.3.0.tgz
wget http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz


三、安装支持库
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
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
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

tar zxvf libevent-1.4.14b-stable.tar.gz
cd cd libevent-1.4.14b-stable
./configure --prefix=/usr/local
make && make install


四、安装MySQL

1、编译安装MySQL 5.5.3-m3
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.5.3-m3.tar.gz
cd mysql-5.5.3-m3/
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make && make install
chmod +w /usr/local/webserver/mysql
chown -R mysql:mysql /usr/local/webserver/mysql
cd ../

2、创建MySQL数据库存放目录
mkdir -p /web/mysql/3306/data/
mkdir -p /web/mysql/3306/binlog/
mkdir -p /web/mysql/3306/relaylog/
chown -R mysql:mysql /web/mysql/

3、以mysql用户帐号的身份建立数据表
/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/web/mysql/3306/data --user=mysql

4、创建my.cnf配置文件
vi /data0/mysql/3306/my.cnf

输入以下内容:
[client]
character-set-server = utf8
port = 3306
socket = /tmp/mysql.sock

[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/webserver/mysql
datadir = /data0/mysql/3306/data
log-error = /data0/mysql/3306/mysql_error.log
pid-file = /data0/mysql/3306/mysql.pid
open_files_limit = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /data0/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /data0/mysql/3306/relaylog/relaylog
relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
relay-log = /data0/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

interactive_timeout = 120
wait_timeout = 120

skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

#master-host = 192.168.1.2
#master-user = username
#master-password = password
#master-port = 3306

server-id = 1

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

#log-slow-queries = /data0/mysql/3306/slow.log
#long_query_time = 10

[mysqldump]
quick
max_allowed_packet = 32M



5、创建管理MySQL数据库的shell脚本
#!/bin/sh

mysql_port=3306
mysql_username="admin"
mysql_password="12345678"

function_start_mysql()
{
printf "Starting MySQL...\n"
/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null &
}

function_stop_mysql()
{
printf "Stoping MySQL...\n"
/usr/local/webserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
}

function_restart_mysql()
{
printf "Restarting MySQL...\n"
function_stop_mysql
sleep 5
function_start_mysql
}

function_kill_mysql()
{
kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')
kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{printf $2}')
}

if [ "$1" = "start" ]; then
function_start_mysql
elif [ "$1" = "stop" ]; then
function_stop_mysql
elif [ "$1" = "restart" ]; then
function_restart_mysql
elif [ "$1" = "kill" ]; then
function_kill_mysql
else
printf "Usage: /data0/mysql/${mysql_port}/mysql {start|stop|restart|kill}\n"
fi

6、赋予shell脚本可执行权限
chmod +x /data0/mysql/3306/mysql

7、启动MySQL
/data0/mysql/3306/mysql start

8、通过命令行登录管理MySQL服务器(提示输入密码时直接回车)
/usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

9、输入以下SQL语句,创建一个具有root权限的用户(admin)和密码(12345678)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'sa';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'sa';

10、停止MySQL
/web/mysql/3306/mysql stop


[b]五、安装PHP[\b]
1、编译PHP
tar zxvf php-5.2.14.tar.gz
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
cd php-5.2.14/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/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-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --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 ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini
cd ../

[b]未完待续[\b]
分享到:
评论

相关推荐

    compat-libstdc++-33-3.2.3(x86_64)

    在Linux环境中安装Oracle 11g时,会遇到一些特定的依赖性问题,这正是“compat-libstdc++-33-3.2.3(x86_64)”这个软件包的角色所在。它是一个兼容性库,旨在解决Oracle 11g在64位Linux系统上运行时对旧版libstdc++库...

    mysql-8.0.28-1.el7.x86-64.rpm-bundle.tar

    总之,`mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar` 是一个用于在Linux环境下安装MySQL 8.0.28的打包文件,涵盖了从基础安装到复杂配置和分布式部署所需的所有组件。理解和掌握MySQL的使用、配置和维护对于任何涉及...

    google-chrome-stable_current_x86_64.rpm

    谷歌浏览器离线安装包google-chrome-stable_current_x86_64.rpm,版本 91.0.4472.164(正式版本) 64 位 .rpm(适用于 Fedora/openSUSE)系统。

    Fedora64位操作系统 Fedora-Workstation-Live-x86_64

    Fedora-Workstation-Live-x86_64-26-1.5.iso 网盘下载链接 确保资源可用

    CentOS-7-x86_64-Minimal-1810.iso镜像

    **标题与描述解析** 标题中的"CentOS-7-x86_64-Minimal-1810....综上所述,"CentOS-7-x86_64-Minimal-1810.iso"镜像文件是为64位架构设计的轻量级CentOS 7版本,适用于需要稳定、安全且灵活的服务器环境的运维工作。

    libcgroup-0.41-19.el8.x86_64.rpm

    docker-ce-19.03.8-3.el7.x86_64.rpm docker-ce-cli-19.03.8-3.el7.x86_64.rpm containerd.io-1.2.6-3.3.el7.x86_64.rpm (别人已上传所以我上传不了) libcgroup-0.41-19.el8.x86_64.rpm 为了不麻烦你们在Linux解压...

    mysql-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm

    MySQL是世界上最受欢迎的开源数据库系统之一,而`mysql-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm`是一个针对Linux操作系统的MySQL共享兼容库安装包,特别设计用于GLIBC 2.5环境下的x86_64架构。...

    mysql-5.7.29-1.el7.x86_64.rpm-bundle.zip

    在标签部分,"mysql-community-"的重复可能是由于格式问题,正常情况下,这应该是"mysql-community-server", "mysql-community-client", "mysql-community-devel"等,分别代表MySQL社区版的服务器、客户端和开发库...

    mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz

    `mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz`是主要的安装文件,解压后将提供所有必要的MySQL服务器组件和客户端工具。`tar.gz`是一个常见的Linux归档格式,用`tar`命令提取,然后用`gzip`解压。解压后,你需要...

    Fedora-Workstation-Live-x86_64-40-1.14.iso.002

    Fedora-Workstation-Live-x86_64-40-1.14.iso.002

    net-tools.x86_64.rar

    标题中的"net-tools.x86_64.rar"表明这是一个针对x86_64架构的Linux系统的网络工具压缩包,而"2.0-0.25.20131004git.el7.x86_64.rpm"是该版本net-tools的具体标识,其中"el7"代表它适用于Red Hat Enterprise Linux 7...

    google-chrome-stable_current_x86_64.rpm.zip

    标题中的"google-chrome-stable_current_x86_64.rpm.zip"是一个压缩包文件,它包含的是Google Chrome浏览器的稳定版本(stable)的x86_64(64位)版本的安装包。RPM是Red Hat Package Manager的缩写,是一种在Linux...

    LibreOffice_7.0.1_Linux_x86-64_rpm.tar.gz

    6. **安装过程**:在Linux环境下,用户需要先使用`tar -zxvf LibreOffice_7.0.1.2_Linux_x86-64_rpm.tar.gz`命令解压文件,然后通过`cd`命令进入解压后的目录,最后运行`sudo rpm -ivh *.rpm`来安装RPM包。...

    MySQL-5.6.30-1.linux_glibc2.5.x86_64.rpm-bundle

    根据提供的文件标题、描述、标签以及部分内容链接,我们可以推断出该文件主要涉及的是MySQL数据库管理系统的一个特定版本的安装包,即MySQL 5.6.30-1针对Linux环境(特别是基于glibc 2.5版本)的x86_64架构的RPM包。...

    sshpass-1.0.6-1.el7.x86_64.rpm

    标题中的"sshpass-1.0.6-1.el7.x86_64.rpm"是一个Linux软件包的名称,它包含了sshpass工具的版本信息。这个工具是为了解决SSH(Secure Shell)连接时需要手动输入密码的问题而设计的。SSH是一种网络协议,用于在不...

    gcc 4.4.7-4.el6.x86_64安装包

    6. `libstdc++-4.4.7-4.el6.x86_64.rpm`:这是GCC的C++标准库,包含了实现C++标准库的动态和静态库文件。 7. `mpfr-2.4.1-6.el6.x86_64.rpm`:MPFR是一个浮点数库,提供任意精度的浮点运算,它在GCC中用于高精度计算...

    virtuoso-opensource.x86_64-generic_glibc25-linux-gnu.tar.gz

    2. **x86_64**: 这表明该软件包是为64位(x86_64架构)的处理器设计的,意味着它可以在大多数现代64位Linux发行版上运行,如Ubuntu、CentOS、Fedora等。 3. **generic_glibc25**: "glibc25"指的是GNU C库的第2.5...

    Fedora-Workstation-Live-x86_64-40-1.14.iso.001

    Fedora-Workstation-Live-x86_64-40-1.14.iso.001

    agent.installer.linux.gtk.x86_64_1.8.3000.20150606_0047.zip

    标题 "agent.installer.linux.gtk.x86_64_1.8.3000.20150606_0047.zip" 暗示这是一款针对Linux系统的64位GTK界面的软件安装代理程序,版本号为1.8.3000,发布日期为2015年6月6日,具体时间是0047。此文件可能是一个...

Global site tag (gtag.js) - Google Analytics