中小型规模网站集群架构:yum仓库搭建
: Ago-linux运维群:93324526
编译的三条命令的规则
./configure 就是在本地创建了一个Makefile文件 (也就是指定一下各种配置参数)make 就是在执行Makefile这个文件里的内容。生成文件在源码包make install 把make生成的文件 移动到指定的目录下面 没指定就默认/usr/local超链已经有了nginx的搭建
LNMP的搭建
1.Nginx-1.10.2搭建
#1.安装依赖包yum install -y pcre-devel openssl-devel #2.下载源码包wget http://nginx.org/download/nginx-1.10.2.tar.gz#3.创建www用户useradd -s /sbin/nologin -M www#4.编译安装./configure --user=www --group=www --prefix=/application/nginx-1.10.2 --with-http_stub_status_module --with-http_ssl_modulemakemake install#5.创建软链ln -s nginx-1.10.2/ nginx
2.php-5.5.32搭建
cd /server/files#1.安装依赖包yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel openssl-devel -yyum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y#2.安装字符集转换库---libiconv wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar zxf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmake && make install#3.安装其它相关程序---libmcryptwget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repoyum -y install libmcrypt-devel mhash mcryptrpm -qa libmcrypt-devel mhash mcrypt #4.编译安装wget http://tw1.php.net/distributions/php-5.5.32.tar.gztar xf php-5.5.32.tar.gzcd php-5.5.32./configure --prefix=/application/php-5.5.32 \--with-mysql=mysqlnd \--with-pdo-mysql=mysqlnd \--with-iconv-dir=/usr/local/libiconv \--with-freetype-dir \--with-jpeg-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-mcrypt \--with-gd \--enable-gd-native-ttf \--with-openssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-soap \--enable-short-tags \--enable-static \--with-xsl \--with-fpm-user=www \--with-fpm-group=www \--enable-ftp \--enable-opcache=no可能出现问题解决:ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/touch ext/phar/phar.pharmake && make installln -s /application/php-5.5.32/ /application/php#5.配置文件的复制cp php.ini-production /application/php/lib/php.inicd /application/php/etc/cp php-fpm.conf.default php-fpm.conf
需要在本地使用mysql的话请编译时,改此参数
--with-mysql=mysql路径3.MySQL搭建.使用二进制安装
#1.下载安装包cd /server/fileswget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.6/mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz#2.安装,并创建用户和授权tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gzmv mysql-5.6.34-linux-glibc2.5-x86_64 /application/mysql-5.6.34ln -s /application/mysql-5.6.34/ /application/mysqluseradd mysql -M -s /sbin/nologin -u 899chown -R mysql.mysql /application/mysql#3.初始化数据库cd /application/mysql./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/#4.修改启动文件\cp support-files/mysql.server /etc/init.d/mysqldsed -i 's#/usr/local/mysql#/application/mysql#g' /etc/init.d/mysqldsed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe#5.复制配置文件并启动\cp /application/mysql/my.cnf /etc/my.cnf/etc/init.d/mysqld start
rpm包制作
1.php
单独打包libiconv和在php安装之前先安装一下libiconv
ini和php-fpm.conf两个文件记得先移动再打包
vi /server/scripts/after_php.sh#!/bin/shln -s /application/php-5.5.32 /application/phpfpm -s dir -t rpm -n php -v 5.5.32 -d 'libmcrypt-devel mhash mcrypt zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel openssl-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel' --after-install /server/scripts/after_php.sh -f /application/php-5.5.32/
2.MySQL
vi /server/scripts/mysql_rpm.shuseradd mysql -M -s /sbin/nologin -u 899chown -R mysql.mysql /application/mysql*cd /application/mysql./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/\cp support-files/mysql.server /etc/init.d/mysqldsed -i 's#/usr/local/mysql#/application/mysql#g' /etc/init.d/mysqldsed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe#5.复制配置文件并启动\cp /application/mysql/my.cnf /etc/my.cnf/etc/init.d/mysqld startfpm -s dir -t rpm -n mysql -v 5.6.34 --post-install /server/scripts/mysql_rpm.sh -f /application/mysql-5.6.34/
3.sersync制作
1-配置文件
2脚本编写
vi /server/scripts/sersync_rpm.sh#!/bin/sh/usr/local/sersync/bin/sersync -d -r -o /usr/local/sersync/conf/confxml.xmlecho '/usr/local/sersync/bin/sersync -d -r -o /usr/local/sersync/conf/confxml.xml' >> /etc/rc.local
3-rpm制作
fpm -s dir -t rpm -n sersync -v 1.1 --post-install /server/scripts/sersync_rpm.sh -f /usr/local/sersync