LAMPアーキテクチャのワードプレスのバイナリインストール

準備:2つのホスト
。1つはhttpd、phpサービス10.0.0.171
インストールし、もう1つはmariadbサービス10.0.0.181をインストールします。

データベーススクリプト

tar_path = / usr / local
db = https://downloads.mariadb.org/interstitial/mariadb-10.2.27/source/mariadb-10.2.27.tar.gz/from/https%3A//archive.mariadb.org /
indb_path = / data / mysql

useradd -r -s / sbin / nologin mysql
tar xvf $ {db} -C $ {tar_path}
cd $ {tar_path}
ln -sv $ {db%.tar } mysql
cd mysql
chown -R root.root ./

mkdir $ {indb_path} -p
chown -R mysql.mysql $ {indb_path}
mkdir
cp support-files / my-huge.cnf /etc/mysql/my.cnf
vim /etc/mysql/my.cnf
[mysqld]

datadir = $ {indb_path}
skip_name_resolve = ON

vim /etc/profile.d/lamp.sh
PATH = $ {tar_path} / mysql / bin /:$ PATH
/etc/profile.d/lamp.sh
yum install libaio -y
cd $ {tar_path} / mysql; scripts / mysql_install_db --user = mysql --datadir = $ {indb_path}
cp support-files / mysql.server / etc / rc.d / init.d / mysqld
chkconfig --add mysqld
service mysqld start

mysql -urootmysql
>データベースのワードプレスを作成します。

mysql>「123456」で識別されるwordpress @ '10 .0.0。% 'にwordpress。*のすべてを付与します。

httpdスクリプト

#!/ bin / bash
**
#Author:DOU
#Date:2020-10-31
#FileName:install_httpd2.4.sh
#Description:テストスクリプト
**
##プロンプト
情報color
col_start = "\ 033 [32m "
col_end =" \ 033 [0m " #Store
ダウンロードパッケージパス
tar_path = / usr / local / src / #install
path
ins_path = / apps / httpd #related
package
apr = apr-1.7.0.tar.gz
aprutil = apr -util-1.6.1.tar.gz
httpd = httpd-2.4.46.tar.gz

関連パッケージをインストールする

echo -e "$ {col_start}関連パッケージのインストール$ {col_end}"
yum -y install wget gcc make pcre-devel openssl-devel expat-devel

ソースコードをダウンロードして解凍します

echo -e "$ {col_start}ソースコードをダウンロードして$ {col_end}を解凍します"
cd $ {tar_path}
pwd
wget https://mirror.bit.edu.cn/apache//apr/${apr }
wget https: //mirror.bit.edu.cn/apache//apr/${aprutil }
wget https://mirrors.bfsu.edu.cn/apache//httpd/${httpd }

tar xf $ {apr}
tar xf $ {aprutil}
tar xf $ {httpd}

aprおよびapr-utilソースコードをhttpdソースコードと組み合わせ、3つを一緒にコンパイルしてインストールします

echo -e "$ {col_start}编译安装$ {col_end}"
mv $ {apr%.tar } $ {httpd%.tar } / srclib / apr
mv $ {aprutil%.tar } $ {httpd%.tar } / srclib / apr-util
cd $ {httpd%.tar *} /
./configure --prefix = $ {ins_path} --enable-so --enable-ssl --enable-cgi --enable-rewrite --with- zlib --with-pcre --with-included-apr --enable-modules = most --enable-mpms-shared = all --with-mpm = prefork
make -j 2 && make install> / dev / null

apacheアカウントを作成する

echo -e "$ {col_start} Create apache account $ {col_end}"
useradd -r -s / sbin / nologin apache

構成ファイルを変更する

echo -e "$ {col_start}修改配置文件$ {col_end}"
sed -i's / ^ User。/ User apache / '$ {ins_path} /conf/httpd.conf
sed -i' s / ^ Group。
/ Group apache / '$ {ins_path} /conf/httpd.conf

環境変数を構成する

エコー-e "$ {} col_startのconfigureの環境変数$ {} col_end" echo'PATH
= "$ {ins_path} / binに:$ PATH" '> /etc/profile.d/httpd.sh
。を/etc/profile.d /httpd.sh

マンヘルプを構成する

echo -e "$ {col_start} configuration man help $ {col_end}"
echo'MANDATORY_MANPATH $ {ins_path} / man '>> /etc/man_db.conf

サービスユニットファイルを作成し、起動を開始するように設定します

echo -e "$ {col_start}ドキュメント启PIN $ {col_end}"
cat> /lib/systemd/system/httpd.service << EOF
[ユニット]
説明=
ApacheHTTPサーバーAfter = network.target remote-fs.target nss-lookup.target
Documentation = man:httpd(8)
Documentation = man:apachectl(8)
[Service]
Type = forking
ExecStart = $ {ins_path} / bin / apachectl start
ExecReload = $ {ins_path} / bin / apachectl
graceful ExecStop = $ {ins_path} / bin / apachectl stop

systemdがhttpdを正常に終了するための時間を与えたいのですが、それでも

間に何か問題が発生した場合、TimeoutStopSecの後にhttpdを強制終了します

優雅な停止。通常、SystemdはSIGTERMシグナルを

httpdを強制終了するExecStop。役に立たないSIGCONTをここに送って

httpd終了時間。

KillSignal = SIGCONT
PrivateTmp = TRUE
[インストール]
WantedBy = multi-user.target
EOF
systemctlデーモンリロード
systemctl有効--now httpd.service

### php、ワードプレススクリプト

#!/ bin / bash

* ****

著者:DOU

日付:2020-10-31

ファイル名:install_httpd2.4.sh

説明:テストスクリプト

* ****

プロンプトメッセージの色

col_start = "\ 033 [32m"
col_end = "\ 033 [0m"

ストアダウンロードパッケージパス

tar_path = / usr / local / src /

httpdパスをインストールします

ins_path = / apps / httpd

関連パッケージ

apr = apr-1.7.0.tar.gz
aprutil = apr-util-1.6.1.tar.gz
httpd = httpd-2.4.46.tar.gz

関連パッケージをインストールする

echo -e "$ {col_start}関連パッケージのインストール$ {col_end}"
yum -y install wget gcc make pcre-devel openssl-devel expat-devel

ソースコードをダウンロードして解凍します

echo -e "$ {col_start}ソースコードをダウンロードして$ {col_end}を解凍します"
cd $ {tar_path}
pwd
wget https://mirror.bit.edu.cn/apache//apr/${apr }
wget https: //mirror.bit.edu.cn/apache//apr/${aprutil }
wget https://mirrors.bfsu.edu.cn/apache//httpd/${httpd }

tar xf $ {apr}
tar xf $ {aprutil}
tar xf $ {httpd}

aprおよびapr-utilソースコードをhttpdソースコードと組み合わせ、3つを一緒にコンパイルしてインストールします

echo -e "$ {col_start}编译安装$ {col_end}"
mv $ {apr%.tar } $ {httpd%.tar } / srclib / apr
mv $ {aprutil%.tar } $ {httpd%.tar } / srclib / apr-util
cd $ {httpd%.tar *} /
./configure --prefix = $ {ins_path} --enable-so --enable-ssl --enable-cgi --enable-rewrite --with- zlib --with-pcre --with-included-apr --enable-modules = most --enable-mpms-shared = all --with-mpm = prefork
make -j 2 && make install> / dev / null

apacheアカウントを作成する

echo -e "$ {col_start} Create apache account $ {col_end}"
useradd -r -s / sbin / nologin apache

構成ファイルを変更する

echo -e "$ {col_start}修改配置文件$ {col_end}"
sed -i's / ^ User。/ User apache / '$ {ins_path} /conf/httpd.conf
sed -i' s / ^ Group。
/ Group apache / '$ {ins_path} /conf/httpd.conf

環境変数を構成する

エコー-e "$ {} col_startのconfigureの環境変数$ {} col_end" echo'PATH
= "$ {ins_path} / binに:$ PATH" '> /etc/profile.d/httpd.sh
。を/etc/profile.d /httpd.sh

マンヘルプを構成する

echo -e "$ {col_start} configuration man help $ {col_end}"
echo'MANDATORY_MANPATH $ {ins_path} / man '>> /etc/man_db.conf

サービスユニットファイルを作成し、起動を開始するように設定します

echo -e "$ {col_start}ドキュメント启PIN $ {col_end}"
cat> /lib/systemd/system/httpd.service << EOF
[ユニット]
説明=
ApacheHTTPサーバーAfter = network.target remote-fs.target nss-lookup.target
Documentation = man:httpd(8)
Documentation = man:apachectl(8)
[Service]
Type = forking
ExecStart = $ {ins_path} / bin / apachectl start
ExecReload = $ {ins_path} / bin / apachectl
graceful ExecStop = $ {ins_path} / bin / apachectl stop

# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.

KillSignal = SIGCONT
PrivateTmp = TRUE
[インストール]
WantedBy = multi-user.target
EOF
systemctlデーモンリロード
systemctl有効--now httpd.service

テストは次のとおりです

LAMPアーキテクチャのワードプレスのバイナリインストール

LAMPアーキテクチャのワードプレスのバイナリインストール

LAMPアーキテクチャのワードプレスのバイナリインストール

LAMPアーキテクチャのワードプレスのバイナリインストール

LAMPアーキテクチャのワードプレスのバイナリインストール

LAMPアーキテクチャのワードプレスのバイナリインストール

おすすめ

転載: blog.51cto.com/13812780/2546076