演習:リモート接続クライアントインストールPHP + tengine、
まず、スクリプト8を使用する必要はリモートIPを取得し、リモートマシンに公開鍵を押し。
第二に、次のディレクトリ構造を作成します
1.lnmp.sh
-------------------------------------------------- ----
LNMP
├──のconf
│├──index.phpを
│├──nginx.conf
│└──PHP-fpm.conf
├──には、
│├──config.sh
│├──init_os.sh
│├──nginx_install.sh
│└──php_install.sh
├──installrc
├──lnmp.sh
└──SRC
├──PHP-7.2.6.tar.bz2
└──tengine-2.3.0.tar.gz
第三に、それぞれのスクリプト
#!/ binに/ bashの
##### LNMPメインプログラム
### 2019年6月8日######
soft_dir = `pwd`は/ SRC
CONFIG_DIR = `pwd`は/ confに
CPU = `lscpu |のawk '/ ^ CPUの\(S \)/ {$ 2印刷}'`
。installrc
。含める/ init_os.sh
。含める/ nginx_install.sh
。/ php_install.shを含めます
。/ config.shを含めます
init_os
nginx_install
php_install
コンフィグ
2.init_os.sh
#!/ binに/ bashの
####熱OS #########
### YUM ########
init_os(){
RM -rf /etc/yum.repos.d/*
wgetの-O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
wgetの-O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yumのキャッシュ&& yumをrepolistを作ります
#### SELinuxの########
systemctl無効にfirewalld
systemctlストップfirewalld
#ファイアウォール-CMD --permanent --add-サービス= HTTP
#ファイアウォール-CMD --permanent --add-サービス= HTTPS
#ファイアウォール-CMD --reload
setenforce 0
-riのsed '/ ^ SELINUX = / cSELINUX =無効' に/ etc / selinuxを/ configに
#NTP
yumをchronyをインストール-y
SED -ri '/3.CentOS.pool.ntp.oeg/a\server pool.ntp.org iBurstは好む' /etc/chrony.conf
chronyd開始systemctl
chronydを有効systemctl
}
3.nginx_install.sh
#!/ binに/ bashの
#
スクリプトをインストール#tengine
#byダン・チェン2019年6月8日
nginx_install(){
yumを-yのgccはgcc-C ++のopenssl-develののPCRE-develのインストール
useraddのnginxの
CDの$のsoft_dir
タールXF $ tengine_version
CD $ {tengine_versionの%の.tar.gzの}
./configureを&& make installを&& -j $のCPUを作ります
エコー "$ nginx_prefix / sbinに/ nginxの" >> /etc/rc.localの
chmod A + X /etc/rc.d/rc.localの
エコー "輸出PATH = $ PATH:$ nginx_prefix / sbinに" >> / etc / profileを
ソースは/ etc / profile
}
4.php_install.sh
#!/ binに/ bashの
#
## PHPスクリプトをインストール
php_install(){
YUMのlibjpegのlibjpeg-develのののlibpngのlibpng-develののFreeTypeのFreeType-develのインストール-y \
libxmlのlibxml-develのlibcurlのlibcurlの-develのlibxsltは-のdevel opensslの-develの
CDの$のsoft_dir
タールXFの$ PHP_VERSION
CD $ {PHP_VERSIONの%の.tar.bz2と}
./configure --prefix = $ php_prefix --with-カール--with-freetypeの-dirの--with-gdの--with-gettextの--with-iconvの-dirの\
--with-JPEG-dirの--with-libdirを= lib64に--with-のlibxml-dirの--with-mysqlの--with-mysqliの--with-kerberosの\
--with-opensslの--with-PCRE正規表現-PDO --with-mysqlの--with-PDO-sqliteの--with-梨--with-PNG-dirの\
--with-XMLRPC --with-XSL --with-zlibを--enable-FPM --enable-bcmath --enable-のlibxml \
--enable-インライン最適化--enable-GD-ネイティブ-TTF --enable-mbregex --enable-mbstringの--enable-opcache \
--enable-PCNTL --enable-SHMOP --enable-ソケット--enable-SYSVSEM --enable-XML --enable-ZIP
-jの$のCPUを作る&& make installを
CP $ php_prefixの/ etc / PHP-fpm.conf.default $ php_prefixの/ etc / PHP-fpm.conf
CP牛/ FPM / init.d.php-FPM /etc/rc.d/init.d/php-fpm
chmod A + X /etc/rc.d/init.d/php-fpm
chkconfigを--add PHP-FPM
}
5.config.sh
#!/ binに/ bashの
#config confに
設定(){
#tengine
\ CP $ CONFIG_DIR / nginx.conf $ nginx_prefix / confに/ nginx.conf
\ CP $ CONFIG_DIR / index.phpを$ nginx_prefix / HTML / index.phpを
\ CP $ php_prefixの/ etc / PHP-fpm.d / www.conf.default $ php_prefixの/ etc / PHP-fpm.d / www.conf
$ nginx_prefix / sbinに/ nginxの
/etc/init.d/php-fpm開始
}
6.installrc
#!/ binに/ bashの
#config confに
設定(){
#tengine
\ CP $ CONFIG_DIR / nginx.conf $ nginx_prefix / confに/ nginx.conf
\ CP $ CONFIG_DIR / index.phpを$ nginx_prefix / HTML / index.phpを
\ CP $ php_prefixの/ etc / PHP-fpm.d / www.conf.default $ php_prefixの/ etc / PHP-fpm.d / www.conf
$ nginx_prefix / sbinに/ nginxの
/etc/init.d/php-fpm開始
}
要約:
1.主にシェル関数を使用して、本実施形態では、メインプログラムlnmp.sh入口における関数呼び出しは、インストール・プロセスは、おそらく約20分
この例では、MySQLデータベースがインストールされていない2、通常のMySQLは複数の高設定のサーバおよびクラスタに個別にインストールされている理由は、少し良く作られた、興味の友達はMySQL Clusterの構造を完成しようとすることができます。
結果:
#ssの[ノード1など@ルート] -tnl
国家のRecv-Q送る-Qをローカルアドレス:ポートピアアドレス:ポート
LISTEN 0 128 * 80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
* 0 128 127.0.0.1:9000 LISTEN:*
LISTEN 0 128 ::: 22 ::: *
LISTEN 0 100 :: 1:25 ::: *