Instalação binária do Word Press da arquitetura LAMP

Preparação: Dois hosts,
um instala o serviço httpd, php 10.0.0.171
e o outro instala o serviço mariadb 10.0.0.181

Script de banco de dados

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
serviço mysqld mysqld start

mysql -uroot
mysql> criar banco de dados wordpress;

mysql> conceder tudo no wordpress. * para wordpress@'10.0.0.% 'identificado por "123456";

script httpd

#! / bin / bash
# **
#Author: DOU
#Date: 2020-10-31
#FileName: install_httpd2.4.sh
#Description: O script de teste
# **
# #Prompt
information color
col_start = "\ 033 [32m "
col_end =" \ 033 [0m " #Store
download package path
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

Instale pacotes relacionados

echo -e "$ {col_start} Instalar pacotes relacionados $ {col_end}"
yum -y instalar wget gcc make pcre-devel openssl-devel expat-devel

Baixe o código-fonte e descompacte

echo -e "$ {col_start} baixe o código-fonte e descompacte $ {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}

Combine o código-fonte apr e apr-util com o código-fonte httpd, compile e instale os três juntos

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 = mais --enable-mpms-shared = all --with-mpm = prefork
make -j 2 && make install> / dev / null

Crie uma conta apache

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

Modifique o arquivo de configuração

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

Configurar variáveis ​​de ambiente

echo -e "$ {col_start} configurar variáveis ​​de ambiente $ {col_end}" echo'PATH
= "$ {ins_path} / bin: $ PATH" '> /etc/profile.d/httpd.sh
. /etc/profile.d /httpd.sh

Configurar ajuda do homem

echo -e "homem de configuração $ {col_start} ajuda $ {col_end}"
echo'MANDATORY_MANPATH $ {ins_path} / man '>> /etc/man_db.conf

Crie um arquivo de unidade de serviço e defina a inicialização para começar

echo -e "$ {col_start} 设置 开机 启动 $ {col_end}"
cat> /lib/systemd/system/httpd.service << EOF
[Unit]
Description = O servidor HTTP Apache
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

Queremos que o systemd dê ao httpd algum tempo para terminar normalmente, mas ainda queremos

para matar httpd após TimeoutStopSec se algo der errado durante o

parada graciosa. Normalmente, o Systemd envia o sinal SIGTERM logo após o

ExecStop, que mataria o httpd. Estamos enviando SIGCONT inútil aqui para dar

hora de terminar httpd.

KillSignal = SIGCONT PrivateTmp =
true
[Instalar]
WantedBy = multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now httpd.service

### php, script wordpress

#! / bin / bash

* ****

autor: DOU

data: 31/10/2020

fileName: install_httpd2.4.sh

descrição: o script de teste

* ****

#

Cor da mensagem de prompt

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

Caminho do pacote de download da loja

tar_path = / usr / local / src /

Instale o caminho httpd

ins_path = / apps / httpd

Pacotes relacionados

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

Instale pacotes relacionados

echo -e "$ {col_start} Instalar pacotes relacionados $ {col_end}"
yum -y instalar wget gcc make pcre-devel openssl-devel expat-devel

Baixe o código-fonte e descompacte

echo -e "$ {col_start} baixe o código-fonte e descompacte $ {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}

Combine o código-fonte apr e apr-util com o código-fonte httpd, compile e instale os três juntos

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 = mais --enable-mpms-shared = all --with-mpm = prefork
make -j 2 && make install> / dev / null

Crie uma conta apache

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

Modifique o arquivo de configuração

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

Configurar variáveis ​​de ambiente

echo -e "$ {col_start} configurar variáveis ​​de ambiente $ {col_end}" echo'PATH
= "$ {ins_path} / bin: $ PATH" '> /etc/profile.d/httpd.sh
. /etc/profile.d /httpd.sh

Configurar ajuda do homem

echo -e "homem de configuração $ {col_start} ajuda $ {col_end}"
echo'MANDATORY_MANPATH $ {ins_path} / man '>> /etc/man_db.conf

Crie um arquivo de unidade de serviço e defina a inicialização para começar

echo -e "$ {col_start} 设置 开机 启动 $ {col_end}"
cat> /lib/systemd/system/httpd.service << EOF
[Unit]
Description = O servidor HTTP Apache
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
[Instalar]
WantedBy = multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now httpd.service

O teste é o seguinte

Instalação binária do Word Press da arquitetura LAMP

Instalação binária do Word Press da arquitetura LAMP

Instalação binária do Word Press da arquitetura LAMP

Instalação binária do Word Press da arquitetura LAMP

Instalação binária do Word Press da arquitetura LAMP

Instalação binária do Word Press da arquitetura LAMP

Acho que você gosta

Origin blog.51cto.com/13812780/2546076
Recomendado
Clasificación