1、关闭防火墙
vim /etc/sysconfig/selinux service iptables stop chkconfig iptables off
yum update yum groupinstall 'Development Tools' yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
mkdir -p /home/data/soft mkdir -p /home/data/logs mkdir -p /home/data/mysql/data cd /home/data/soft scp -i /root/.ssh/id_rsa_test13 -P 38383 coolyou@114.112.192.13:/home/data/soft/* ./ #从远程下载安装包
安装mysql
yum install cmake useradd -s /sbin/nologin mysql tar zxvf mysql-5.6.19.tar.gz cd mysql-5.6.19 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=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=/home/data/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 make make install chown -R mysql:mysql /usr/local/mysql/ cp support-files/mysql.server /etc/init.d/mysqld vi /etc/init.d/mysqld basedir=/usr/local/mysql datadir=/home/data/mysql/data chmod +x /etc/init.d/mysqld chkconfig --level 235 mysqld on rm -rf /etc/my.cnf ,删除配置文件,不删除初使化会报错 rm -rf /usr/local/mysql/my.cnf /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/home/data/mysql/data --user=mysql ,初使化mysql会在安装目录生成配置文件 mkdir /var/lib/mysql ,创建目录 ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock ,创建软链接,不创建进入mysql报错(my.cnf里指定sock目录就不需要软链接) vi /usr/local/mysql/my.cnf :添加指定安装目录、数据目录 vi /etc/porfile PATH=$PATH:/usr/local/mysql/bin source /etc/profile service mysqld restart
安装nginx
yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make install
cd ..
tar zxvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config --prefix=/usr/local/openssl
make
make install
cd ..
vim /etc/profile
source /etc/profile
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make
make install
yum install glibc.i686
yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64 gcc-c++
yum install git
cd ..
tar zxvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
cd ..
git clone git://git.videolan.org/x264
cd x264/
./configure --enable-shared
make
make install
cd ..
tar zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-nasm
make
make install
cd ..
tar zxvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure
make
make install
cd ..
tar zxvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure
make
make install
cd ..
tar jxvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
./configure --enable-shared
make
make install
cd ..
tar zxvf faad2-2.7.tar.gz
cd faad2-2.7
./configure
make
make install
cd ..
tar zxvf faac-1.28.tar.gz
cd faac-1.28/common/mp4v2/
vim mpeg4ip.h
从123行开始修改此文件mpeg4ip.h,到129行结束。
修改前:
#ifdef __cplusplus
extern "C"{
#endif
char*strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
修改后:
#ifdef __cplusplus
extern"C++" {
#endif
const char*strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
cd ..
./configure
make
make install
cd ..
tar zxvf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic/
./configure
make
make install
cd ..
git clone git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --prefix=/usr/local/ffmpeg/ --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads
make
make install
cd ..
vi /etc/ld.so.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/usr/local/ffmpeg/lib
#idconfig
ldconfig
tar zxvf nginx-1.6.0.tar.gz
useradd -s /sbin/nologin www
scp -r -i /root/.ssh/id_rsa_test13 -P 38383 coolyou@114.112.192.13:/home/data/soft/nginx_mod* ./
vi nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c ,删除if (r->zero_in_uri)这一行
scp -r -i /root/.ssh/id_rsa_test13 -P 38383 coolyou@114.112.192.13:/home/data/soft/nginx-rtmp* ./
cd nginx-1.6.0
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/home/data/soft/openssl-1.0.1h --with-zlib=/home/data/soft/zlib-1.2.8 --with-pcre=/home/data/soft/pcre-8.35 --add-module=/home/data/soft/nginx_mod_h264_streaming-2.2.7 --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --add-module=/home/data/soft/nginx-rtmp-module
make
make install
cd ..
vim /etc/init.d/nginx
chmod +x /etc/init.d/nginx
chkconfig nginx --level 235 on
service nginx restart
安装PHP
tar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure make make install cd .. tar zxvf tiff-4.0.3.tar.gz cd tiff-4.0.3 ./configure --prefix=/usr/local/tiff --enable-shared make make install cd .. tar xvf libpng-1.6.16.tar cd libpng-1.6.16 ./configure --prefix=/usr/local/libpng --enable-shared make make install cd .. tar zxvf freetype-2.5.5.tar.gz cd freetype-2.5.5 报错make: Nothing to be done for `unix' make clean ./configure --prefix=/usr/local/freetype --enable-shared make make install cd .. tar zxvf jpegsrc.v9a.tar.gz cd jpeg-9a/ ./configure --prefix=/usr/local/jpeg --enable-shared make make install cd .. tar zxvf libgd-2.1.0.tar.gz cd libgd ./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with- fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx make make install cd .. tar zxvf t1lib-5.1.2.tar.gz cd t1lib-5.1.2 ./configure --prefix=/usr/local/t1lib --enable-shared make without_doc make install ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so cp -frp /usr/lib64/libXpm.so* /usr/lib/ cd .. tar zxvf php-5.5.28.tar.gz cd php-5.5.28 export LD_LIBRARY_PATH=/usr/local/libgd/lib ./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-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype make make install cp php.ini-production /usr/local/php/etc/php.ini ,创建配置文件 cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm ,创建启动脚本 chmod +x /etc/init.d/php-fpm ,添加执行权限 chkconfig php-fpm on ,添加开机启动 cp sapi/fpm/php-fpm.conf /usr/local/php/etc/ ,创建php-fpm配置文件 service php-fpm start
vi index.php <?php phpinfo(); ?> ,测试PHP解析