1、源碼編譯安裝LNMP架構環境;
yum groupinstall -y ‘Development Tools’ ‘Server Platform Development’
- 編譯nginx
~]# yum install -y openssl-devel pcre-devel ~]# useradd nginx ~]# ./configure --prefix=/usr/local/nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ --user=nginx \ --group=nginx ~]# make && make install
- 編譯mariadb
(1) cmake-2.8.8 ./configure && make && make install (2) mariadb useradd mysql cmake . -LH 預編譯下 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/data/mysql \ -DSYSCONFIGDIR=/etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DWITH_LIBWRAP=0 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci make && make install 初始化數據 ./mysql_db_install --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql 加載庫和頭文件 vim /etc/ld.so.conf.d/mariadb.conf ldconfig ln -s /usr/local/mariadb/include /usr/include/mysql
- 編譯php
3、php-7.1.3 useradd www ./configure --prefix=/usr/local/php \ --sysconfdir=/usr/local/php/etc \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql=/usr/local/mariadb \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip make && make install
2、編寫一個腳本完成以下功能:
- (1)、一鍵搭建LNMP源碼編譯環境;
- (2)、可通過在腳本后面跟上一些參數來自定義安裝目錄等其他選項
#!/bin/bash #install pre packages yum groupinstall -y 'Development Tools' 'Server Platform Development' openssl-devel pcre-devel echo "Usage: $0 [nginx_install] [mariadb_install] [php_install]" nginx_install=${1:-/usr/local/nginx} mariadb_install=${2:-/usr/local/mariadb} php_install=${3:-/usr/local/php} #install nginx useradd nginx tar xf nginx.tar.gz cd nginx ./configure --prefix=${nginx_install} \ --with-http_stub_status_module \ --with-http_ssl_module \ --user=nginx \ --group=nginx make && make install cd $nginx_install/sbin ./nginx #install mariadb useradd mariadb tar xf cmake.tar.gz cd cmake ./configure && make && make install tar ../mariadb.tar.gz cd ../mariadb cmake . -LH cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install} \ -DMYSQL_DATADIR=/data/mysql \ -DSYSCONFIGDIR=/etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DWITH_LIBWRAP=0 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci make && make install cd $mariadb_install/scripts ./mysql_db_install --basedir=/usr/local/mysql --datadir=/data/mysql --user=mariadb echo $mariadb_install > /etc/ld.so.conf.d/mariadb.conf ldconfig ln -s $mariadb_install/include /usr/include/mysql #install php useradd www tar xf php.tar.gz ./configure --prefix=${php_install} \ --sysconfdir=/usr/local/php/etc \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql=${mariadb_install} \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip make && make install
原創文章,作者:N25_隨心,如若轉載,請注明出處:http://www.www58058.com/74806
寫的很好,如果可以把參數解釋一下的話會更好